FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-70
OPEN Statement
Example
SUBROUTINE A
INTRINSIC SQRT
.
CALL number(x, y, SQRT)
.
END
SUBROUTINE number(a, b, c)
CALL C(A)
CALL C(B)
END
OPEN Statement
The OPEN statement associates an existing file with a unit number, or creates a new
file and associates it with a unit number.
unit
is an integer expression ranging from 1 through 999. Once defined, the properties
of this unit are the same for all program units of the executable program.
open-spec
is one of the following specifiers. You can specify open-specs in any order.
IOSTAT = ios
ios is an integer variable or integer array element in which FORTRAN returns
an error number if an error occurred while opening the unit. If the OPEN is
successful, ios is zero. For more information about error numbers, see the
Error Numbers on page 6-5.
ERR = label
label is the label of an executable statement in the current program unit to
which FORTRAN transfers control if an error occurs while opening the unit.
OPEN ( [UNIT=] unit [, open-spec ]... )