%	SUBROUTINE CHAR2I(STRING,IVAL,NVALS)AC_TITLE CHAR2I converts ASCII character string to binary integer.NC                                                                             IC_ARGS    TYPE        VARIABLE    I/O    DESCRIPTION                     A	CHARACTER*(*) STRING      !I     Character string of any length GC                                        which contains  only  decimal HC                                        characters or characters '+' or-C                                        '-'.E	INTEGER*4 IVAL(1)         !O     Dimensioned variable containing theHC                                        character integers converted to:C                                        binary integers. E	INTEGER*4 NVALS           !I     Number of integers to extract from >C                                        the character string.CAC_DESC  CHAR2I shall convert an ASCII character string of varyingHC       length and containing only decimal characters and characters '+'LC       or '-' to binary integer form. The calling routine shall specify the?C       number of integer variables to extract from the string.NC                                                                             EC_HIST  24Sep85  Eric M. Eliason  U.S.G.S. Flagstaff Original Version7C       13Nov86  Joni L. Bauers   updated documentationCNC_END                                                                         NC*****************************************************************************/C Initialize the output array IVAL to all zerosMC****************************************************************************      DO 10 I = 1,NVALS   10 IVAL(I) = 0NC*****************************************************************************EC Find, if there is one, the blank character or comma after the first!C number in the character string.MC****************************************************************************      ISTART = 1      DO 500 IV = 1,NVALSMC****************************************************************************=C Find the first non-blank character in the  character stringMC****************************************************************************      ILEN = LEN(STRING)      DO 100 I1 = ISTART,ILENA      IF (STRING(I1:I1).NE.' '.AND.STRING(I1:I1).NE.',') GOTO 110  100 CONTINUENC*****************************************************************************<C All characters in string are blank, return a value of zeroMC****************************************************************************      GOTO 9000  110 CONTINUE      DO 200 I2 = I1,ILEN@      IF (STRING(I2:I2).EQ.' '.OR.STRING(I2:I2).EQ.',') GOTO 210  200 CONTINUE      I2 = ILEN + 1  210 I2 = I2 - 1OC******************************************************************************BC Use the DECODE statement to convert the string to binary integerOC******************************************************************************      NCHARS = I2 - I1 + 14      DECODE(NCHARS,900,STRING(I1:I2),ERR=9000) IRES  900 FORMAT(I<NCHARS>)      IVAL(IV) = IRESOC******************************************************************************#C Set up for next time through loopNC*****************************************************************************      ISTART = I2 + 1  500 CONTINUE      RETURNOC******************************************************************************CC Set the result to zero, something wrong with the character stringOC****************************************************************************** 9000 CONTINUE      RETURN	      END