Fortran 95 Language Features - Operations On External Files - The Inquire Statement

The Inquire Statement

At any time during the execution of a program it is possible to inquire about the status and attributes of a file using this statement. Using a variant of this statement, it is similarly possible to determine the status of a unit, for instance whether the unit number exists for that system Another variant permits an inquiry about the length of an output list when used to write an unformatted record.

For inquire by unit:

inquire (unit=u, ilist)

or for inquire by file:

inquire (file=fln, ilist)

or for inquire by I/O list:

inquire (iolength=length) olist

As an example:

logical :: ex, op character (len=11) :: nam, acc, seq, frm integer :: irec, nr inquire (unit=2, exist=ex, opened=op, name=nam, access=acc, sequential=seq, form=frm, & recl=irec, nextrec=nr)


ex .true. op .true. nam cities acc DIRECT seq NO frm UNFORMATTED irec 100 nr 1

(assuming no intervening read or write operations).

Other specifiers are iostat, opened, number, named, formatted, position, action, read, write, readwrite.

Read more about this topic:  Fortran 95 Language Features, Operations On External Files

Famous quotes containing the words statement and/or inquire:

    After the first powerful plain manifesto
    The black statement of pistons, without more fuss
    But gliding like a queen, she leaves the station.
    Stephen Spender (1909–1995)

    Navajo men and boys have an odd way of showing their friendship. When two young men meet at the trading post, a “Sing”, or a dance they greet each other, inquire about the health of their respective families, then stand silently some ten or fifteen minutes while one feels the other’s arms, shoulders, and chest.
    —Administration in the State of Ariz, U.S. public relief program (1935-1943)