Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

REWIND

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Positions file at its initial point.

Syntax

The syntax of the REWIND statement can take one of the following forms:

  • Short form:

    integer-expression
  • Long form:

    REWIND (io-specifier-list)
integer-expression

is the unit connected to a sequential file or device.

io-specifier-list

is a list of the following comma-separated I/O specifiers:

[UNIT=]unit

specifies the unit connected to an external file opened for sequential access. unit must be an integer expression that evaluates to a number greater than 0. If the optional keyword UNIT= is omitted, unit must be the first item in io-specifier-list.

ERR=stmt-label

specifies the label of the executable statement to which control passes if an error occurs during statement execution.

IOSTAT=integer-variable

returns the I/O status after the statement executes. If the statement executes successfully, integer-variable is set to zero. If an error occurs, it is set to a positive integer that indicates which error occurred.

Description

The REWIND statement repositions the file connected to the specified unit at the start of the first record. If the file is already at its starting point or if the unit is not connected to a file, the REWIND statement has no effect.

Examples

The following example of the REWIND statement repositions the file connected to unit 10 to its initial point:

REWIND 10

The next example repositions to its initial point the file connected to unit 21. If an error occurs during the execution of the statement, control passes to the statement at label 99, and the error code is returned in ios:

REWIND (21, ERR=99, IOSTAT=ios)

Related statements

BACKSPACE, ENDFILE, and OPEN

Related concepts

For information about I/O concepts, see Chapter 8 “I/O and file handling”. This chapter also lists example programs that use I/O.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.