Intel fortran-80 manual Unit Properties, File Access

Models: fortran-80

1 130
Download 130 pages 742 b
Page 63
Image 63
6.1.2.5 File Access

FORTRAN-SO

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 direct-access read is the same as the order of the sequential write.

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 direct-access 110 statements. List-directed formatting cannot be used.

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 ISIS-II environment the console output device and console input device are always precon- nected. See the discussion of the UNIT run-time control in section F.3.

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.

6-3

Page 63
Image 63
Intel fortran-80 manual Unit Properties, File Access