FORTRAN Reference Manual

Introduction to File I/O in the HP NonStop
Environment
FORTRAN Reference Manual528615-001
5-2
Records
The file positioning statements, REWIND, BACKSPACE, ENDFILE, and POSITION,
determine the position of a file.
File status and positioning statements are also known as auxiliary I/O statements.
Records
Input and output involve reading records from files or writing records to files. A record
is a sequence of values or characters. FORTRAN uses three kinds of records:
formatted records, unformatted records, and end-of-file records.
A formatted record consists of a sequence of ASCII characters. The length of a
formatted record depends primarily on the number of characters put into the record
when it is written. A record can have a length of zero. You can read formatted records
with either formatted or unformatted I/O statements.
An unformatted record consists of a sequence of values and can contain character
data, noncharacter data, or no data. The length of an unformatted record is measured
in bytes and depends on the output list used when you write the record. You can
transmit unformatted records using either formatted or unformatted I/O statements.
You can write an end-of-file record only as the last record of a file which you can
access sequentially. The end-of-file record does not have a length attribute.
INQUIRE Ascertains properties of a file or of its connection.
OPEN Connects a structured file to a unit. Creates an unstructured file
and connects it to a unit.
POSITION Enables random access of files.
PRINT Outputs data to the preconnected output unit, unit 6.
READ Inputs data from specified unit or file.
REWIND Positions connected file to its initial point.
WRITE Outputs data to a specified unit.
Character literals used as control specifiers in I/O statements (for example, 'DIRECT', 'EXACT', 'FORMATTED',
and so forth) must be in uppercase characters.
Note. Records used for I/O operations are not the same as records defined by RECORD and
END RECORD declaration statements. This text refers to the former as records and to the
latter as RECORDs.
Table 5-1. FORTRAN I/O Statements (page2of2)
Name Action