FORTRAN Reference Manual

Introduction to File I/O in the HP NonStop
Environment
FORTRAN Reference Manual528615-001
5-6
File Properties
Considerations
The first character of the node name must be a backslash (\).
The first character of the volume name must be a dollar sign ($).
Each component of a file name can contain up to eight characters.
If ENV OLD is in effect, the volume name in a file name that references a file at a
remote node can be a maximum of seven characters including the dollar sign. If
ENV COMMON is in effect, the VOLUME name can be eight characters including
the dollar sign.
Formatted and Unformatted Files
An unformatted file consists of unformatted records, and a formatted file consists of
formatted records. FORTRAN processes unformatted files more quickly than it
processes formatted files, because the processing of unformatted files does not require
that data be converted to an external representation. Note, however, that the HP
implementation of FORTRAN permits a file to contain both formatted and unformatted
records.
You specify the data format for a file when you connect the file to a unit, as in the
following example:
OPEN (22, FILE='budget', FORM='FORMATTED')
File Access
You can use three methods for accessing the records of an external file: sequential,
direct, and keyed.
When you access a file sequentially, you access each record in the file in the order in
which the records appear in the file. You can access sequential files only by
sequentially reading or writing each record in the file. If you need to read the tenth
record of a sequential file, you must process the preceding nine records first. You can
only access internal files sequentially.
You can use direct access I/O to write or read specific records in a file without
accessing any other record in the file. You can access an external file either
sequentially or directly.
If you use one of the three file types described in Structured Files on page 5-18, you
can also use primary or alternate key fields for keyed access when you read the file.
You determine the access method for an external file when you connect that file to a
unit; for example:
OPEN (100, FILE='oldaccts', ACCESS='DIRECT')
Some files are restricted to only one access method. For example, you can access
printer files only sequentially. Table 5-4 on page 5-7 shows the valid access methods
for HP-defined files.