HP 3000 Manuals

REWIND Statement (Executable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

REWIND Statement (Executable) 

The REWIND statement positions a sequential file or device at its
beginning.

	       Click here to view figure.
            

----------------------------------------------------------------------------------------------
|                              |                              |                              |
|             Item             |     Description/Default      |         Restrictions         |
|                              |                              |                              |
----------------------------------------------------------------------------------------------
|                              |                              |                              |
| unit                         | Integer expression           | Must be zero or positive.    |
|                              | specifying unit number of a  |                              |
|                              | connected file.              |                              |
|                              |                              |                              |
----------------------------------------------------------------------------------------------
|                              |                              |                              |
| variable_name                | Error code return.           | Must be an integer data      |
| array_element                |                              | type.                        |
| scalar_record_field_name     |                              |                              |
|                              |                              |                              |
----------------------------------------------------------------------------------------------
|                              |                              |                              |
| label                        | Statement label.             | Must be an executable        |
|                              |                              | statement in the same        |
|                              |                              | program unit.                |
|                              |                              |                              |
----------------------------------------------------------------------------------------------

Semantics 

If the IOSTAT specifier is present and an error occurs, the error code is
returned in the IOSTAT variable and the program is not aborted.  Refer to
Appendix A  for the IOSTAT error codes.

If an error occurs during execution of the REWIND statement and the ERR
specifier is present, control transfers to the specified statement rather
than aborting the program.

If the file or device is already positioned at its beginning, a REWIND
statement has no effect.

As an extension to the ANSI 77 standard, the REWIND statement may be used
with files open for direct access.  It positions the file before the
first record.

                 Examples                                      Notes 

---------------------------------------------------------------------------------------

REWIND 10                                   The file connected to unit 10 is positioned
                                            at its beginning.

REWIND (UNIT=5, IOSTAT=j, ERR=100)          The file connected to unit 5 is positioned
                                            at its beginning.  If an error occurs,
                                            control transfers to statement 100 and the
                                            error code is returned in j.  If no error
                                            occurs, j is set to zero and control
                                            transfers to the next statement.

REWIND (UNIT=62, IOSTAT=j)                  The file connected to unit 62 is positioned
                                            at its beginning.  If an error occurs, the
                                            error code is stored in the variable j.  If
                                            no error occurs, j is set to zero.  In both
                                            cases, control transfers to the next
                                            statement.

REWIND (UNIT=12, ERR=100)                   The file connected to unit 12 is positioned
                                            at its beginning.  If an error occurs,
                                            control transfers to statement 100.  If no
                                            error occurs, control transfers to the next
                                            statement.



MPE/iX 5.0 Documentation