      SUBROUTINE DAPAIR(SLACK ,KNDBGN,KNDEND,KONECT,IBUFFR,
     1    MAXBFR,LOWBFR,KIND  ,NEWBGN,NEWEND,BGNNEW,ENDNEW,
     2    IWHERE,INCBGN,LMTBGN,BGNINC,BGNLMT,INCEND,LMTEND,
     3    ENDINC,ENDLMT)
C     RENBR(/INTERPRET PAIR OF ASSOCIATED VALUES)
C
C     DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C     FOLLOWING ARGUMENTS ARE USED FOR INPUT ONLY, AND  ARE
C     RETURNED UNCHANGED.
C
C     SLACK  = FRACTION OF INCREMENT OF  REAL  NUMBER  (NOT
C              INTEGER)  RANGE EXPRESSED IN SLASH NOTATION,
C              BY WHICH RETURNED  VALUE  CAN  EXCEED  FINAL
C              BOUND  AND  STILL BE CONSIDERED TO BE WITHIN
C              RANGE.
C     KNDBGN = SPECIFIES  WHETHER  INDEX  IS  RETURNED   AS
C              INTEGER  ARGUMENT NEWBGN OR AS REAL ARGUMENT
C              BGNNEW.  NUMBER CAN BE  TYPED  WITH  DECIMAL
C              POINT AND/OR EXPONENT REGARDLESS OF VALUE OF
C              KNDBGN.
C            = -1, INDEX IS CALCULATED AS OCTAL INTEGER AND
C              IS  RETURNED  AS  ARGUMENT NEWBGN.  HOWEVER,
C              NUMBER FOLLOWING LETTER  E  OF  EXPONENT  IS
C              EVALUATED IN DECIMAL.
C            = 0, INDEX IS CALCULATED  AS  DECIMAL  INTEGER
C              AND IS RETURNED AS ARGUMENT NEWBGN.
C            = 1 OR GREATER,  INDEX  IS  RETURNED  AS  REAL
C              ARGUMENT  BGNNEW.   IF POSSIBLE, REAL NUMBER
C              WILL BE  ACCUMULATED  AS  INTEGER,  THEN  BE
C              CONVERTED  TO REAL AND SHIFTED AS NECESSARY.
C              KNDBGN  IS  MAXIMUM  NUMBER  OF  DIGITS   IN
C              INTEGER.
C     KNDEND = SPECIFIES  WHETHER   ASSOCIATED   VALUE   IS
C              RETURNED  AS  INTEGER  ARGUMENT NEWEND OR AS
C              REAL ARGUMENT ENDNEW.  NUMBER CAN  BE  TYPED
C              WITH    DECIMAL    POINT   AND/OR   EXPONENT
C              REGARDLESS OF VALUE OF KNDEND.
C            = -1, ASSOCIATED VALUE IS CALCULATED AS  OCTAL
C              INTEGER  AND IS RETURNED AS ARGUMENT NEWEND.
C              HOWEVER,  NUMBER  FOLLOWING  LETTER   E   OF
C              EXPONENT IS EVALUATED IN DECIMAL.
C            = 0, ASSOCIATED VALUE IS CALCULATED AS DECIMAL
C              INTEGER AND IS RETURNED AS ARGUMENT NEWEND.
C            = 1 OR GREATER, ASSOCIATED VALUE  IS  RETURNED
C              AS  REAL ARGUMENT ENDNEW.  IF POSSIBLE, REAL
C              NUMBER WILL BE ACCUMULATED AS INTEGER,  THEN
C              BE   CONVERTED   TO   REAL  AND  SHIFTED  AS
C              NECESSARY.   KNDEND  IS  MAXIMUM  NUMBER  OF
C              DIGITS IN INTEGER.
C
C     KONECT = SPECIFIES  MANNER   OF   INTERPRETATION   OF
C              FOLLOWING  NUMBER  WHEN RANGE OF INDEXES AND
C              RANGE OF ASSOCIATED VALUES  HAVE  BOTH  BEEN
C              EXHAUSTED.   KONECT  ALSO  SPECIFIES WHETHER
C              COMMAS  ARE  TO  INDICATE   THAT   FOLLOWING
C              NUMBER, IF ANY, IS TO BE INDEX OF SUBSEQUENT
C              PAIR, OR WHETHER COMMAS ARE ALLOWED  BETWEEN
C              SUBSEQUENT VALUES ASSOCIATED WITH SAME INDEX
C              OR RANGE OF INDEXES.  REGARDLESS OF VALUE OF
C              KONECT,  ALL  COMMAS  APPEARING  TO  LEFT OF
C              INDEX ARE IGNORED.
C            = -1, 0 OR 1,  COMMAS  CANNOT  APPEAR  BETWEEN
C              SPECIFICATION OF INDEX AND OF ITS ASSOCIATED
C              VALUE    AND    CANNOT    APPEAR     BETWEEN
C              REPRESENTATIONS   OF  SUBSEQUENT  ASSOCIATED
C              VALUES.  IF COMMA IS FOUND,  THEN  FOLLOWING
C              NUMBER,  IF  ANY,  IS  TAKEN  TO BE INDEX OF
C              SUBSEQUENT PAIR OF NUMBERS.
C            = -1, WHEN  RANGE  OF  INDEXES  AND  RANGE  OF
C              ASSOCIATED  VALUES HAVE BOTH BEEN EXHAUSTED,
C              FOLLOWING REPRESENTATION  OF  NUMBER  OR  OF
C              RANGE  OF  NUMBERS  ON SAME LINE IS TAKEN TO
C              SPECIFY ADDITIONAL ASSOCIATED VALUES.
C
C              IF END OF LINE  IS  FOUND  BEFORE  RANGE  OF
C              INDEXES  HAS  BEEN  EXHAUSTED,  THEN CALLING
C              PROGRAM CAN REQUEST (BY  SETTING  KIND=4  TO
C              SIMULATE    FINDING   OF   AMPERSAND)   THAT
C              EVALUATION OF ASSOCIATED  VALUES  IS  TO  BE
C              CONTINUED  BY  NEXT  CALL TO THIS ROUTINE IN
C              NEW TEXT READ INTO INPUT BUFFER.  IF END  OF
C              LINE  IS  FOUND  BEFORE RANGE OF INDEXES HAS
C              BEEN EXHAUSTED, BUT CALLING  PROGRAM  LEAVES
C              KIND  UNCHANGED  BEFORE  AGAIN  CALLING THIS
C              ROUTINE, THEN REMAINING INDEX VALUES WILL BE
C              RETURNED    WITHOUT    ASSOCIATED    VALUES,
C              FOLLOWING WHICH FIRST NUMBER IN NEW CONTENTS
C              OF  TEXT BUFFER WILL BE INTERPRETED AS INDEX
C              OF NEW PAIR.
C
C              IF AMPERSAND IS  FOUND  TO  RIGHT  OF  INDEX
C              SPECIFICATION,  REGARDLESS  OF WHETHER RANGE
C              OF  INDEXES   HAS   BEEN   EXHAUSTED,   THEN
C              EVALUATION  OF  ASSOCIATED  VALUES  WILL  BE
C              CONTINUED BY NEXT CALL TO  THIS  ROUTINE  IN
C              NEW   TEXT   READ  INTO  INPUT  BUFFER.   IF
C              AMPERSAND IS FOUND PRIOR  TO  EXHAUSTION  OF
C              RANGE  OF  INDEXES,  BUT NEXT LINE READ INTO
C              INPUT BUFFER IS TO START NEW PAIR, THEN KIND
C              SHOULD  BE  SET  TO  6  BY  CALLING  PROGRAM
C              CAUSING REMAINING INDEXES  TO  BE  GENERATED
C              FIRST   BUT   MARKED   AS   HAVING   MISSING
C              ASSOCIATED VALUES.  IF  AMPERSAND  IS  FOUND
C              AFTER  EXHAUSTION  OF  RANGE OF INDEXES, BUT
C              NEXT LINE READ INTO INPUT BUFFER IS TO START
C              NEW PAIR, THEN KIND SHOULD BE SET TO ONE.
C
C            = 0,  WHEN  RANGE  OF  INDEXES  AND  RANGE  OF
C              ASSOCIATED  VALUES HAVE BOTH BEEN EXHAUSTED,
C              FOLLOWING REPRESENTATION  OF  NUMBER  OR  OF
C              RANGE  OF  NUMBERS  ON SAME LINE CAUSES THIS
C              ROUTINE  TO  REPORT   MISSING   COMMA,   AND
C              SUBSEQUENT  CALL TO THIS ROUTINE THEN BEGINS
C              EVALUATION OF THIS FOLLOWING NUMBER AS INDEX
C              OR RANGE OF INDEXES OF SUBSEQUENT PAIR.
C
C              IF END OF LINE  IS  FOUND  BEFORE  RANGE  OF
C              INDEXES  HAS  BEEN  EXHAUSTED,  THEN CALLING
C              PROGRAM CAN REQUEST (BY  SETTING  KIND=4  TO
C              SIMULATE    FINDING   OF   AMPERSAND)   THAT
C              EVALUATION OF ASSOCIATED  VALUES  IS  TO  BE
C              CONTINUED  BY  NEXT  CALL TO THIS ROUTINE IN
C              NEW TEXT READ INTO INPUT BUFFER.  IF END  OF
C              LINE  IS  FOUND  BEFORE RANGE OF INDEXES HAS
C              BEEN EXHAUSTED, BUT CALLING  PROGRAM  LEAVES
C              KIND  UNCHANGED  BEFORE  AGAIN  CALLING THIS
C              ROUTINE, THEN REMAINING INDEX VALUES WILL BE
C              RETURNED    WITHOUT    ASSOCIATED    VALUES,
C              FOLLOWING WHICH FIRST NUMBER IN NEW CONTENTS
C              OF  TEXT BUFFER WILL BE INTERPRETED AS INDEX
C              OF SUBSEQUENT PAIR.
C
C              IF AMPERSAND IS FOUND PRIOR TO EXHAUSTION OF
C              RANGE   OF   INDEXES,   THEN  EVALUATION  OF
C              ASSOCIATED VALUES WILL BE CONTINUED BY  NEXT
C              CALL  TO  THIS ROUTINE IN NEW TEXT READ INTO
C              INPUT BUFFER  UNLESS  CALLING  PROGRAM  SETS
C              KIND  TO  6 PRIOR TO SUBSEQUENT CALL TO THIS
C              ROUTINE, CAUSING  REMAINING  INDEXES  TO  BE
C              GENERATED   BUT  MARKED  AS  HAVING  MISSING
C              ASSOCIATED VALUES.  IF  AMPERSAND  IS  FOUND
C              AFTER   RANGE   OF   INDEXES  AND  RANGE  OF
C              ASSOCIATED VALUES HAVE BOTH BEEN  EXHAUSTED,
C              THEN  FIRST  NUMBER  EVALUATED BY SUBSEQUENT
C              CALL TO THIS ROUTINE IN NEW TEXT  READ  INTO
C              INPUT  BUFFER  IS ASSUMED TO BE INDEX OF NEW
C              PAIR OF VALUES.
C
C              = 1, WHEN RANGE  OF  INDEXES  AND  RANGE  OF
C              ASSOCIATED  VALUES HAVE BOTH BEEN EXHAUSTED,
C              FOLLOWING REPRESENTATION  OF  NUMBER  OR  OF
C              RANGE  OF  NUMBERS  ON SAME LINE IS TAKEN TO
C              SPECIFY ADDITIONAL ASSOCIATED VALUES.
C
C              IF EITHER AMPERSAND OR END OF LINE IS  FOUND
C              BEFORE  RANGE OF INDEXES HAS BEEN EXHAUSTED,
C              THEN REMAINING INDEX VALUES WILL BE RETURNED
C              WITHOUT  ASSOCIATED  VALUES, FOLLOWING WHICH
C              CALLING PROGRAM WILL BE INFORMED THAT END OF
C              LINE OR AMPERSAND HAS BEEN REACHED.
C
C            = 2, 3 OR 4, SAME AS WHEN KONECT=-1,  0  OR  1
C              RESPECTIVELY,  EXCEPT THAT COMMAS CAN APPEAR
C              (BUT    ARE    NOT     REQUIRED)     BETWEEN
C              REPRESENTATIONS    OF    INDEX   AND   FIRST
C              ASSOCIATED VALUE AND BETWEEN REPRESENTATIONS
C              OF   SUBSEQUENT  ASSOCIATED  VALUES.   EXTRA
C              COMMA INDICATES  MISSING  ASSOCIATED  VALUE.
C              IF  KONECT=3,  AND  IF  RANGE OF INDEXES AND
C              RANGE OF ASSOCIATED VALUES  HAVE  BOTH  BEEN
C              EXHAUSTED, THEN KIND WILL BE RETURNED SET TO
C              10  TO   INDICATE   MISSING   SEMICOLON   IF
C              FOLLOWING  NUMBER  IS  FOUND  WHETHER OR NOT
C              THIS FOLLOWING NUMBER IS PRECEDED BY  COMMA,
C              AND  SUBSEQUENT  CALL  TO  THIS ROUTINE WILL
C              BEGIN  EVALUATION  OF  FOLLOWING  NUMBER  AS
C              INDEX  OR  RANGE  OF  INDEXES  OF SUBSEQUENT
C              PAIR.  UNLIKE COMMAS, SEMICOLONS ARE  ALWAYS
C              REPORTED  TO  CALLING  PROGRAM REGARDLESS OF
C              VALUE OF KONECT.
C
C     IBUFFR = INPUT  BUFFER  ARRAY  CONTAINING  CHARACTERS
C              TYPED  BY  USER,  READ  BY  MULTIPLE  OF  A1
C              FORMAT, WHICH IS TO BE SEARCHED  FOR  NUMBER
C              SPECIFICATIONS.   IBUFFR  THEN  CONTAINS ONE
C              CHARACTER PER COMPUTER STORAGE LOCATION.
C
C     MAXBFR = MAXIMUM SUBSCRIPT OF IBUFFR ARRAY  LOCATIONS
C              TO BE SEARCHED.
C
C     FOLLOWING ARGUMENTS ARE USED BOTH FOR INPUT  TO  THIS
C     ROUTINE, AND FOR OUTPUT TO CALLING PROGRAM.
C
C     LOWBFR = INPUT  CONTAINING  SUBSCRIPT  WITHIN  IBUFFR
C              ARRAY  OF  FIRST  (LEFTMOST) CHARACTER WHICH
C              CAN BE  SCANNED  FOR  NUMBER  SPECIFICATION.
C              LOWBFR   IS   RETURNED   POINTING   TO  NEXT
C              CHARACTER  WHICH  WOULD  BE  INTERPRETED  BY
C              SUBSEQUENT  CALL  TO  THIS  ROUTINE  IF THIS
C              SUBSEQUENT CALL NEEDS  TO  EVALUATE  FURTHER
C              NUMBER  SPECIFICATIONS.   LOWBFR IS RETURNED
C              UNCHANGED IF THIS ROUTINE  MERELY  GENERATES
C              NEXT   ASSOCIATED  VALUE  WITHIN  PREVIOUSLY
C              DETERMINED RANGE.  IF THERE ARE NO  PRINTING
C              CHARACTERS AT OR TO RIGHT OF IBUFFR(LOWBFR),
C              BUT INTERPRETATION OF ADDITIONAL  CHARACTERS
C              IS  ATTEMPTED,  THEN LOWBFR WILL BE RETURNED
C              CONTAINING MAXBFR+1.  LOWBFR MUST  BE  RESET
C              BY   CALLING   PROGRAM  TO  POINT  TO  FIRST
C              CHARACTER IN IBUFFR ARRAY EACH TIME NEW LINE
C              OF TEXT IS READ.
C
C     KIND   = INPUT CONTAINING -1, ERROR WAS  DETECTED  BY
C              CALLING   PROGRAM   (RATHER   THAN  BY  THIS
C              ROUTINE) IN  RESULTS  RETURNED  BY  PREVIOUS
C              CALL  TO  THIS  ROUTINE  AND  ANY ADDITIONAL
C              NUMBERS THROUGH  NEXT  APPEARANCE  OF  COMMA
C              (UNLESS   KONECT   IS  GREATER  THAN  1)  OR
C              SEMICOLON OR AMPERSAND OR UNKNOWN  CHARACTER
C              OR  END  OF  LINE  ARE  TO BE IGNORED.  NEXT
C              NUMBER  TO  RIGHT  OF  COMMA  OR   ON   LINE
C              FOLLOWING  AMPERSAND OR END OF LINE IS TO BE
C              INTERPRETED AS INDEX OF NEXT PAIR.   UNKNOWN
C              CHARACTER   OR   SEMICOLON  IS  REPORTED  TO
C              CALLING PROGRAM IF IT IS FOUND INSTEAD.
C            = INPUT CONTAINING 0, THIS ROUTINE HAS NOT YET
C              BEEN  CALLED  DURING  EXECUTION  OF  CURRENT
C              LOGICAL SECTION OF  CALLING  PROGRAM.   THIS
C              ROUTINE  IS  TO BEGIN EVALUATION OF CONTENTS
C              OF   INPUT   TEXT   BUFFER,   NOT   CONTINUE
C              GENERATION  OF  RANGES EVALUATED BY PREVIOUS
C              CALLS TO THIS ROUTINE.  LOWBFR SHOULD  POINT
C              TO  FIRST  CHARACTER  IN  IBUFFR ARRAY TO BE
C              INTERPRETED.
C            = INPUT  GREATER  THAN  ZERO,  VALUE  OF  KIND
C              INDICATES  CONDITION  RETURNED  BY  PREVIOUS
C              CALL TO THIS ROUTINE AND IN MOST  CASES  HAS
C              NOT  BEEN MODIFIED BY CALLING PROGRAM.  KIND
C              BEING RETURNED WITH ONE OF VALUES 7,  8,  9,
C              10  (IF  KONECT  IS  2  OR  4),  13  AND  14
C              INDICATES  THAT  PAIR  OF  VALUES  IS  BEING
C              RETURNED, ALTHOUGH EITHER OR BOTH MEMBERS OF
C              PAIR COULD BE MISSING.  OTHER VALUES OF KIND
C              INDICATE  SPECIAL  CONDITIONS FOR WHICH PAIR
C              OF NUMBERS IS NOT RETURNED.
C            = 1, NOTHING, EXCEPT PERHAPS LEADING COMMAS OR
C              ELSE    COMMENT    INDICATED    BY   LEADING
C              EXCLAMATION POINT, WAS FOUND AT OR TO  RIGHT
C              OF  IBUFFR(LOWBFR).   CALLING PROGRAM SHOULD
C              READ NEW LINE OF TEXT INTO IBUFFR.
C            = 2, SEMICOLON WAS  FOUND  AS  FIRST  PRINTING
C              CHARACTER  AT OR TO RIGHT OF IBUFFR(LOWBFR).
C              IF RANGE OF INDEXES HAS NOT  BEEN  EXHAUSTED
C              WHEN  SEMICOLON  IS  FOUND,  THEN  REMAINING
C              MEMBERS OF RANGE  ARE  REPORTED  TO  CALLING
C              PROGRAM BEFORE SEMICOLON IS REPORTED.  IT IS
C              ASSUMED  THAT  CALLING  PROGRAM  WILL  TREAT
C              SEMICOLON AS MARKING END OF LOGICAL GROUP OF
C              PAIR SPECIFICATIONS IF KONECT IS NOT GREATER
C              THAN  1, OR END OF SINGLE PAIR SPECIFICATION
C              IF KONECT IS GREATER THAN 1.
C            = 3, AMPERSAND WAS FOUND WHILE  SEARCHING  FOR
C              NEXT  RANGE  OF INDEXES.  LOWBFR IS RETURNED
C              POINTING  BEYOND  END  OF  BUFFER.   CALLING
C              PROGRAM  SHOULD  READ  NEW LINE OF TEXT INTO
C              INPUT  BUFFER  BEFORE  AGAIN  CALLING   THIS
C              ROUTINE.  THIS VALUE OF KIND IS NOT RETURNED
C              IF AMPERSAND IS FOUND  WHILE  SEARCHING  FOR
C              RANGE OF ASSOCIATED VALUES.
C            = 4, RANGE OF INDEXES WAS NOT  EXHAUSTED,  BUT
C              AMPERSAND  WAS  FOUND  INSTEAD  OF  RANGE OF
C              ASSOCIATED VALUES.  CALLING  PROGRAM  SHOULD
C              READ  NEW  LINE  OF  TEXT INTO BUFFER BEFORE
C              AGAIN CALLING THIS ROUTINE.  SUBSEQUENT CALL
C              TO  THIS ROUTINE WILL CONTINUE EVALUATION OF
C              ASSOCIATED RANGES IN NEW CONTENTS OF BUFFER.
C              IF  SEMICOLON  (OR  COMMA  IF  KONECT IS NOT
C              GREATER THAN 1) IS FOUND  AT  START  OF  NEW
C              CONTENTS  OF  BUFFER,  THEN  REMAINING INDEX
C              VALUES WILL BE RETURNED TO  CALLING  PROGRAM
C              BUT  CALLING  PROGRAM  WILL BE INFORMED THAT
C              ASSOCIATED   VALUES   ARE    MISSING.     IF
C              SUBSEQUENT  CALL  TO THIS ROUTINE IS INSTEAD
C              TO BEGIN EVALUATION OF NEW  SET  OF  LEADING
C              INDEXES  AND ASSOCIATED VALUES, THEN CALLING
C              PROGRAM SHOULD SET KIND  TO  6  TO  SIMULATE
C              LACK OF AMPERSAND, CAUSING REMAINING INDEXES
C              TO  BE  GENERATED,  BUT  MARKED  AS   HAVING
C              MISSING  ASSOCIATED  VALUES.   IF  REMAINING
C              INDEXES ARE NOT WANTED, THEN KIND SHOULD  BE
C              SET TO ONE.
C            = 5,  RANGE  OF  INDEXES  WAS  EXHAUSTED,  BUT
C              AMPERSAND  WAS  FOUND  INSTEAD  OF  RANGE OF
C              ASSOCIATED VALUES.  CALLING  PROGRAM  SHOULD
C              READ  NEW  LINE  OF  TEXT INTO BUFFER BEFORE
C              AGAIN CALLING THIS ROUTINE.  SUBSEQUENT CALL
C              TO  THIS ROUTINE WILL CONTINUE EVALUATION OF
C              ASSOCIATED RANGES IN NEW CONTENTS OF BUFFER.
C              SINCE  RANGE  OF INDEXES HAS BEEN EXHAUSTED,
C              NO  ADDITIONAL  MISSING   VALUES   WILL   BE
C              REPORTED IF SEMICOLON (OR COMMA IF KONECT IS
C              NOT GREATER THAN 1) IS FOUND AT START OF NEW
C              CONTENTS  OF  BUFFER.  IF SUBSEQUENT CALL TO
C              THIS ROUTINE IS ALWAYS TO  BEGIN  EVALUATION
C              OF NEW SET OF LEADING INDEXES AND ASSOCIATED
C              VALUES, THEN CALLING PROGRAM SHOULD SET KIND
C              TO ONE.
C            = 6, END  OF  LINE  WAS  FOUND  BUT  RANGE  OF
C              INDEXES  WAS NOT EXHAUSTED.  IF KIND IS SENT
C              UNCHANGED  TO  SUBSEQUENT   CALL   OF   THIS
C              ROUTINE,  THEN  REMAINING  INDEXES  WILL  BE
C              RETURNED TO  CALLING  PROGRAM,  BUT  CALLING
C              PROGRAM  WILL  BE  INFORMED  THAT ASSOCIATED
C              VALUES ARE MISSING.  IF SUBSEQUENT  CALL  TO
C              THIS   ROUTINE   IS   INSTEAD   TO  CONTINUE
C              EVALUATION  OF  ASSOCIATED  RANGES  IN   NEW
C              CONTENTS  OF  BUFFER READ BY CALLING PROGRAM
C              BEFORE THIS ROUTINE IS  AGAIN  CALLED,  THEN
C              KIND   SHOULD   BE  SET  TO  4  TO  SIMULATE
C              APPEARANCE OF AMPERSAND AT END OF  PRECEDING
C              LINE.   IF REMAINING INDEXES ARE NOT WANTED,
C              THEN KIND SHOULD BE SET TO ONE.
C            = 7, BOTH INDEX AND ASSOCIATED VALUE ARE BEING
C              RETURNED TO CALLING PROGRAM.
C            = 8,  INDEX  IS  BEING  RETURNED  TO   CALLING
C              PROGRAM,  BUT  ASSOCIATED  VALUE IS MISSING.
C              NEWEND AND ENDNEW ARE RETURNED UNDEFINED.
C            = 9, ASSOCIATED VALUE  IS  BEING  RETURNED  TO
C              CALLING  PROGRAM,  BUT  RANGE OF INDEXES HAS
C              BEEN EXHAUSTED.  NEWBGN OR BGNNEW, WHICHEVER
C              IS  APPROPRIATE,  IS RETURNED UNCHANGED (BUT
C              CAN  BE  MODIFIED  AS  DESIRED  BY   CALLING
C              PROGRAM).
C            = 10, RANGES OF BOTH  INDEXES  AND  ASSOCIATED
C              VALUES  HAVE  BEEN EXHAUSTED.  THIS VALUE IS
C              NEVER RETURNED IF KONECT=-1 OR 1.
C
C              IF KONECT HAS EITHER OF VALUES 2 OR 4,  THEN
C              RANGES OF BOTH INDEXES AND ASSOCIATED VALUES
C              HAVE BEEN EXHAUSTED,  BUT  EXTRA  COMMA  WAS
C              FOUND  INDICATING  MISSING ASSOCIATED VALUE.
C              NEWBGN OR BGNNEW, WHICHEVER IS  APPROPRIATE,
C              IS  RETURNED  UNCHANGED (BUT CAN BE MODIFIED
C              AS DESIRED BY CALLING PROGRAM).
C
C              IF KONECT=0, THEN RANGES OF BOTH INDEXES AND
C              ASSOCIATED  VALUES  HAVE BEEN EXHAUSTED, BUT
C              FOLLOWING NUMBER WAS  FOUND  WHICH  WAS  NOT
C              PRECEDED BY COMMA.  KIND SHOULD BE SET TO -1
C              BY CALLING PROGRAM BEFORE  THIS  ROUTINE  IS
C              CALLED  NEXT  IF  LACK  OF  COMMA  INDICATES
C              SERIOUS ENOUGH ERROR THAT ALL NUMBERS SHOULD
C              BE  IGNORED  UNTIL  NEXT COMMA IS FOUND.  IF
C              KONECT=3, THEN RANGES OF  BOTH  INDEXES  AND
C              ASSOCIATED  VALUES  HAVE BEEN EXHAUSTED, BUT
C              FOLLOWING NUMBER WAS  FOUND  WHICH  WAS  NOT
C              PRECEDED  BY SEMICOLON, BUT WHICH MAY OR MAY
C              NOT  HAVE  BEEN  PRECEDED  BY  ONE  OR  MORE
C              COMMAS.  KIND SHOULD BE SET TO -1 BY CALLING
C              PROGRAM BEFORE THIS ROUTINE IS  CALLED  NEXT
C              IF   LACK  OF  SEMICOLON  INDICATES  SERIOUS
C              ENOUGH ERROR  THAT  ALL  NUMBERS  SHOULD  BE
C              IGNORED  UNTIL  NEXT SEMICOLON IS FOUND.  IF
C              KONECT IS 0 OR 3, THEN  LOWBFR  IS  RETURNED
C              POINTING   TO   FIRST  CHARACTER  OF  NUMBER
C              SPECIFICATION, AND NUMBER WILL BE  EVALUATED
C              AS  INDEX  IF  THIS  ROUTINE IS CALLED AGAIN
C              WITHOUT KIND HAVING BEEN CHANGED.
C            = 11, UNKNOWN CHARACTER WAS FOUND.   IF  RANGE
C              OF  INDEXES  HAS  NOT  BEEN  EXHAUSTED  WHEN
C              UNKNOWN CHARACTER IS FOUND,  THEN  REMAINING
C              MEMBERS  OF  RANGE  ARE  REPORTED TO CALLING
C              PROGRAM   BEFORE   UNKNOWN   CHARACTER    IS
C              REPORTED.   LOWBFR  IS  RETURNED POINTING TO
C              NEXT   CHARACTER   TO   RIGHT   OF   UNKNOWN
C              CHARACTER.    IF   THIS  ROUTINE  IS  CALLED
C              WITHOUT CHANGING VALUE OF KIND, THEN  NUMBER
C              TO   RIGHT  OF  UNKNOWN  CHARACTER  WILL  BE
C              INTERPRETED AS INDEX OF NEXT PAIR.
C            = 12,   ERROR   WAS   FOUND    WITHIN    RANGE
C              SPECIFICATION.    FINDING   OF   SUCH  ERROR
C              TERMINATES GENERATION OF RANGE  OF  INDEXES.
C              IWHERE  IS RETURNED POINTING TO CHARACTER AT
C              START  OF  SPECIFICATION  CONTAINING  ERROR.
C              LOWBFR  IS RETURNED POINTING TO CHARACTER TO
C              RIGHT OF SPECIFICATION CONTAINING ERROR.  IF
C              THIS  ROUTINE  IS  CALLED  WITHOUT  CHANGING
C              VALUE OF  KIND,  THEN  NUMBER  TO  RIGHT  OF
C              UNKNOWN  CHARACTER  WILL  BE  INTERPRETED AS
C              INDEX OF NEXT PAIR.
C            = 13, INDEX  AND  ASSOCIATED  VALUE  ZERO  ARE
C              BEING RETURNED TO CALLING PROGRAM.  ZERO WAS
C              INDICATED BY LACK  OF  NUMBER  TO  RIGHT  OF
C              ASTERISK.    MISSING   NUMBER  TO  RIGHT  OF
C              ASTERISK  IN  SPECIFICATION  OF   RANGE   OF
C              INDEXES IS NOT ALLOWED AND WOULD RETURN KIND
C              CONTAINING VALUE 12.
C            = 14, SAME AS KIND=13  EXCEPT  THAT  RANGE  OF
C              INDEXES  WAS  EXHAUSTED.   NEWBGN OR BGNNEW,
C              WHICHEVER  IS   APPROPRIATE,   IS   RETURNED
C              UNCHANGED (BUT CAN BE MODIFIED AS DESIRED BY
C              CALLING PROGRAM).
C
C     NEWBGN = RETURNED CONTAINING NEXT  VALUE  OF  INTEGER
C              INDEX  IF KIND IS RETURNED CONTAINING ONE OF
C              VALUES 7, 8 OR 13 AND IF KNDBGN IS LESS THAN
C              OR  EQUAL  TO  ZERO.   NEWBGN  SHOULD NOT BE
C              CHANGED BY CALLING PROGRAM  UNLESS  KIND  IS
C              RETURNED  CONTAINING  ONE OF VALUES 9, 10 OR
C              14 INDICATING THAT RANGE OF INDEXES HAS BEEN
C              EXHAUSTED.
C
C     NEWEND = RETURNED CONTAINING NEXT ASSOCIATED  INTEGER
C              VALUE IF KIND IS RETURNED WITH ONE OF VALUES
C              7, 9, 13 OR 14 AND IF KNDEND IS LESS THAN OR
C              EQUAL  TO  ZERO.   NEWEND  CAN  BE  RETURNED
C              CHANGED BY THIS ROUTINE EVEN  IF  ASSOCIATED
C              VALUE  IS  NOT  FOUND  BUT  THEN MUST NOT BE
C              CHANGED BY CALLING  PROGRAM.   IF  RANGE  OF
C              ASSOCIATED  VALUES HAS BEEN EXHAUSTED, OR IF
C              ASSOCIATED VALUE IS INDICATED BY EXTRA COMMA
C              TO  BE MISSING, THEN NEWEND DOES NOT CONTAIN
C              ASSOCIATED   INTEGER   VALUE   BUT   INSTEAD
C              INDICATES TO SUBSEQUENT CALL TO THIS ROUTINE
C              REASON WHY VALUE COULD NOT BE RETURNED.
C
C     BGNNEW = RETURNED CONTAINING NEXT VALUE OF REAL INDEX
C              IF KIND IS RETURNED CONTAINING ONE OF VALUES
C              7, 8 OR 13 AND IF  KNDBGN  IS  GREATER  THAN
C              ZERO.   BGNNEW  SHOULD  NOT  BE  CHANGED  BY
C              CALLING  PROGRAM  UNLESS  KIND  IS  RETURNED
C              CONTAINING   ONE  OF  VALUES  9,  10  OR  14
C              INDICATING THAT RANGE OF  INDEXES  HAS  BEEN
C              EXHAUSTED.
C
C     ENDNEW = RETURNED  CONTAINING  NEXT  ASSOCIATED  REAL
C              VALUE IF KIND IS RETURNED WITH ONE OF VALUES
C              7, 9, 13 OR 14 AND IF KNDEND IS GREATER THAN
C              ZERO.   ENDNEW  SHOULD  NOT  BE  CHANGED  BY
C              CALLING PROGRAM.
C
C     FOLLOWING ARGUMENT IS USED FOR OUTPUT ONLY.
C
C     IWHERE = RETURNED POINTING TO LEFT CHARACTER OF RANGE
C              NOTATION  WHICH  WAS  FOUND TO CONTAIN ERROR
C              SUCH  AS  TOO  MANY  ASTERISKS,   TOO   MANY
C              SLASHES,  TOO  MANY  COLONS,  OR  ABSENCE OF
C              NUMBER TO RIGHT OF ASTERISK IN SPECIFICATION
C              OF RANGE OF LEADING INDEXES.
C
C     REMAINING  DAPAIR  ARGUMENTS  ARE  USED  ONLY  DURING
C     GENERATION OF VALUES WITHIN RANGES AND SHOULD BE SENT
C     TO SUBSEQUENT DAPAIR CALL UNCHANGED.  THESE ARGUMENTS
C     SHOULD  BE  STATED  BY  NAME  IN  CALL STATEMENTS AND
C     SHOULD BE IGNORED BY CALLING PROGRAM  EXCEPT  INSOFAR
C     AS   IS   NECESSARY   TO  TRANSMIT  THEIR  VALUES  TO
C     SUBSEQUENT CALL TO THIS ROUTINE.
C
      DIMENSION IBUFFR(MAXBFR)
      DATA KOMENT,IEND,IAND,KOMMA,IBLANK,ITAB/
     11H!,1H;,1H&,1H,,1H ,1H	/
C
C     TEST IF ARE CONTINUING PREVIOUSLY EVALUATED SERIES
      MISSIN=0
      IKNCT=KONECT
      IF(IKNCT.GT.1)IKNCT=IKNCT-3
      MANY=0
      IPLACE=0
      IF(KIND.LE.0)GO TO 31
      IF(KIND.GT.14)GO TO 31
      GO TO(31,31,31,13,11,43, 1, 1, 9, 5,31,31, 1, 6),KIND
C
C     GET NEXT INDEX
    1 ITYPE=5
      LIMIT=LOWBFR-1
      IF(KNDBGN.LE.0)INIBGN=NEWBGN
      IF(KNDBGN.GT.0)BGNINI=BGNNEW
      GO TO 32
    2 IF(ITYPE.NE.5)GO TO 4
      IF(KIND.EQ.7)GO TO 9
      IF(KIND.EQ.8)GO TO 3
      KIND=7
      GO TO 7
    3 IF(NEWEND.LE.0)GO TO 50
      GO TO 14
C
C     SERIES OF INDEXES EXHAUSTED
    4 IF(KNDBGN.LE.0)NEWBGN=INIBGN
      IF(KNDBGN.GT.0)BGNNEW=BGNINI
      IF(KIND.EQ.7)GO TO 8
      IF(KIND.NE.8)GO TO 6
      IF(NEWEND.LE.0)GO TO 31
      IF(IKNCT.NE.0)GO TO 12
      KIND=9
      GO TO 31
C
C     GET NEXT ASSOCIATED VALUE
    5 IF(IKNCT.EQ.0)GO TO 31
    6 KIND=9
    7 ITYPE=6
      GO TO 10
    8 KIND=9
    9 ITYPE=5
   10 LIMIT=LOWBFR-1
      GO TO 18
C
C     LOOK FOR NEXT ASSOCIATED RANGE OF VALUES
   11 MISSIN=NEWEND
   12 KIND=9
      GO TO 17
   13 MISSIN=NEWEND
   14 KIND=7
      GO TO 17
   15 IF(KONECT.LE.1)GO TO 28
      IF(MISSIN.GT.0)GO TO 42
      MISSIN=1
   16 LOWBFR=LOWBFR+1
   17 IF(LOWBFR.GT.MAXBFR)GO TO 25
      LETTER=IBUFFR(LOWBFR)
      IF(LETTER.EQ.IBLANK)GO TO 16
      IF(LETTER.EQ.ITAB)GO TO 16
      IF(LETTER.EQ.KOMMA)GO TO 15
      IF(LETTER.EQ.KOMENT)GO TO 24
      IF(LETTER.EQ.IEND)GO TO 23
      IF(LETTER.EQ.IAND)GO TO 21
C
C     EVALUATE NEXT ASSOCIATED RANGE OF VALUES
      ITYPE=0
      LIMIT=MAXBFR
      IWHERE=LOWBFR
   18 CALL DANEXT(KNDEND,SLACK ,IBUFFR,LIMIT,LOWBFR,
     1MANY,ITYPE,NEWEND,INCEND,LMTEND,ENDNEW,ENDINC,
     2ENDLMT)
      IF(ITYPE.EQ.9)GO TO 20
      IF(ITYPE.GT.6)GO TO 47
      IF(ITYPE.EQ.5)GO TO 50
      IF(ITYPE.NE.6)GO TO 19
      IF(KIND.EQ.7)GO TO 48
      GO TO 49
   19 IF(KIND.EQ.7)GO TO 17
      IF(IKNCT.NE.0)GO TO 17
      GO TO 31
   20 IF(KIND.EQ.9)GO TO 46
      LOWBFR=LOWBFR-1
      GO TO 43
C
C     AMPERSAND FOUND INSTEAD OF ADDITIONAL RANGE
   21 IF(KIND.EQ.7)GO TO 22
      IF(IKNCT.GT.0)GO TO 36
      GO TO 38
   22 IF(IKNCT.GT.0)GO TO 43
      GO TO 37
C
C     SEMICOLON FOUND INSTEAD OF ASSOCIATED VALUE
   23 IF(KIND.EQ.7)GO TO 43
      IF(MISSIN.GT.0)GO TO 45
      GO TO 35
C
C     NO ADDITIONAL ASSOCIATED RANGE FOUND
   24 LOWBFR=MAXBFR+1
   25 IF(KIND.EQ.7)GO TO 26
      IF(MISSIN.GT.0)GO TO 45
      GO TO 34
   26 IF(IKNCT.GT.0)GO TO 43
      GO TO 40
C
C     COMMA FOUND INSTEAD OF NEXT ASSOCIATED RANGE
   27 IF(KONECT.LE.1)GO TO 29
      GO TO 30
   28 IF(KIND.EQ.7)GO TO 43
   29 KIND=7
C
C     FIND NEXT PAIR OF SERIES
   30 LOWBFR=LOWBFR+1
   31 IF(LOWBFR.GT.MAXBFR)GO TO 34
      LETTER=IBUFFR(LOWBFR)
      IF(LETTER.EQ.IBLANK)GO TO 30
      IF(LETTER.EQ.ITAB)GO TO 30
      IF(LETTER.EQ.KOMMA)GO TO 27
      IF(LETTER.EQ.KOMENT)GO TO 33
      IF(LETTER.EQ.IEND)GO TO 35
      IF(LETTER.EQ.IAND)GO TO 36
C
C     OBTAIN FIRST LEADING RANGE
      ITYPE=0
      LIMIT=MAXBFR
      IPLACE=1
      IWHERE=LOWBFR
   32 CALL DANEXT(KNDBGN,SLACK,IBUFFR,LIMIT,LOWBFR,
     1MANY,ITYPE,NEWBGN,INCBGN,LMTBGN,BGNNEW,BGNINC,
     2BGNLMT)
      IF(IPLACE.EQ.0)GO TO 2
      IF(ITYPE.EQ.9)GO TO 46
      IF(KIND.LT.0)GO TO 31
      IF(ITYPE.NE.5)GO TO 47
      IF(KIND.NE.9)GO TO 14
      LOWBFR=IWHERE
      GO TO 45
C
C     RETURN TO CALLING PROGRAM
   33 LOWBFR=MAXBFR+1
   34 KIND=1
      GO TO 50
   35 KIND=2
      LOWBFR=LOWBFR+1
      GO TO 50
   36 KIND=3
      LOWBFR=MAXBFR+1
      GO TO 50
   37 KIND=4
      GO TO 39
   38 KIND=5
   39 LOWBFR=MAXBFR+1
      GO TO 41
   40 KIND=6
   41 NEWEND=MISSIN
      GO TO 50
   42 IF(KIND.EQ.9)GO TO 45
      NEWEND=1
      GO TO 44
   43 NEWEND=0
   44 KIND=8
      GO TO 50
   45 KIND=10
      GO TO 50
   46 KIND=11
      GO TO 50
   47 KIND=12
      GO TO 50
   48 KIND=13
      GO TO 50
   49 KIND=14
   50 RETURN
C863065281593!;&
      END

