Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

Types of I/O Statements

The table below lists the file connection I/O statements:

Statement name

Description

CLOSE

Disconnects a unit number from an external file.

OPEN

Connects a unit number with an external file and specifies file connection characteristics.

The table below lists the file inquiry I/O statements:

Statement name

Description

DEFINE FILE

Specifies file characteristics for a direct access relative file and connects the unit number to the file, similar to an OPEN statement. Provided for compatibility with compilers older than FORTRAN-77.

INQUIRE

Returns information about a named file, a connection to a unit, or the length of an output item list.

The table below lists the record position I/O statements:

Statement name

Description

BACKSPACE

Moves the record position to the beginning of the previous record (sequential access only).

DELETE

Marks the record at the current record position in a relative file as deleted (direct access only).

ENDFILE

Writes an end-of-file marker after the current record (sequential access only).

FIND

Changes the record position in a direct access file. Provided for compatibility with compilers older than FORTRAN-77.

REWIND

Sets the record position to the beginning of the file (sequential access only).

The table below lists the record input I/O statements:

Statement name

Description

READ

Transfers data from an external file record or an internal file to internal storage.

ACCEPT

Reads input from stdin. Unlike READ, ACCEPT only provides formatted sequential input and does not specify a unit number.

The table below lists the record output I/O statements:

Statement name

Description

FLUSH

Flushes the contents of an external unit's buffer to its associated file.

PRINT

Transfers data from internal storage to stdout. Unlike WRITE, PRINT only provides formatted sequential output and does not specify a unit number.

REWRITE

Transfers data from internal storage to an external file record at the current record position (direct access relative files only).

TYPE

Writes record output to stdout.

WRITE

Transfers data from internal storage to an external file record or to an internal file.

In addition to the READ, WRITE, REWRITE, TYPE, and PRINT statements, other I/O record-related statements are limited to a specific file organization. For instance:

  • The DELETE statement only applies to relative files. (Detecting deleted records is only available if the vms option was specified when the program was compiled.)

  • The BACKSPACE statement only applies to sequential files open for sequential access.

  • The REWIND statement only applies to sequential files open for sequential access and to direct access files.

  • The ENDFILE statement only applies to certain types of sequential files open for sequential access and to direct access files.

The file-related statements (OPEN, INQUIRE, and CLOSE) apply to any relative or sequential file.