FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


INSERT FUNCTION TO TRANSLATE FILE NAMES

Syntax:

INSERT FUNCTION TO TRANSLATE FILE NAMES

Function:

A wrapper function is inserted around every file name referenced in an OPEN or INQUIRE statement or as an argument in a sub-program. The function may be used to translate between the file name formats used by different operating systems.

The name of the function is specified by the command TRANSLATION FUNCTION FOR FILE NAMES. It is of data type CHARACTER*256. The arguments are:

  1. The file name to be translated, CHARACTER*(*) INTENT (IN)

  2. A status return, INTEGER*4 INTENT(OUT)

Declarations for the function, and for its status return variable, are inserted wherever they are required.

An argument to a sub-program is declared to be a file name by writing the command !% FILE NAME :: <argument> in the code, within the scope of declaration of the named argument.

Where to use this command:

Operating system command line

Yes


Configuration file, config.fsp

Yes


Specification (FSP) files, *.fsp

Yes


Interactively, to FPT> prompt:

Yes


Interactive command files

Yes


Embedded in the Fortran code

Yes


Default:

No function is inserted by default.

Example:

A file name in an OPEN statement, for example:

OPEN (4,FILE='DKA400:[TESTSUITE.DATA2]TRAJ.DAT',STATUS='OLD')

is translated by the commands:

%translation function for file names: unix_file
%insert function to translate file names

to read:

OPEN (4,FILE= & UNIX_FILE('DKA400:[TESTSUITE.DATA2]TRAJ.DAT', & TFN_STATUS),STATUS='OLD')

The file name may be a variable or expression, for example:

OPEN (7,FILE=OUTDIR//BNAME,STATUS='UNKNOWN')

which becomes:

OPEN (7,FILE=UNIX_FILE(OUTDIR//BNAME,TFN_STATUS), & STATUS='UNKNOWN')

An argument to a sub-program may be declared to be a file name, for example:

SUBROUTINE FINDREC(FILESP,TARG,RECNO) CHARACTER*(*) & FILESP & ! Record file , TARG & ! Record to be found !% FILE NAME :: FILESP INTEGER*4 & RECNO ! Record number returned

and an invocation:

CALL FINDREC('DBASE:SUBJECTS.DAT',SEARCHNAME,IREC)

is then modified:

CALL FINDREC( & UNIX_FILE('DBASE:SUBJECTS.DAT',TFN_STATUS), & SEARCHNAME,IREC)

See also:

FILE NAME

INSERT SUBROUTINE TO TRANSLATE FILE NAMES

TRANSLATION FUNCTION FOR FILE NAMES

TRANSLATION SUBROUTINE FOR FILE NAMES


Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.