' GETDBLE()

GETDBLE()

Fortran version:

    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

NO C version:

Summary:

Display the PROMPT to standard output, get the user's response as a REAL*8 and for GETDBLE(), check that it is within range [LO,HI]. Return DEFAULT if 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 DEFAULT without 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 [LIKE THIS]

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    
GETDBLE1 is for I/O API-3.2 and later, only.

See also GETVAL(), GETDATE(), GETMENU(), GETNUM(), GETREAL(), GETSTR(), and GETYN().

Preconditions:

none

Fortran Usage:

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

C Usage:

Don't, unless you're already comfortable with mixed-language programming.


Previous: GETDATE

Next: GETDFILE

Up: Utility Routines

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