Returns information about specified properties of a file or of a
logical unit on which a file might be opened. The unit need not
exist, nor need it be connected to a file. If the unit is
connected to a file, the inquiry encompasses both the connection
and the file. Statement format:
Inquiring by File:
INQUIRE (FILE=fi [,ERR=lbl][,IOSTAT=ivar][,DEFAULTFILE=def], flist)
Inquiring by Unit:
INQUIRE ([UNIT=]u [,ERR=lbl][,IOSTAT=ivar], flist)
Inquiring by Output List:
INQUIRE (IOLENGTH=len) olist
fi Is a scalar default character expression
specifying the name of the file for inquiry.
lbl Is the label of the branch target statement
that receives control if an error occurs.
var Is a scalar integer variable that is defined
as a positive integer if an error occurs and
zero if no error occurs.
def Is a scalar default character expression specifying
a default file pathname (or file specification) string.
flist Is one or more inquiry specifiers. Each specifier
can appear only once. Information about the
individual specifiers is available under the
subtopic headings listed at the end of this Help
topic.
u Is an integer variable or constant specifying the
logical unit number of the file, optionally prefaced
by UNIT=. UNIT= is required if unit is not the
first I/O specifier. 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.
len Is a scalar integer variable indicating
the number of bytes of data that would result from
using "olist" in an unformatted output statement.
olist Is a list of one or more output items.
FILE=fi, UNIT=u, ERR=lbl, and IOSTAT=var can appear anywhere within
the parentheses following INQUIRE. However, if the UNIT keyword is
omitted, the unit specifier ("u") must be the first parameter in
the list.
An INQUIRE statement may 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 after
opening the file. (File characteristics are stored in the file
header.)
1 – ACCESS
ACCESS = acc
acc Is a scalar default character variable that is
assigned one of the following values:
'SEQUENTIAL' If the file is open for sequential access
'DIRECT' If the file is open for direct access
'KEYED' If the file is open for keyed access
'UNDEFINED' If the file is not open
2 – ACTION
ACTION = act
act Is a scalar default character variable that is assigned
one of the following values:
'READ' If the file is connected for input only
'WRITE' If the file is connected for output only
'READWRITE' If the file is connected for both input
and output
'UNDEFINED' If the file is not connected
3 – BLANK
BLANK = blnk
blnk Is a character scalar memory reference that is
assigned one of the following values:
'NULL' If null blank control is in effect for the
file open for formatted I/O. (Blanks are
ignored unless the field is all blanks, in
which case it is treated as zero.)
'ZERO' If zero blank control is in effect. (All
blanks other than leading blanks are treated
as zeros.)
'UNDEFINED' If the file is not open or if the existing
file is not open for formatted I/O.
4 – BLOCKSIZE
BLOCKSIZE = bks bks Is a scalar integer variable. The "bks" is assigned the current size of the I/O buffer. If the unit or file is not connected, the value assigned is zero.
5 – BUFFERED
BUFFERED = bf
bf Is a scalar default character variable that is assigned
one of the following values:
'NO' If the file or unit is connected and
buffering is not in effect.
'YES' If the file or unit is connected and
buffering is in effect.
'UNKNOWN' If the file or unit is not connected.
6 – CARRIAGECONTROL
CARRIAGECONTROL = cc
cc Is a character scalar memory reference that is
assigned one of the following values:
'FORTRAN' If the file is open with the FORTRAN carriage
control
'LIST' If the file is open with implied carriage control
(single spacing between records)
'NONE' If the file is open with no carriage control
attribute
'UNKNOWN' If the file is not open
7 – CONVERT
CONVERT = fm
fm Is a character scalar memory reference that is assigned
one of the following values:
'LITTLE_ENDIAN': If the file is open with little endian
integer and IEEE floating-point data
conversion in effect.
'BIG_ENDIAN': If the file is open with big endian
integer and IEEE floating-point data
conversion in effect.
'CRAY': If the file is open with big endian
integer and CRAY floating-point data
conversion in effect.
'FDX': If the file is open with little endian
integer and VAX F_floating, D_floating,
and IEEE X_floating data conversion in
effect.
'FGX': If the file is open with little endian
integer and VAX F_floating, G_floating,
and IEEE X_floating data conversion in
effect.
'IBM': If the file is open with big endian
integer and IBM System\370 floating-
point data conversion in effect.
'VAXD': If the file is open with little endian
integer and VAX F_floating, D_floating,
and H_floating data conversion in effect.
'VAXG': If the file is open with little endian
integer and VAX F_floating, G_floating,
and H_floating data conversion in effect.
'NATIVE': If the file is open with no data
conversion in effect.
'UNKNOWN': If the file or unit is not connected
for unformatted I/O.
8 – DELIM
DELIM = del
del Is a scalar default character variable that is assigned
one of the following values:
'APOSTROPHE' If apostrophes are used to delimit character
constants in list-directed and namelist output
'QUOTE' If quotation marks are used to delimit character
constants in list-directed and namelist output
'NONE' If no delimiters are used
'UNDEFINED' If the file is not connected, or is not connected
for formatted data transfer
9 – DIRECT
DIRECT = dir
dir Is a character scalar memory reference that is
assigned one of the following values:
'YES' If the file is open for direct access
'NO' If the file is not open for direct access
'UNKNOWN' If the file is not open
10 – ERR
ERR = s s Is the label of an executable statement. ERR is a control specifier rather than a property specifier. If an error occurs during the execution of the INQUIRE statement, control is transferred to the statement whose label is "s".
11 – EXIST
EXIST = lv
lv Is a logical scalar memory reference that is
assigned one of the following values:
.TRUE. If the specified file exists and can be opened
or if the unit exists
.FALSE. If the specified file or unit does not exist or
if the file exists but cannot be opened
The unit exists if it is a number in the range allowed by the
processor.
12 – FORM
FORM = fm
fm Is a character scalar memory reference that is
assigned one of the following values:
'FORMATTED' If the file is open for formatted I/O
'UNFORMATTED' If the file is open for unformatted I/O
'UNDEFINED' If the file is not open
13 – FORMATTED
FORMATTED = fmd
fmd Is a character character scalar memory reference that is
assigned one of the following values:
'YES' If formatted I/O is allowed
'NO' If formatted I/O is not allowed
'UNKNOWN' If the processor cannot determine whether formatted
I/O is allowed
14 – IOSTAT
IOSTAT = ios ios Is a scalar default integer variable. IOSTAT is a control specifier rather than a property specifier. The "ios" is assigned a processor-dependent positive integer value if an error occurs during execution of the INQUIRE statement; it is assigned the value zero if there is no error condition.
15 – KEYED
KEYED = kyd
kyd Is a character scalar memory reference that is assigned
one of the following values:
'YES' If keyed access is allowed.
'NO' If keyed access is not allowed.
'UNKNOWN' If the processor cannot determine whether
keyed access is allowed
16 – NAME
NAME = nme
nme Is a character scalar memory reference that is
assigned the name of the file being inquired about.
If the file does not have a name, "nme" is undefined.
NOTE
The FILE and NAME keywords are synonyms when used
with the OPEN statement, but not when used with the
INQUIRE statement.
17 – NAMED
NAMED = nmd
nmd Is a logical scalar memory reference that is
assigned one of the following values:
.TRUE. If the specified file has a name
.FALSE. If the file does not have a name
18 – NEXTREC
NEXTREC = nr
nr Is a scalar integer variable that is assigned
a value as follows:
- If the file is connected for direct access and a
record (r) was previously read or written, the value
assigned is r + 1.
- If no record has been read or written, the value
assigned is 1.
- If the file is not connected for direct access, or
if the file position cannot be determined because
of an error condition, the value assigned is zero.
- If the file is connected for direct access and a REWIND
has been performed on the file, the value assigned is 1.
19 – NUMBER
NUMBER = num
num Is a scalar integer variable to which the
logical unit number of the file is returned. No value
is returned if the file is not connected to a unit.
20 – OPENED
OPENED = od
od Is a logical scalar memory reference that is
assigned one of the following values:
.TRUE. If the specified file or unit is open
.FALSE. If the specified file or unit is not open
21 – ORGANIZATION
ORGANIZATION = org
org Is a character scalar memory reference that is
assigned one of the following values:
'SEQUENTIAL' If the file is a sequential file
'RELATIVE' If the file is a relative file
'INDEXED' If the file is an indexed file
'UNKNOWN' If the file organization cannot
be determined
22 – PAD
PAD = pd
pd Is a scalar default character variable that is assigned
one of the following values:
'NO' If the file or unit was connected with PAD='NO'
'YES' If the file or unit was connected with PAD='YES'
23 – POSITION
POSITION = pos
pos Is a scalar default character variable that is assigned
one of the following values:
'REWIND' If the file is connected with its position
at its initial point
'APPEND' If the file is connected with its position
at its terminal point (or before its end-of-file
record, if any)
'ASIS' If the file is connected without changing
its position
'UNDEFINED' If the file is not connected, or is connected
for direct access data transfer and a REWIND
statement has not been performed on the unit.
24 – READ
READ = rd
rd Is a scalar default character variable that is assigned
one of the following values:
'YES' If the file can be read
'NO' If the file cannot be read
'UNKNOWN' If the processor cannot determine whether
the file can be read
25 – READWRITE
READWRITE = rdwr
rdwr Is a scalar default character variable that is assigned
one of the following values:
'YES' If the file can be both read and written to
'NO' If the file cannot be both read and written to
'UNKNOWN' If the processor cannot determine whether
the file can be both read and written to
26 – RECL
RECL = rcl
rcl Is a scalar integer variable whose value
depends on the following conditions:
- If the file or unit is open, "rcl" is the maximum
record length allowed in the file
- If the file is not open, "rcl" is the maximum
record length allowed in the file; or, if the
maximum record length is 0, "rcl" is the length
of the longest record in the file
- If the file is segmented, "rcl" is the longest
segment length in the file
- If the file does not exist, "rcl" is 0.
The assigned value is expressed in longwords (4-byte units) if the
file is currently (or was previously) connected for unformatted
data transfer; otherwise, the value is expressed in bytes.
27 – RECORDTYPE
RECORDTYPE = rtype
rtype Is a character scalar memory reference that is
assigned one of the following values:
'FIXED' If the file is open for fixed-length records
'VARIABLE' If the file is open for variable-length records
'SEGMENTED' If the file is open for unformatted sequential
I/O using segmented records
'STREAM' If the file's records are not terminated
'STREAM_CR' If the file's records are terminated with a
carriage-return
'STREAM_LF' If the file's records are terminated with a
line-feed
'UNKNOWN' If the processor cannot determine the record type
or the file is not open
28 – SEQUENTIAL
SEQUENTIAL = seq
seq Is a character scalar memory reference that is
assigned one of the following values:
'YES' If sequential access is allowed for the
specified file
'NO' If sequential access is not allowed
'UNKNOWN' If the access mode cannot be determined
29 – UNFORMATTED
UNFORMATTED = unf
unf Is a character scalar memory reference that is
assigned one of the following values:
'YES' If unformatted I/O is allowed for the
specified file
'NO' If unformatted I/O is not allowed
'UNKNOWN' If the form cannot be determined
30 – WRITE
WRITE = wr
wr Is a scalar default character variable that is assigned
one of the following values:
'YES' If the file can be written to
'NO' If the file cannot be written to
'UNKNOWN' If the processor cannot determine whether
the file can be written to