REWIND statement
Standard: F77 F90 F95 F2003
  Example Program
<Syntax>
 REWIND expression
 REWIND (rew-spec-list)
 rew-spec-list ::= rew-spec [,rew-spec]...
rew-spec::=[ UNIT= ] expression
 |ERR=label
 |IOMSG=variable
 |IOSTAT=variable

 In the REWIND expression form, the expression shall be a scalar integer expression with non-negative value; it identifies the unit.
<Semantics>
Sets the file position of a unit to the beginning of the file. In the rew-spec-list form, the UNIT= keyword may be omitted only if it is the first item in the list.
Note that some files are incapable of being rewound (an error will occur).

The IOMSG= specifier was added in Fortran 2003; this sets a character string variable to an error message if an error occurs. The ERR= or IOSTAT= specifier is still needed to prevent termination on error.
<Related>
BACKSPACE statement, CLOSE statement, ENDFILE statement, ERR= specifier, IOMSG= specifier, IOSTAT= specifier, OPEN statement, PRINT statement, READ statement, UNIT= specifier, WRITE statement