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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

Branch Specifiers (END=, EOR=, ERR=)

A branch specifier identifies a branch target statement that receives control if an error, end-of-file, or end-of-record condition occurs. There are three branch specifiers, taking the following forms:

ERR=label

END=label

EOR=label

label

Is the label of the branch target statement that receives control when the specified condition occurs.

The branch target statement must be in the same scoping unit as the data transfer statement.

The following rules apply to these specifiers:

  • ERR

    The error specifier can appear in a sequential access READ or WRITE statement, a direct-access READ statement, or a REWRITE statement.

    If an error condition occurs, the position of the file is indeterminate, and execution of the statement terminates.

    If IOSTAT was specified, the IOSTAT variable becomes defined as a positive integer value. If SIZE was specified (in a nonadvancing READ statement), the SIZE variable becomes defined as an integer value. If a label was specified, execution continues with the labeled statement.

  • END

    The end-of-file specifier can appear only in a sequential access READ statement.

    An end-of-file condition occurs when no more records exist in a file during a sequential read, or when an end-of-file record produced by the ENDFILE statement is encountered. End-of-file conditions do not occur in direct-access READ statements.

    If an end-of-file condition occurs, the file is positioned after the end-of-file record, and execution of the statement terminates.

    If IOSTAT was specified, the IOSTAT variable becomes defined as a negative integer value. If a label was specified, execution continues with the labeled statement.

  • EOR

    The end-of-record specifier can appear only in a formatted, sequential access READ statement that has the specifier ADVANCE='NO'(nonadvancing input).

    An end-of-record condition occurs when a nonadvancing READ statement tries to transfer data from a position after the end of a record.

    If an end-of-record condition occurs, the file is positioned after the current record, and execution of the statement terminates.

    If IOSTAT was specified, the IOSTAT variable becomes defined as a negative integer value. If PAD='YES' was specified for file connection, the record is padded with blanks (as necessary) to satisfy the input item list and the corresponding data edit descriptor. If SIZE was specified, the SIZE variable becomes defined as an integer value. If a label was specified, execution continues with the labeled statement.

If one of the conditions occurs, no branch specifier appears in the control list, but an IOSTAT specifier appears, execution continues with the statement following the I/O statement. If neither a branch specifier nor an IOSTAT specifier appears, the program terminates.

See Also