INQUIRE statement
Standard: F77 F90 F95 F2003 F2008
INQUIRE ( IOLENGTH = variable ) output-list

INQUIRE ( inquire-spec [ , inquire-spec ]... )

The possible inquire-specs are listed in the table in the section below. In this form, either the FILE= or UNIT= specifier must appear, but not both. For the UNIT= specifier, the keyword and equals sign may be omitted if it is the first inquire-spec.
The first form enquires as to the length needed to be specified for RECL= in the OPEN statement for an unformatted sequential file to be able to write records as large as the output-list.

The second form enquires the status of an external unit or external file. The effect of each clause is as below. All specifier arguments are scalar, and must be variables except for FILE=, ID= and UNIT=.

Specifier Argument Meaning Values
[ UNIT= ] Integer External unit number Non-negative
FILE= Character External file name
ACCESS= Character Current access mode 'DIRECT', 'SEQUENTIAL', 'STREAM', 'UNDEFINED'
ACTION= Character Currently allowed actions 'READ', 'READWRITE', 'UNDEFINED', 'WRITE'
ASYNCHRONOUS= Character Is async i/o allowed? 'YES', 'NO', 'UNDEFINED'
BLANK= Character Blanks are nulls or zeros? 'NULL', 'ZERO', 'UNDEFINED'
DECIMAL= Character Decimal edit mode 'POINT', 'COMMA', 'UNDEFINED'
DELIM= Character Character delimiter mode 'APOSTROPHE', 'NONE', 'QUOTE', 'UNDEFINED'
DIRECT= Character Is direct access allowed? 'YES', 'NO', 'UNKNOWN'
ENCODING= Character File encoding method 'ASCII', 'EBCDIC', 'UTF-8', 'UNDEFINED', 'UNKNOWN'
ERR= Label Goto if error in INQUIRE
EXIST= Logical File or unit exists? .TRUE. , .FALSE.
FORM= Character Form of connection 'FORMATTED', 'UNFORMATTED', 'UNDEFINED'
FORMATTED= Character Formatted i/o allowed? 'YES', 'NO', 'UNKNOWN'
ID= Integer Pending data transfer identifier
IOMSG= Character Error message from INQUIRE
IOSTAT= Integer Status of the INQUIRE
NAME= Character Name of the file
NAMED= Logical Whether the file is named .TRUE., .FALSE.
NEXTREC= Integer Next record for direct access
NUMBER= Integer Unit number
OPENED= Logical Is there a connection? .TRUE., .FALSE.
PAD= Character Record padding mode 'YES', 'NO', 'UNDEFINED'
PENDING= Logical Async i/o still pending?
POS= Integer Next file storage unit
POSITION= Character Current file position 'ASIS', 'REWIND', 'APPEND', 'UNDEFINED'
READ= Character Is READ allowed? 'YES', 'NO', 'UNKNOWN'
READWRITE= Character Are both READ and WRITE allowed? 'YES' , 'NO', 'UNKNOWN'
RECL= Integer Record length of file
SEQUENTIAL= Character Is sequential access allowed? 'YES', 'NO', 'UNKNOWN'
STREAM= Character Is stream access allowed? 'YES', 'NO', 'UNKNOWN'
UNFORMATTED= Character Unformatted i/o allowed? 'YES', 'NO', 'UNKNOWN'
WRITE= Character Is WRITE allowed? 'YES', 'NO', 'UNKNOWN'
ASYNCHRONOUS= specifier, CONVERT= specifier, DECIMAL= specifier, ENCODING= specifier, ERR= specifier, ID= specifier, IOMSG= specifier, IOSTAT= specifier, OPEN statement, PENDING= specifier, READ statement, ROUND= specifier, SIGN= specifier, UNIT= specifier, WRITE statement