FORTRAN Reference Manual
Statements
FORTRAN Reference Manual—528615-001
7-98
REWIND Statement
°
In a FORTRAN OPEN statement, as in
OPEN( 5, MODE = 'INPUT')
OPEN( 6, MODE = 'OUTPUT')
°
In a TACL ASSIGN command, as in
ASSIGN FT005, , INPUT
ASSIGN FT006, , OUTPUT
°
In a UNIT compiler directive, as in
UNIT (5, INPUT)
UNIT (6, OUTPUT)
For more information about using units 5 and 6 as shared files, see the OPEN 
Statement on page 7-70.
•
If a REWIND statement causes unit 5 or unit 6 to be implicitly opened and your 
program is running as a NonStop process, the FORTRAN run-time library does a 
stack checkpoint to the backup process as a part of the implicit open.
•
Error conditions
If you specify lbl, and an error occurs during the rewind operation, the REWIND 
statement terminates, the file position becomes indeterminate, and FORTRAN 
transfers control to the statement identified by lbl. If you also specify ios, you 
can determine the error that occurred by analyzing ios.
If you specify ios, but not lbl, and an error occurs during the rewind operation, 
your program continues executing with the statement that follows the REWIND 
statement. You can analyze ios to determine the error that occurred, if any.
If you do not specify ios or lbl, and an error occurs, FORTRAN terminates your 
program and displays a run-time diagnostic message.
•
Use of REWIND with EDIT format files
After a REWIND statement, the NEXTREC specifier of an INQUIRE statement 
returns -1 as the latest number of an EDIT format file.
Examples
REWIND 123
REWIND (ERR=370, UNIT=2)










