VMS Help  —  FORTRAN  Statements  REWIND
  Positions a sequential or direct access file at the beginning of
  the file.  Do not use a REWIND statement for a file that is open
  for indexed access.  Use this statement only for files on disk or
  magnetic tape.  Statement format:

      REWIND ([UNIT=]u[,ERR=s][,IOSTAT=ios])
      REWIND u

      u    Is an integer variable or constant specifying the
           logical unit number of the file, optionally prefaced
           by UNIT=.  UNIT= is required if unit is not the first
           I/O specifier.

      s    Is the label of a statement to which control is
           transferred if an error occurs, prefaced by ERR=.

      ios  Is an integer variable to which the completion status
           of the I/O operation is returned, prefaced by IOSTAT=.

  The unit number must refer to a file on disk or magnetic tape, and
  the file must be open for sequential, direct, or append access.

  If a REWIND is done on a direct access file, the NEXTREC specifier
  is assigned a value of 1.

  A REWIND statement must not be specified for a file that is open
  for keyed access.

  If a file is already positioned at the initial point, a REWIND
  statement has no effect.

  If a REWIND statement is specified for a unit that is not open, it
  has no effect.

  See also STATEMENTS BACKSPACE in this Help file.
Close Help