1.5 File Structures

File structures are also heavily machine-dependent. FIOLIB is a utility that allows data transfer between different machine types for files with fixed-length records.

A file attribute in the FORTRAN standard is basically defined by specifying the format (FORMATTED/UNFORMATTED) and access method (SEQUENTIAL/DIRECT). The FORMATTED/UNFORMATTED specification indicates whether an internal representation is converted into characters or is outputted as it is, for example, when a WRITE sentence is executed. In other words, it specifies the "contents of the file." On the other hand, specification of the access method, when taken as read, indicates whether the file is read and written sequentially or randomly. However, in most cases, the actual specification is made on the "file structure" for realizing the desired access method, and not the access method itself.

Standards require that the RECL specifier indicating the length of each record be written for DIRECT access files. However, it must not be used for SEQUENTIAL access files. In other words, by specifying the "access method," one implicitly indicates whether the file has a record of fixed length (DIRECT access file) or variable length (SEQUENTIAL access file).

There are also two methods by which a logical record on a FORTRAN program is recorded on an actual record medium, the mainframe systems (IBM systems) and UNIX systems. The two systems significantly differ on how they handle files.