FORTRAN Reference Manual

Introduction to File I/O in the HP NonStop
Environment
FORTRAN Reference Manual528615-001
5-18
Structured Files
°
You can read and write records sequentially.
°
You can backspace the file, rewind the file, or write an endfile record to the file.
°
You can use direct access for reading and writing records in the file. The
record number is the record’s EDIT line number times 1000. Use values of -1
for the beginning of the file and -2 for the end of the file.
°
You can change the length of a record as long as the length does not exceed
the specified record size for the file.
°
You can delete records.
If you READ the file directly with REC= specifying the nonnegative record number
(including 0) of a record that does not exist, then:
°
If the specified record number is beyond the end of the file, you get an end-
offile indication.
°
If the specified record number is not beyond the end of the file, you get the
record with the smallest record number that is greater than or equal to the
specified record number. FORTRAN does not consider this an error.
Consequently, you should have an INQUIRE statement with a NEXTREC
specifier after every such READ, to determine the record number of the record
actually obtained.
Structured Files
Structured files are entry-sequenced, relative, or key-sequenced files. You create a
structured file using the File Utility Program (FUP). You cannot create a structured file
using FORTRAN.
Use the following procedure to create a structured file:
1. Start the File Utility Program by entering the following at the TACL prompt:
1> FUP
2. Assign values to file creation parameters with the SET command. FUP maintains a
table of creation parameters. The values in this table determine the attributes of
any file you create with FUP. FUP uses the following codes to identify file types:
Entry-sequenced E
Relative R
Key-sequenced K
Note. EDIT format files are not structured files and are not protected by TMF. Although you
can do random positioning and updating of EDIT format files in FORTRAN programs (except in
programs that run as NonStop process pairs), you should avoid such actions for applications in
which fault tolerance or data integrity is important.