LOGICAL FUNCTION GETYN( PROMPT , DEFAULT )
CHARACTER*(*), INTENT(IN ) :: PROMPT ! Prompt for user
LOGICAL , INTENT(IN ) :: DEFAULT ! Default return value
Display thePROMPTto standard output forYESorNO, get the user's response and check that its first character, after upcasing, is 'Y' or 'N'. If 'Y', returnsTRUE; if 'N',FALSE. ReturnDEFAULTif the user hits <RET>. Re-prompts on error for up to 5 attempts; exits in case of more than 5 entry errors. If environment variablePROMPTFLAGis set to "N", returnsDEFAULTwithout prompting the user. Logs the value returned, for tracking and validation purposes.The default is displayed in square brackets like this: [Y].
See also GETVAL(), GETDATE(), GETDBLE(), GETMENU(), GETNUM(), GETREAL(), and GETSTR().
none
GETVAL()is the Fortran-90-generic (I/O API-3.2 or later only) that calls these or various other similar routines, as determined by the argument-list.For Fortran-90 declarations and interface checking:
USE M3UTILIO(See sample programs LATLON or PRESZ for additional usage examples.)
...
USE M3UTILIO !! else: LOGICAL, EXTERNAL :: GETYN
...
LOGICAL L
INTEGER N
...
L = GETYN( 'Give me a YES or NO', .TRUE )
...
IF ( .NOT. GETYN( 'Continue?', L ) ) CALL M3EXIT( 0 )
...
L = GETVAL( 'YES or NO?', .TRUE ) !! only if USE M3UTILIO
N = GETVAL( 99, 'Give me an INTEGER' ) !! only if USE M3UTILIO
...
Don't, unless you're already comfortable with mixed-language programming.
To: Models-3/EDSS I/O API: The Help Pages