      SUBROUTINE MAIN
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      CALL QUERY(53Husage:  fb [-axc] [-ln] [-spat] [-spat] pat [pat] ..
     *.)
      CALL FBARGS
      CALL DOBK (1)
      IF (.NOT.(COUNT .EQ. 1))GOTO 23000
      CALL PUTINT(MCOUNT, 1,2)
      CALL PUTCH(10,2)
23000 CONTINUE
      RETURN
      END
      SUBROUTINE BMATCH (LINE)
      LOGICAL*1 LINE(100)
      INTEGER MATCH
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      I=1
23002 IF (.NOT.(I.LE.ELEVEL))GOTO 23004
      IF (.NOT.(MATCH(LINE, PAT(1,I)) .EQ. 1))GOTO 23005
      LOCATD(I) = 1
23005 CONTINUE
23003 I=I+1
      GOTO 23002
23004 CONTINUE
      RETURN
      END
      SUBROUTINE CHECKL (LINE)
      LOGICAL*1 LINE(100)
      INTEGER MATCH
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      ATBEG = MATCH(LINE, SEPS(1,1))
      IF (.NOT.(NBRSEP .EQ. 1))GOTO 23007
      ATEND = ATBEG
      GOTO 23008
23007 CONTINUE
      ATEND = MATCH(LINE, SEPS(1,2))
23008 CONTINUE
      RETURN
      END
      SUBROUTINE DOBEG (LINE)
      LOGICAL*1 LINE(100)
      INTEGER STACKL
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      CALL INITBK
      LCOUNT = 0
      IF (.NOT.(NBRSEP .GT. 1 .OR. SEPLOC .EQ. 1))GOTO 23009
      CALL BMATCH(LINE)
      IF (.NOT.(STACKL(LINE) .EQ. -3))GOTO 23011
      CALL ERROR (21HBlock buffer overflow)
23011 CONTINUE
23009 CONTINUE
      SKPING = 0
      PRTING = 0
      RETURN
      END
      SUBROUTINE DOBK (FD)
      INTEGER GETLIN
      INTEGER FD, PRT, FIRST
      LOGICAL*1 LINE(512)
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      COMMON /FBBUF/ FBBUF(5000), ENDSTK, FNAME(40), FB
      LOGICAL*1 FBBUF
      INTEGER ENDSTK
      LOGICAL*1 FNAME
      INTEGER FB
      CALL INITBK
      FIRST = 1
23013 IF (.NOT.(GETLIN(LINE, FD) .NE. -1))GOTO 23014
      CALL CHECKL (LINE)
      IF (.NOT.(FIRST .EQ. 1 .AND. ATEND .EQ. 1 .AND. NBRSEP .EQ. 1))GOT
     *O 23015
      SEPLOC = 1
23015 CONTINUE
      FIRST = 0
      IF (.NOT.(ATEND .EQ. 1))GOTO 23017
      CALL DOEND(LINE)
23017 CONTINUE
      IF (.NOT.(ATBEG .EQ. 1))GOTO 23019
      CALL DOBEG(LINE)
      GOTO 23013
23019 CONTINUE
      IF (.NOT.(SKPING .EQ. 1))GOTO 23021
      GOTO 23013
23021 CONTINUE
      CALL DOLIN (LINE)
23022 CONTINUE
      GOTO 23013
23014 CONTINUE
      IF (.NOT.(SKPING .EQ. 0))GOTO 23023
      CALL DOEND(LINE)
23023 CONTINUE
      IF (.NOT.(FB .NE. -3))GOTO 23025
      CALL CLOSE(FB)
      CALL REMOVE(FNAME)
      FB = -3
23025 CONTINUE
      RETURN
      END
      SUBROUTINE DOEND (LINE)
      LOGICAL*1 LINE(100)
      INTEGER STACKL
      INTEGER PRT
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      IF (.NOT.(PRTING .EQ. 1))GOTO 23027
      IF (.NOT.( (NBRSEP .GT. 1 .OR. SEPLOC .EQ. 0) .AND. COUNT .EQ. 0))
     *GOTO 23029
      CALL OUTLIN(LINE)
23029 CONTINUE
      IF (.NOT.(BKLTH .NE. 30000))GOTO 23031
      LCOUNT=LCOUNT+1
23033 IF (.NOT.(LCOUNT.LE.BKLTH))GOTO 23035
      CALL PUTCH(10, 2)
23034 LCOUNT=LCOUNT+1
      GOTO 23033
23035 CONTINUE
23031 CONTINUE
      GOTO 23028
23027 CONTINUE
      IF (.NOT.(SKPING .EQ. 0))GOTO 23036
      IF (.NOT.(NBRSEP .GT. 1 .OR. SEPLOC .EQ. 0))GOTO 23038
      CALL BMATCH (LINE)
      IF (.NOT.(STACKL(LINE) .EQ.-3))GOTO 23040
      CALL ERROR (21HBlock buffer overflow)
23040 CONTINUE
23038 CONTINUE
      CALL TALLY (PRT)
      IF (.NOT.(PRT .EQ. 1))GOTO 23042
      CALL PRINTB
      IF (.NOT.(BKLTH .NE. 30000))GOTO 23044
      LCOUNT=LCOUNT+1
23046 IF (.NOT.(LCOUNT.LE.BKLTH))GOTO 23048
      CALL PUTCH(10,2)
23047 LCOUNT=LCOUNT+1
      GOTO 23046
23048 CONTINUE
23044 CONTINUE
23042 CONTINUE
23036 CONTINUE
23028 CONTINUE
      SKPING = 1
      PRTING = 0
      RETURN
      END
      SUBROUTINE DOLIN (LINE)
      LOGICAL*1 LINE(100)
      INTEGER PRT
      INTEGER STACKL
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      IF (.NOT.(SKPING .EQ. 1))GOTO 23049
      RETURN
23049 CONTINUE
      IF (.NOT.(PRTING .EQ. 1))GOTO 23051
      IF (.NOT.(COUNT .EQ. 0))GOTO 23053
      CALL OUTLIN(LINE)
23053 CONTINUE
      GOTO 23052
23051 CONTINUE
      CALL BMATCH (LINE)
      IF (.NOT.(STACKL(LINE) .EQ. -3))GOTO 23055
      CALL ERROR (21HBlock buffer overflow)
23055 CONTINUE
      CALL TALLY(PRT)
      IF (.NOT.(PRT .EQ. 1 .AND. EXCEPT .EQ. 0))GOTO 23057
      CALL PRINTB
      PRTING = 1
      GOTO 23058
23057 CONTINUE
      IF (.NOT.(PRT .EQ. 0 .AND. EXCEPT .EQ. 1))GOTO 23059
      SKPING = 1
23059 CONTINUE
23058 CONTINUE
23052 CONTINUE
      RETURN
      END
      SUBROUTINE FBARGS
      LOGICAL*1 ARG(512)
      INTEGER GETARG, ITOC, GETPAT, STATUS, INDEX, CTOI
      INTEGER I, J
      COMMON /FBBUF/ FBBUF(5000), ENDSTK, FNAME(40), FB
      LOGICAL*1 FBBUF
      INTEGER ENDSTK
      LOGICAL*1 FNAME
      INTEGER FB
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      LOGICAL*1 ILPAT(18)
      LOGICAL*1 MAXEXP(30)
      LOGICAL*1 DSEP(5)
      DATA ILPAT(1)/105/,ILPAT(2)/108/,ILPAT(3)/108/,ILPAT(4)/101/,ILPAT
     *(5)/103/,ILPAT(6)/97/,ILPAT(7)/108/,ILPAT(8)/32/,ILPAT(9)/112/,ILP
     *AT(10)/97/,ILPAT(11)/116/,ILPAT(12)/116/,ILPAT(13)/101/,ILPAT(14)/
     *114/,ILPAT(15)/110/,ILPAT(16)/58/,ILPAT(17)/32/,ILPAT(18)/0/
      DATA MAXEXP(1)/109/,MAXEXP(2)/97/,MAXEXP(3)/120/,MAXEXP(4)/32/,MAX
     *EXP(5)/110/,MAXEXP(6)/98/,MAXEXP(7)/114/,MAXEXP(8)/32/,MAXEXP(9)/1
     *01/,MAXEXP(10)/120/,MAXEXP(11)/112/,MAXEXP(12)/114/,MAXEXP(13)/101
     */,MAXEXP(14)/115/,MAXEXP(15)/115/,MAXEXP(16)/105/,MAXEXP(17)/111/,
     *MAXEXP(18)/110/,MAXEXP(19)/115/,MAXEXP(20)/32/,MAXEXP(21)/97/,MAXE
     *XP(22)/108/,MAXEXP(23)/108/,MAXEXP(24)/111/,MAXEXP(25)/119/,MAXEXP
     *(26)/101/,MAXEXP(27)/100/,MAXEXP(28)/58/,MAXEXP(29)/32/,MAXEXP(30)
     */0/
      DATA DSEP(1)/37/,DSEP(2)/32/,DSEP(3)/42/,DSEP(4)/36/,DSEP(5)/0/
      DATA EXCEPT/0/
      DATA ANDPAT/0/
      DATA COUNT /0/
      DATA MCOUNT /0/
      DATA ELEVEL/0/
      DATA SKPING /0/
      DATA NBRSEP /0/
      DATA SEPLOC /0/
      DATA ENDSTK /0/
      DATA FB /-3/
      DATA BKLTH /30000/
      DATA LCOUNT /0/
      I=1
23061 IF (.NOT.(GETARG(I, ARG, 128) .NE. -1))GOTO 23063
      IF (.NOT.(ARG(1) .EQ. 45 .AND. (ARG(2) .EQ. 115 .OR. ARG(2) .EQ. 8
     *3)))GOTO 23064
      NBRSEP = NBRSEP + 1
      IF (.NOT.(NBRSEP .GT. 2))GOTO 23066
      CALL ERROR (40Honly start and ending separators allowed)
23066 CONTINUE
      IF (.NOT.(GETPAT(ARG(3), SEPS(1, NBRSEP)) .EQ. -3))GOTO 23068
      CALL PUTLIN(ILPAT, 3)
      CALL ERROR (ARG(3))
23068 CONTINUE
      GOTO 23065
23064 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45))GOTO 23070
      CALL FOLD(ARG)
      IF (.NOT.(INDEX(ARG, 97) .GT. 0))GOTO 23072
      ANDPAT = 1
23072 CONTINUE
      IF (.NOT.(INDEX(ARG, 99) .GT. 0))GOTO 23074
      COUNT = 1
23074 CONTINUE
      IF (.NOT.(INDEX(ARG, 120) .GT. 0))GOTO 23076
      EXCEPT = 1
23076 CONTINUE
      J = INDEX(ARG, 108)
      IF (.NOT.(J .GT. 0))GOTO 23078
      J = J + 1
      BKLTH = CTOI(ARG, J)
      IF (.NOT.(BKLTH .LE. 0))GOTO 23080
      CALL ERROR(53Husage:  fb [-axc] [-ln] [-spat] [-spat] pat [pat] ..
     *.)
23080 CONTINUE
23078 CONTINUE
      GOTO 23071
23070 CONTINUE
      IF (.NOT.(ELEVEL .LT. 10))GOTO 23082
      ELEVEL = ELEVEL + 1
      IF (.NOT.(GETPAT(ARG(1), PAT(1,ELEVEL)) .EQ. -3))GOTO 23084
      CALL PUTLIN(ILPAT, 3)
      CALL ERROR (ARG)
23084 CONTINUE
      GOTO 23083
23082 CONTINUE
      CALL PUTLIN(MAXEXP, 3)
      STATUS = ITOC(10, ARG, 128)
      CALL ERROR(ARG)
23083 CONTINUE
23071 CONTINUE
23065 CONTINUE
23062 I=I+1
      GOTO 23061
23063 CONTINUE
      IF (.NOT.(ELEVEL .EQ. 0))GOTO 23086
      CALL ERROR(53Husage:  fb [-axc] [-ln] [-spat] [-spat] pat [pat] ..
     *.)
23086 CONTINUE
      IF (.NOT.(NBRSEP .EQ. 0))GOTO 23088
      IF (.NOT.(GETPAT(DSEP, SEPS(1,1)) .EQ. -3))GOTO 23090
      CALL ERROR (25Hillegal default separator)
23090 CONTINUE
      NBRSEP = 1
23088 CONTINUE
      IF (.NOT.(NBRSEP .GT. 1))GOTO 23092
      SKPING = 1
23092 CONTINUE
      RETURN
      END
      SUBROUTINE INITBK
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      COMMON /FBBUF/ FBBUF(5000), ENDSTK, FNAME(40), FB
      LOGICAL*1 FBBUF
      INTEGER ENDSTK
      LOGICAL*1 FNAME
      INTEGER FB
      I=1
23094 IF (.NOT.(I.LE.ELEVEL))GOTO 23096
      LOCATD(I) = 0
23095 I=I+1
      GOTO 23094
23096 CONTINUE
      ENDSTK = 0
      IF (.NOT.(FB .NE. -3))GOTO 23097
      CALL CLOSE(FB)
      CALL REMOVE(FNAME)
      FB = -3
23097 CONTINUE
      RETURN
      END
      SUBROUTINE OUTLIN(LINE)
      LOGICAL*1 LINE(100)
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      LCOUNT = LCOUNT + 1
      IF (.NOT.(LCOUNT .LE. BKLTH))GOTO 23099
      CALL PUTLIN(LINE, 2)
23099 CONTINUE
      RETURN
      END
      SUBROUTINE PRINTB
      INTEGER I
      LOGICAL*1 C
      LOGICAL*1 GETCH
      INTEGER OPEN
      COMMON /FBBUF/ FBBUF(5000), ENDSTK, FNAME(40), FB
      LOGICAL*1 FBBUF
      INTEGER ENDSTK
      LOGICAL*1 FNAME
      INTEGER FB
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      IF (.NOT.(ENDSTK .EQ. 0 .AND. FB .EQ. -3))GOTO 23101
      RETURN
23101 CONTINUE
      IF (.NOT.(COUNT .EQ. 1))GOTO 23103
      MCOUNT = MCOUNT + 1
      RETURN
23103 CONTINUE
      IF (.NOT.(FB .NE. -3))GOTO 23105
      CALL CLOSE(FB)
      FB = OPEN(FNAME, 1)
      IF (.NOT.(FB .EQ. -3))GOTO 23107
      CALL ERROR (31Hproblems reopening scratch file)
23107 CONTINUE
23109 IF (.NOT.(GETCH(C, FB) .NE. -1))GOTO 23110
      CALL PUTCH(C, 2)
      GOTO 23109
23110 CONTINUE
      CALL CLOSE(FB)
      CALL REMOVE (FNAME)
      FB = -3
23105 CONTINUE
      I=1
23111 IF (.NOT.(I.LE.ENDSTK))GOTO 23113
      CALL PUTCH(FBBUF(I), 2)
23112 I=I+1
      GOTO 23111
23113 CONTINUE
      RETURN
      END
      INTEGER FUNCTION STACKL (LINE)
      LOGICAL*1 LINE(512)
      INTEGER LENGTH, CREATE
      INTEGER LEN
      COMMON /FBBUF/ FBBUF(5000), ENDSTK, FNAME(40), FB
      LOGICAL*1 FBBUF
      INTEGER ENDSTK
      LOGICAL*1 FNAME
      INTEGER FB
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      LOGICAL*1 FBTEMP(4)
      DATA FBTEMP(1)/102/,FBTEMP(2)/98/,FBTEMP(3)/116/,FBTEMP(4)/0/
      STACKL = 0
      IF (.NOT.(COUNT .EQ. 1))GOTO 23114
      RETURN
23114 CONTINUE
      LCOUNT = LCOUNT + 1
      IF (.NOT.(LCOUNT .GT. BKLTH))GOTO 23116
      RETURN
23116 CONTINUE
      LEN = LENGTH(LINE)
      IF (.NOT.( (LEN+ENDSTK+1) .GT. 5000))GOTO 23118
      IF (.NOT.(FB .EQ. -3))GOTO 23120
      CALL SCRATF(FBTEMP, FNAME)
      FB = CREATE(FNAME, 2)
      IF (.NOT.(FB .EQ. -3))GOTO 23122
      CALL REMARK (29Hproblems opening scratch file)
      CALL CANT (FNAME)
23122 CONTINUE
23120 CONTINUE
      I=1
23124 IF (.NOT.(I.LE.ENDSTK))GOTO 23126
      CALL PUTCH(FBBUF(I), FB)
23125 I=I+1
      GOTO 23124
23126 CONTINUE
      CALL PUTLIN(LINE, FB)
      ENDSTK = 0
      RETURN
23118 CONTINUE
      CALL SCOPY(LINE, 1, FBBUF, ENDSTK+1)
      ENDSTK = ENDSTK + LEN
      RETURN
      END
      SUBROUTINE TALLY (PRT)
      INTEGER PRT
      COMMON /FBCOM/ ANDPAT, COUNT, EXCEPT, ELEVEL, PAT(128, 10), ATEND,
     * ATBEG, SEPS(128,2), NBRSEP, SKPING, PRTING, LOCATD(128), MCOUNT, 
     *SEPLOC, BKLTH, LCOUNT
      INTEGER ANDPAT
      INTEGER COUNT
      INTEGER EXCEPT
      INTEGER ELEVEL
      LOGICAL*1 PAT
      INTEGER ATEND
      INTEGER ATBEG
      LOGICAL*1 SEPS
      INTEGER NBRSEP
      INTEGER SEPLOC
      INTEGER MCOUNT
      INTEGER SKPING
      LOGICAL*1 LOCATD
      INTEGER BKLTH
      INTEGER LCOUNT
      PRT = ANDPAT
      I=1
23127 IF (.NOT.(I.LE.ELEVEL))GOTO 23129
      IF (.NOT.(ANDPAT .EQ. 0 .AND. LOCATD(I) .EQ. 1))GOTO 23130
      PRT = 1
      GOTO 23129
23130 CONTINUE
      IF (.NOT.(ANDPAT .EQ. 1 .AND. LOCATD(I) .EQ. 0))GOTO 23132
      PRT = 0
      GOTO 23129
23132 CONTINUE
23131 CONTINUE
23128 I=I+1
      GOTO 23127
23129 CONTINUE
      IF (.NOT.(EXCEPT .EQ. 1))GOTO 23134
      IF (.NOT.(PRT .EQ. 0))GOTO 23136
      PRT = 1
      GOTO 23137
23136 CONTINUE
      PRT = 0
23137 CONTINUE
23134 CONTINUE
      RETURN
      END
