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

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Types of I/O Statements

The table below lists the Intel Fortran I/O statements:

Category and statement name

Description

File connection

OPEN

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

CLOSE

Disconnects a unit number from an external file.

File inquiry

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.

Record position

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).

Record input

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.

Record output

WRITE

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

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.

PRINT

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

FLUSH

Flushes the contents of an external unit's buffer to its associated 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.