FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-97
REWIND Statement
REWIND Statement
The REWIND statement positions a file connected to a specified unit at its initial point.
If the file is already at its initial point, or if the file is connected but does not exist, the
REWIND statement has no effect.
unit
is an integer expression from 1 through 999 that identifies an external unit
connected for sequential access. The unit must be connected to a magnetic tape,
a process, an unstructured file with fixed-length records, a relative file, an EDIT
format file or an entry-sequenced file.
ios
ios is a variable or array element of integer type that returns an error number or
zero (no error) following the REWIND operation. For more information about error
numbers, see the Error Numbers on page 6-5.
lbl
lbl is the label of an executable statement in the same program unit to which
control passes if an error occurs during a rewind operation.
Considerations
If you rewind unit 5 or unit 6 and you have not already established a connection for
the unit, REWIND implicitly opens the unit using default parameters. If you specify
ENV COMMON and you rewind unit 5 or unit 6, your FORTRAN routines share
access to standard input or standard output, respectively, with routines written in
other languages only if the access mode for unit 5 is INPUT and for unit 6 is
OUTPUT. However, the default access mode for both units 5 and 6 is I-O. If you
want to share access to the file connected to the unit, you must set the unit’s
access mode to INPUT (unit 5) or OUTPUT (unit 6) before you execute the
REWIND statement. You can set the access mode:
REWIND
unit
unit ,
IOSTAT=ios
ERR=lbl



. . .



UNIT=unit
IOSTAT=ios
ERR=lbl





,
UNIT=unit
IOSTAT=ios
ERR=lbl





. . .






























