      FUNCTION NXTCHR
C
      IMPLICIT LOGICAL*1 (B)
      DOUBLE PRECISION SYMBOL
      COMMON/PARAMS/LUNIN,LUNOUT,LUNCMD,BTAB,BSPC,NLINE,NSTMT,
     1ICLASS,BCHR,BLST,JSYM(2),NSYMTP,IPARNS,NPAGE
      COMMON /INBUFR/INSIZ,INCNT,IOUTX,MCRSIZ,INFIL,IOUTFL,
     1BDPB(2),BUFR(80),BNAM(24),BTIME(8),BDATE(9),BX(1)
      COMMON NSYM,NELM,KLIM,SYMBOL(1000)
C***SEE IF SOMETHING IN I-O BUFR TO PRINT
1	IF(IOUTX.EQ.0)GOTO 70
C***  CHECK FOR NON-EMPTY I-O BUFFER
      IF (IOUTX.LT.INCNT) GO TO 80  !IF NOT EMPTY-GO TO IT!
C***  READ ANOTHER
    5 CALL LINEIN
      IF(INCNT.EQ.0) GO TO 60  !WATCH FOR END-OF-FILE
C *** CHECK FOR COMMENT LINE
8     IF (BUFR(1).EQ. 67) GOTO 10
      IF (BUFR(1).NE. 68) GOTO 14
10    WRITE(LUNOUT,500)NLINE,(BUFR(I),I=1,INCNT)
      CALL FRMCTL(1)
      GOTO 5
C***  CK FOR CONTINUATION
14	DO 15 IOUTX=1,5
	IF(ITSTCH(BUFR(IOUTX))-3)60,15,17
15	CONTINUE
      IF(BUFR(6) .EQ.48) GO TO 60  !NO CONTINUATION
      IF(BUFR(6) .EQ.32) GO TO 60  !LIKEWISE
      GO TO 30  	!FOUND CONTINUATION
C***  FOUND A TAB
   17 IOUTX=IOUTX+1
      IF(ITSTCH(BUFR(IOUTX)).NE.2) GO TO 60
C***  CONTINUATION LINE FOUND
   30 WRITE (LUNOUT,500) NLINE, (BUFR(I),I=1,INCNT)
  500 FORMAT(1X,I4,6X,80A1)
      CALL FRMCTL(1)
      GO TO 1
C***  NO CONTINUATION
   60 IOUTX=0
      NXTCHR=0
      GO TO 99
70	NSTMT=NSTMT+1
	WRITE(LUNOUT,510)NLINE,NSTMT,(BUFR(I),I=1,INCNT)
510	FORMAT(1X,I4,1X,I4,1X,80A1)
	CALL FRMCTL(1)
   80 BLST=BUFR(IOUTX)  !SAVE LAST CHAR SEEN
      IOUTX=IOUTX+1  !INC OUTPUT INDEX
      NXTCHR=BUFR(IOUTX)  !GET THE NEXT CHAR
   99 RETURN
      END
