| Input/Output |
6.1.2.5 File Access
An external file can be accessed sequentially or directly. An internal file can only be accessed sequentially.
Some external files may be allowed more than one access method, depending on the operating environment. The access method is determined when the file is connected to a unit.
6.1.2.5.1Sequential Access File. A file connected for sequential access has the following characteristics:
•The records are a totally ordered set, having the order in which they were written.
•The records are either all formatted or all unformatted.
If the file may also be connected for direct access, the order of a
6.1.2.5.2Direct Access Files. A file connected for direct access has the following characteristics:
•The order of its records is the order of their record numbers. Its records can be read or written in any order.
•Its records are either all formatted or all unformatted.
•Its records can be read or written only by
•All records of the file are the same length.
•Each record of the file has a unique record number, specified when the record is written. A record cannot be deleted or its number changed, but is can be rewrit- ten.
6.1.3 Unit Properties
A 'unit' is a logical way of referring to a file. Like files, units can exist or not for an executable program. All FORTRAN 110 statements can refer to existing units. The CLOSE statement can also refer to nonexistent units.
A unit has the property of being connected or disconnected. If connected, it refers to a file. All 110 statements except OPEN and CLOSE must reference a unit connected to a file.
Typically, a file is connected by the OPEN statement and disconnected by the CLOSE statement. Depending on the operating environment, some units may also be preconnected, meaning they can be referenced by 110 statements without first having to be connected by the OPEN statement. A preconnected file becomes con- nected the first time it is referenced by an 110 statement. For example, in the
A unit must not be connected to more than one file at a time, and vice versa. A file may, of course, be disconnected by the CLOSE statement and then reconnected to the same or a different unit by the OPEN statement.
NOTE
The only way to refer to a disconnected file is by naming it in an OPEN statement. Consequently, an unnamed file may not be able to be recon- nected once it has been disconnected.