Input/Output

FORTRAN-80

where 'unit' is an external unit specifier and 'arg-list' is a list of arguments as described for the BACKSPACE statement (section 6.2.3).

If the specified file is already positioned at its initial point, or if the file is connected but does not exist, the REWIND statement has no effect. If an end-of-file condition has occurred, the file can still be rewound.

Examples:

REWIND 3

REWIND (3, IOSTAT= ERRFLG, ERR= 1030)

6.2.5 ENDFILE Statement

When the ENDFILE statement is executed, the record preceding the ENDFILE becomes the last record of the file. No data-transfer I/O statement can be executed on the file without first issuing a BACKSPACE or REWIND statement. The file must be connected for sequential access when ENDFILE is issued.

The possible formats of the ENDFILE statment are

ENDFILE unit

ENDFILE (arg-list)

where 'unit' is an external unit specifier and 'arg-list' is a list of arguments as described for the BACKSPACE statement (6.2.3).

If the file can be connected for direct access also, only those records appearing before the end-of-file record can be read during subsequent direct access operations.

If a file is preconnected to a unit but does not yet exist, specifying the unit in an ENDFI LE statement causes the file to be created.

Examples:

ENDFILE 3

ENDFILE (3, ERR = 1040)

6.3 Data-Transfer 1/0 Statements

Once a file has been connected to a unit, data in the file can be read using the READ statement, or data can be written into the file using the WRITE or PRINT statements. Note that the keyword 'PRINT' does not imply that an output file is connected to a line printer, nor does the keyword 'WRITE' imply that it is not.

6.3.1 READ Statement

The READ statement reads data from a specified unit. Its possible formats are

READ (ctl-list) [in-list]

READ f [,in-list]

where

 

etl-Iist

is a list of control information specifiers

in-list

is a list of the data to be read

f

is a format identifier, and is the same as the 'FMT =f'

 

specifier in 'ctl-list.'

6-10

Page 70
Image 70
Intel fortran-80 manual Data-Transfer 1/0 Statements, Endfile Statement, Read Statement, Endfile arg-list