This is an executable statement.
The inquire statement is used to check on the status of different files.
inquire ( inquiry list)
The inquiry list must contain one of the following:
This is followed either by a quoted string or character variable containing the name of the file, for which information is needed.
This is followed by an integer variable or constant specifying the unit number for which information is needed.
There are other specifies that can go along with the INQUIRE statement. Most have uses that are beyond what a beginning programer has need for. Listed below are three more specifiers that may be useful for the beginner. However if additional information is required about some of the other specifiers, please consult a manual on the Fortran Standard.
After this specifier goes a logical variable. The program will then assign a value of true to the variable if the file does indeed exist and a value of false if it doesn't.
The number that gets returned when this specifier is used is the record length of a file connected for direct access, or the maximum record length for a file connected as sequential access.
This returns the access type or the kind of file you are inquiring about. The three character strings that can be returned are SEQUENTIAL, DIRECT, or UNDEFINED. These character strings are then stored in a character variable that is placed after the equals sign.
To check on the existence of a file:
This by itself won't help much as the program won't tell you anything if the file doesn't exist. So, do the following to find out:
if (log1==.false.) then Print *, 'File data.in does not exist!' stop endif
lecture twenty two
Written by Jason Wehr : email@example.com and Maintained by John Mahaffy : firstname.lastname@example.org