HP Fortran Programmer's Reference (September 2007)

I/O and file handling
Records
Chapter 8 203
Records
The record is the basic unit of Fortran 90 I/O operations. It consists of either characters or
binary values, depending upon whether the record is formatted or unformatted. The following
sections describe both formatted and unformatted records, plus the special case of the
end-of-file record.
Note that nonadvancing I/O makes it possible to read and write partial records. For more
information, see “Nonadvancing I/O” on page 216.
Formatted records
A formatted record consists of characters that have been edited during list-directed or
namelist-directed I/O, or by a format specification during a data transfer. (For information
about format specifications, see “Format specification” on page 238.) The length of a formatted
record is measured in characters; there is no predefined maximum limit to the length of a
formatted record.
Unformatted records
An unformatted record consists of binary values in machine-representable format. The length
of an unformatted record is measured in bytes. Unformatted records cannot be processed by
list-directed or namelist-directed I/O statements or by I/O statements that use format
specifications to edit data.
End-of-file record
The end-of-file record is a special case: it contains no data and is the last record of a sequential
file. The end-of-file record is written:
By the ENDFILE statement
When the file is closed—either explicitly by the CLOSE statement or implicitly when the
program terminates—immediately following a write operation
When a BACKSPACE statement executes after a write operation, before the file is
backspaced
If the end-of-file record is encountered during the execution of the READ statement, the
program execution will abort unless the READ statement includes the END= specifier, the
IOSTAT= specifier, or both. For information about these specifiers, see the description of the
READ statement in Chapter 10, “HP Fortran statements,” on page 267.