Intel® Fortran Compiler 16.0 User and Reference Guide

Using the END, EOR, and ERR Branch Specifiers

When a severe error occurs during Intel® Fortran program execution, the default action is to display an error message and terminate the program. To override this default action, there are three branch specifiers you can use in I/O statements to transfer control to a specified point in the program:

If you use the END, EOR, or ERR branch specifiers, no error message is displayed and execution continues at the designated statement, usually an error-handling routine.

You might encounter an unexpected error that the error-handling routine cannot handle. In this case, do one of the following:

After you modify the source code, compile, link, and run the program to display the error message. For example:

    READ (8,50,ERR=400)

If any severe error occurs during execution of this statement, the Intel® Visual Fortran RTL transfers control to the statement at label 400. Similarly, you can use the END specifier to handle an end-of-file condition that might otherwise be treated as an error. For example:

    READ (12,70,END=550)

When using non-advancing I/O, use the EOR specifier to handle the end-of-record condition. For example:

150 FORMAT (F10.2, F10.2, I6)
    READ (UNIT=20, FMT=150, SIZE=X, ADVANCE='NO', EOR=700) A, F, I

You can also use ERR as a specifier in an OPEN, CLOSE, or INQUIRE statement. For example:

    OPEN (UNIT=10, FILE='FILNAME', STATUS='OLD', ERR=999)

If an error is detected during execution of this OPEN statement, control transfers to the statement at label 999.