fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref 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(LEN=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 directive !% 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.

Examples

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 2022 Software Validation Ltd. All rights reserved.