Technical data
20
Chapter 1: Compiling, Linking, and Running Programs
File Formats
Fortran supports five kinds of external files:
• sequential formatted
• sequential unformatted
• direct formatted
• direct unformatted
• key indexed file
The operating system implements other files as ordinary files and makes no
assumptions about their internal structure.
Fortran I/O is based on records. When a program opens a direct file or key
indexed file, the length of the records must be given. The Fortran I/O system
uses the length to make the file appear to be made up of records of the given
length. When the record length of a direct file is 1, the system treats the file
as ordinary system files (as byte strings, in which each byte is addressable).
A READ or WRITE request on such files consumes bytes until satisfied,
rather than restricting itself to a single record.
Because of special requirements, sequential unformatted files will probably
be read or written only by Fortran I/O statements. Each record is preceded
and followed by an integer containing the length of the record in bytes.
During a READ, Fortran I/O breaks sequential formatted files into records
by using each new line indicator as a record separator. The Fortran 77
standard does not define the required result after reading past the end of a
record; the I/O system treats the record as being extended by blanks. On
output, the I/O system writes a new line indicator at the end of each record.
If a user program also writes a new line indicator, the I/O system treats it as
a separate record.










