REAL*8 FUNCTION GETDBLE( LO , HI , DEFAULT , PROMPT ) REAL*8 FUNCTION GETDBLE1( DEFAULT , PROMPT ) REAL*8 , INTENT(IN ) :: LO ! Minimum allowed return value REAL*8 , INTENT(IN ) :: HI ! Maximum allowed return value REAL*8 , INTENT(IN ) :: DEFAULT ! Default return value CHARACTER*(*), INTENT(IN ) :: PROMPT ! Prompt for user
PROMPTto standard output, get the user's response as a
GETDBLE(), check that it is within range
DEFAULTif the user hits <RET>. Re-prompts on error for up to 5 attempts; exits in case of more than 5 entry errors. If environment variable PROMPTFLAG is set to "N", returns
DEFAULTwithout prompting the user. Logs the value returned, for tracking and validation purposes.
The default is displayed in square brackets at the end of the prompt
For Fortran-90 declarations and interface checking:USE M3UTILIO
GETDBLE1is for I/O API-3.2 and later, only.
See also GETVAL(), GETDATE(), GETMENU(), GETNUM(), GETREAL(), GETSTR(), and GETYN().
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.
(See sample programs LATLON or PRESZ for additional usage examples.)
... USE M3UTILIO !! else: REAL*8, EXTERNAL :: GETDBLE, GETDBLE1 ... REAL*8 X, Y, Z, W INTEGER N ... X = GETDBLE( 0.0D0, 10.0D0, 7.5D0, & 'Give me a (REAL*8) number between 0.0d0 and 10.0d0' ) ... Y = GETDBLE1( 23.4d0, 'Give me a (REAL*8) number' ) ... Z = GETVAL( 12.3d0, 'Give me a (REAL*8) number' ) !! only if USE M3UTILIO N = GETVAL( 99, 'Give me a (INTEGER) number' ) !! only if USE M3UTILIO ...
Don't, unless you're already comfortable with mixed-language programming.
Up: Utility Routines
To: Models-3/EDSS I/O API: The Help Pages