SUBROUTINE SCANINT( STRING, VALUE, NCHARS, NDIGITS )
INTEGER FUNCTION STR2INT( ASTRING )
REAL FUNCTION STR2REAL( ASTRING )
CHARACTER*(*) ASTRING ! string to find effective length for
INTEGER or REAL value decoded
from ASTRING, or IMISS3
or BADVAL3 from
PARMS3.EXT (as
appropriate) for "missing" or badly-formatted inputs. Skips leading
whitespace (defined as ASCII characters less than or equal to the
BLANK/SPACE character; terminates input at the first nondigit or
the first non-exponent-designator, for STR2REAL.
SCANINT() returns the INTEGER value (equivalent to
VALUE=STR2INT(ASTRING), and also returns the total
number NCHARS of characters consumed (including
whitespace) and the number NDIGITS of digit and/or
leading sign characters
...
INCLUDE 'PARMS3.EXT'
...
CHARACTER*256 ASTRING, BSTRING
INTEGER L
REAL R
INTEGER STR2INT
EXTERNAL STR2INT
...
L = STR2INT( ASTRING )
IF ( L .EQ. IMISS3 ) THEN
WRITE (*,*) 'ASTRING: ", ASTRING, '" blank or not an integer'
ELSE
WRITE (*,*)
& 'INTEGER value stored in ASTRING is ', L
END IF
...
R = STR2REAL( BSTRING )
IF ( R .LT. AMISS3 ) THEN
WRITE (*,*) 'BSTRING: ", BSTRING, '" blank or not a real'
ELSE
WRITE (*,*)
& 'REAL value stored in BSTRING is ', R
END IF
...
To: Models-3/EDSS I/O API: The Help Pages