Technical data

20
Chapter 1: Compiling, Linking, and Running Programs
File Formats
Fortran supports ve kinds of external les:
sequential formatted
sequential unformatted
direct formatted
direct unformatted
key indexed le
The operating system implements other les as ordinary les and makes no
assumptions about their internal structure.
Fortran I/O is based on records. When a program opens a direct le or key
indexed le, the length of the records must be given. The Fortran I/O system
uses the length to make the le appear to be made up of records of the given
length. When the record length of a direct le is 1, the system treats the le
as ordinary system les (as byte strings, in which each byte is addressable).
A READ or WRITE request on such les consumes bytes until satised,
rather than restricting itself to a single record.
Because of special requirements, sequential unformatted les 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 les into records
by using each new line indicator as a record separator. The Fortran 77
standard does not dene 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.