Top: f77 Up: 7 - Compatibility_Features
Previous: 7 - Compatibility_Features Next: 7,2 - ENCODE_and_DECODE
Section 7,1: DEFINE_FILE
The DEFINE FILE statement establishes the size and structure of
files with relative organization and associates them with a logical
unit number. The DEFINE FILE statement is comparable to the OPEN
statement (in situations where you can use the OPEN statement, it
is the preferable mechanism for creating and opening files).
Statement format:
DEFINE FILE u(m, n, U, asv) [,u(m, n, U, asv)]...
u Is an integer constant or variable that specifies the
logical unit number.
m Is an integer constant or variable that specifies the
number of records in the file.
n Is an integer constant or variable that specifies the
length of each record in 16-bit words (2 bytes).
U Specifies that the file is unformatted (binary); this
is the only acceptable entry in this position.
asv Is an integer variable, called the associated variable
of the file. At the end of each direct access I/O
operation, the record number of the next higher numbered
record in the file is assigned to "asv"; "asv" must not
be a dummy argument.
The DEFINE FILE statement specifies that a file containing "m"
fixed-length records, each composed of n 16-bit words, exists (or
is to exist) on the specified logical unit. The records in the
file are numbered sequentially from 1 through "m".
A DEFINE FILE statement must be executed before the first direct
access I/O statement referring to the specified file, even though
the DEFINE FILE statement does not itself open the file. The file
is actually opened when the first direct access I/O statement for
the unit is executed.
If this I/O statement is a WRITE statement, a direct access
sequential file is opened, or created if necessary. If it is a
READ or FIND statement, an existing file is opened, unless the
specified file does not exist. If a file does not exist, an error
occurs.
Top: f77 Up: 7 - Compatibility_Features
Previous: 7 - Compatibility_Features Next: 7,2 - ENCODE_and_DECODE