VMS Help
FORTRAN, Statements, INQUIRE

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  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:

     INQUIRE ([FILE=fi][,DEFAULTFILE=dfi...],flist)
     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
            specification string.  Parts of the file specification
            not specified in FILE are filled in from DEFAULTFILE.
            Parts of the file specification that are still missing
            are filled in from your default directory when the
            program runs.

     flist  Is a list of property specifiers in which any one
            specifier appears 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.

  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 open 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.

  You can use INQUIRE to get file characteristics before opening a
  file.  (File characteristics are stored in the file header.)

  1 - ACCESS

  ACCESS = acc

  acc  Is a character scalar memory reference 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
  'UNKNOWN'     If the file is not open

  2 - 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.)

  'UNKNOWN'   If the file is not open or if the existing
              file is not open for formatted I/O.

  3 - 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 none of the above values apply

  4 - 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.

      '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 Compaq VAX
                        F_floating and D_floating data
                        conversion in effect.

      'VAXG':           If the file is open with little
                        endian integer and Compaq VAX
                        F_floating and G_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.

  5 - 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 processor cannot determine whether
              the processor is open for direct access

  6 - 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".

  7 - 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.

  8 - 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
  'UNKNOWN'       If no connection exists

  9 - 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

  10 - IOSTAT

  IOSTAT = ios

  ios  Is an integer scalar memory reference.

  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.

  11 - 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

  12 - 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.

  13 - 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

  14 - NEXTREC

  NEXTREC = nr

  nr  Is an integer scalar memory reference whose value depends
      on the following conditions:

      - If a record was previously read or written on the
        specified unit, the value of "nr" is one more than the
        number of that record.

      - If no records have been read or written, the value
        of "nr" is 1.

      - If the file is not opened for direct access or if the
        position is indeterminate because of an error condition,
        "nr" is 0.

  15 - NUMBER

  NUMBER = num

  num  Is an integer scalar memory reference to which the
       logical unit number of the file is returned.  No value
       is returned if the file is not connected to a unit.

  16 - 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

  17 - 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' (OpenVMS only)  If the file is an indexed file
  'UNKNOWN'             If the file organization cannot
                           be determined

  18 - RECL

  RECL = rcl

  rcl  Is an integer scalar memory reference 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 length is expressed in bytes for formatted files and longwords
  for unformatted files.

  19 - 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

  20 - 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

  21 - 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
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.