9.5 INQUIRE Statement

The INQUIRE statement requests information about specified properties of a file or of a logical unit on which a file might be opened. It takes one of the following forms:

Inquiring by File

INQUIRE (FILE=fi [,DEFAULTFILE=dfi . . .], flist)

Inquiring by Unit

INQUIRE ([UNIT=]u, flist)
fi
Is a character expression, numeric scalar memory reference, or numeric array name reference whose value specifies the name of the file to be inquired about.
dfi
Is a character expression specifying a default file name specification string.
flist
Is a list of property specifiers in which any one specifier appears only once. The specifiers are described in the following sections.
u
Is the number of the logical unit to be inquired about. The unit does not have to exist, nor does it need to be connected to a file. If the unit is connected to a file, the inquiry encompasses both the connection and the file.

Rules and Behavior

FILE=fi and UNIT=u can appear anywhere in the property-specifier list; however, if the UNIT keyword is omitted, the unit specifier u must be the first parameter in the list.

When inquiring by file, you can specify DEFAULTFILE=dfi in addition to or in place of FILE=fi. If a file is opened with both FILE and DEFAULTFILE keywords specified in the OPEN statement, then you can inquire about this file by specifying both the FILE and DEFAULTFILE keywords in the INQUIRE statement.

An INQUIRE statement can be executed before, during, or after the connection of a file to a unit. The values assigned by the statement are those that are current when the INQUIRE statement executes.

To get file characteristics, specify the INQUIRE statement before opening the file. (File characteristics are stored in the file header.)


Previous Page Next Page Table of Contents