C******************** START FILE NUMCLR.FOR ; GROUP URDUTS ******************
C------------------------------------------------------------
C&  NUMCLR  UREAD INTERNAL - TYPEAHEAD BUFFER POP
C
C  CLEAR ENTRY ENDING AT SPECIFIED INDEX FROM INPUT LINE BUFFER
C  IF ANYTHING IS LEFT SUPPRESS FUTURE OUTPUT TO ALLOW SILENT
C  INTERPRETATION OF STACKED INPUT
C
C  MOD DMC JAN 1988-- CONTENTS EXTRACTED FROM TYPEAHEAD BUFFER ARE
C  STASHED IN UWORD(1:LUWORD)
C
C  MOD DMC APR 1988-- COMMA DELIMITER ROTATED OUT *ONLY* IF IT
C  IMMEDIATELY FOLLOWS FIELD BEING CLEARED
C
C  I.E. "stuff,"  and "stuff ," NOW TREATED DIFFERENT; THE LEADING
C  BLANK BEFORE THE COMMA IS ASSUMED SIGNIFICANT AND THE COMMA
C  WILL BE SEEN AS THE NEXT FIELD...
C  ... by popular demand
C
C---------------------------
C
      SUBROUTINE NUMCLR(J)
C
      USE USERIO
C
C---------------------------
C
      IJ=MAX0(1,J)
C
      IDELIM=0
C  IS THIS A DELIMITER CHARACTER?
      CALL UDELIM(CBUFF(IJ:IJ),IDELIM)
C
      ICT=0
      ICTI=0
C
      DO 10 I=1,IJ
        ICT=ICT+1
        UWORD(ICT:ICT)=CBUFF(I:I)
        IF(CBUFF(I:I).NE.' ') ICTI=ICT
        CBUFF(I:I)=' '
 10   CONTINUE
C
C  ALSO CLEAR A FOLLOWING DELIMITER IF NECESSARY
      IF((IDELIM.EQ.1).OR.(IDELIM.EQ.2)) GO TO 30
      IF(IJ.GE.NCHARC) GO TO 30
C
      IJP1=IJ+1
C
      ICOMMA=0
      DO 20 I=IJP1,NCHARC
        CALL UDELIM(CBUFF(I:I),JDELIM)
        IF((JDELIM.LT.1).OR.(JDELIM.GT.2)) GO TO 30
        IF(JDELIM.EQ.2) THEN
          IF(I.GT.IJP1) GO TO 30 ! COMMA SIGNIFICANT AFTER LEADING " "
          ICOMMA=1
        ENDIF
        ICT=ICT+1
        UWORD(ICT:ICT)=CBUFF(I:I)
        IF(CBUFF(I:I).NE.' ') ICTI=ICT
        CBUFF(I:I)=' '
        IF(ICOMMA.EQ.1) GO TO 30
 20   CONTINUE
C
 30   CONTINUE
C
      ICT=MIN(LBUFF,(ICTI+1))
      IF(ICTI.LT.LBUFF) UWORD(ICT:ICT)=' '
      LUWORD=ICT
C
C  LEFT-JUSTIFY RESULT (WHICH MAY BE EMPTY)
      CALL UDECOD
C  IF ANYTHING IS LEFT SILENCE OUTPUT UNTIL INTERPRETED
      CALL URXOUT
C
      RETURN
C
      END
C******************** END FILE NUMCLR.FOR ; GROUP URDUTS ******************
