INTEGER FUNCTION PROMPTFFILE( PROMPT, RDONLY, FMTTED, DEFAULT, CALLER ) CHARACTER*(*), INTENT(IN ) :: PROMPT ! prompt for user LOGICAL , INTENT(IN ) :: RDONLY ! TRUE iff file is input-only LOGICAL , INTENT(IN ) :: FMTTED ! TRUE iff file should be formatted CHARACTER*(*), INTENT(IN ) :: DEFAULT ! default logical file name CHARACTER*(*), INTENT(IN ) :: CALLER ! caller-name for logging messages
Prompts user for logical file name, then opens the Fortran sequential file associated with it, for read-only or not, and formatted or not, as indicated by RDONLY and FMTTED. If environment variable PROMPTFLAG is set to "N", returns unit number associated with logical name contained in DEFAULT without prompting the user.
Logs the value returned, for tracking and validation purposes.
Returns
For Fortran-90 declarations and interface checking:
USE M3UTILIO
See also:
GETDFILE(),
GETEFILE(),
PROMPTDFILE(), and
PROMPTMFILE().
setenv <lname> <pathname>
for the file
before program launch.
... USE M3UTILIO ... INTEGER FOODEV, BARDEV, QUXDEV ... FOODEV = PROMPTFFILE( 'Enter name for foo-file', & .TRUE., .TRUE., & 'FOO', 'MYSUB' ) IF ( FOODEV .LT. 0 ) THEN ... error opening foo-file: deal with it END IF BARDEV = PROMPTFFILE( 'Enter name for bar-file', & .FALSE., .FALSE., & 'BAR', 'MYSUB' ) IF ( BARDEV .LT. 0 ) THEN ... error opening bar-file: deal with it END IF QUXDEV = PROMPTFFILE( 'Enter name for qux-file (or "NONE")', & .FALSE., .TRUE., & 'QUX', 'MYSUB' ) IF ( QUXDEV .EQ. -2 ) THEN ... don't want output file QUX ELSE IF ( QUXDEV .LT. 0 ) THEN ... error opening qux-file: deal with it END IF ...
To: Models-3/EDSS I/O API: The Help Pages