Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

FIND

Statement: Positions a direct access file at a particular record and sets the associated variable of the file to that record number. It is comparable to a direct access READ statement with no I/O list, and it can open an existing file. No data transfer takes place.

FIND ([UNIT=] io-unit, REC= r[, ERR= label] [, IOSTAT= i-var])

FIND (io-unit 'r [, ERR=label] [, IOSTAT=i-var])

io-unit

Is a logical unit number. It must refer to a relative organization file (see Unit Specifier).

r

Is the direct access record number. It cannot be less than one or greater than the number of records defined for the file (see Record Specifier).

label

Is the label of the executable statement that receives control if an error occurs.

i-var

Is a scalar integer variable that is defined as a positive integer if an error occurs, and as zero if no error occurs (see I/O Status Specifier).

Example

In the following example, the FIND statement positions logical unit 1 at the first record in the file. The file's associated variable is set to one:

  FIND(1, REC=1)

In the following example, the FIND statement positions the file at the record identified by the content of INDX. The file's associated variable is set to the value of INDX:

  FIND(4, REC=INDX)