PROMPTFFILE()

Fortran version:

    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

C version: none

Summary:

For interactive use -- not for modeling nor for programs that will be driven by scripts! For modeling or script driven programs, use GETEFILE(), instead.

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

Preconditions:

setenv <lname> <pathname> for the file before program launch.

Fortran Usage:

Suppose you want to open a "foo"-file, a "bar"-file, and optionally a "qux"-file (with the corresponding default logical names FOO, BAR, and QUX) the first as sequential read-only formatted, the second as sequential read-write unformatted; and the third as read-write formatted but possibly not used, from the subroutine "MYSUB":
    ...
    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
    ...


Previous: POLY

Next: PROMPTMFILE

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages