fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

CHANGE DEFINE FILE TO OPEN

Syntax:

[DO NOT] CHANGE DEFINE FILE TO OPEN

Function:

The DEFINE FILE statement specifies the attributes of an unformatted direct access file. The syntax is:

DEFINE FILE <lun>(<nrec>,<recl>,U,<asvar>)

where:

<lun>, <nrec>, and <recl> may be literal integer values, integer Fortran parameters or integer variables. Each must be represented by a single token. They may not be expressions or array elements. The <recl> argument is measured in 16-bit units.

The statement is almost equivalent to:

OPEN (UNIT=<lun>, STATUS='UNKNOWN', ACCESS='DIRECT', FORM='UNFORMATTED', RECORDTYPE='FIXED', MAXREC=<nrec>, RECL=((<recl>+1)/2), ASSOCIATEVARIABLE=<asvar>)

The difference is that DEFINE FILE does not immediately open the file. It is opened when it is first read or written to.

This command comments out the original DEFINE FILE statement and writes a translation to an OPEN statement after it. The MAXREC argument is omitted.

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

* If the command is made interactively and any of the commands CHANGE ALL IO TO SUBPROGRAM CALLS, CHANGE FILE IO TO SUBPROGRAM CALLS or CHANGE ISAM FILE REFERENCES TO SUB-PROGRAM CALLS is used the command CHANGE DEFINE FILE TO OPEN should be made first.

Default

No change is made by default.

Example

The original code:

DEFINE FILE 8(2000,24,U,iav)

is translated to:

!!! FPT DEFINE FILE 8(2000,24,U,iav) OPEN(UNIT=8, STATUS='UNKNOWN', ACCESS='DIRECT', FORM='UNFORMATTED', & RECORDTYPE='FIXED', RECL=24, ASSOCIATEVARIABLE=iav)

Thanks

Thanks are due to James Hale and Denys Beauchemin at Sector7 Inc. who found this little horror.

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