      SUBROUTINE MAIN
      LOGICAL*1 BUF(512)
      INTEGER GETARG, OPEN, INDEXC
      INTEGER I, FILE(2), J
      COMMON /CCOMM/ ONE, TWO, THREE
      INTEGER ONE
      INTEGER TWO
      INTEGER THREE
      LOGICAL*1 USESTR(35)
      DATA USESTR(1)/117/,USESTR(2)/115/,USESTR(3)/97/,USESTR(4)/103/,US
     *ESTR(5)/101/,USESTR(6)/58/,USESTR(7)/32/,USESTR(8)/32/,USESTR(9)/9
     *9/,USESTR(10)/111/,USESTR(11)/109/,USESTR(12)/109/,USESTR(13)/32/,
     *USESTR(14)/91/,USESTR(15)/45/,USESTR(16)/49/,USESTR(17)/50/,USESTR
     *(18)/51/,USESTR(19)/93/,USESTR(20)/32/,USESTR(21)/102/,USESTR(22)/
     *105/,USESTR(23)/108/,USESTR(24)/101/,USESTR(25)/49/,USESTR(26)/32/
     *,USESTR(27)/91/,USESTR(28)/102/,USESTR(29)/105/,USESTR(30)/108/,US
     *ESTR(31)/101/,USESTR(32)/50/,USESTR(33)/93/,USESTR(34)/46/,USESTR(
     *35)/0/
      CALL QUERY(USESTR)
      ONE = 1
      TWO = 1
      THREE = 1
      J = 0
      I=1
23000 IF (.NOT.(GETARG(I,BUF,512).NE.-1))GOTO 23002
      IF (.NOT.(J .EQ. 2))GOTO 23003
      GOTO 23002
23003 CONTINUE
      IF (.NOT.(BUF(1) .EQ. 45 .AND. BUF(2) .NE. 0))GOTO 23005
      IF (.NOT.(INDEXC(BUF, 49) .EQ. 0))GOTO 23007
      ONE = 0
23007 CONTINUE
      IF (.NOT.(INDEXC(BUF, 50) .EQ. 0))GOTO 23009
      TWO = 0
23009 CONTINUE
      IF (.NOT.(INDEXC(BUF, 51) .EQ. 0))GOTO 23011
      THREE = 0
23011 CONTINUE
      GOTO 23006
23005 CONTINUE
      IF (.NOT.(BUF(1) .EQ. 45))GOTO 23013
      J = J + 1
      FILE(J) = 1
      GOTO 23014
23013 CONTINUE
      J = J + 1
      FILE(J) = OPEN(BUF,1)
      IF (.NOT.(FILE(J) .EQ. -3))GOTO 23015
      CALL CANT(BUF)
23015 CONTINUE
23014 CONTINUE
23006 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(J .EQ. 0))GOTO 23017
      CALL ERROR(USESTR)
23017 CONTINUE
      IF (.NOT.(J .EQ. 1))GOTO 23019
      FILE(2) = 1
23019 CONTINUE
      CALL COMMON(FILE(1), FILE(2))
      RETURN
      END
      INTEGER FUNCTION CMPAR(LIN1, LIN2)
      LOGICAL*1 LIN1(100), LIN2(100)
      INTEGER I
      I=1
23021 IF (.NOT.(LIN1(I) .EQ. LIN2(I)))GOTO 23023
      IF (.NOT.(LIN1(I) .EQ. 0))GOTO 23024
      CMPAR = 0
      RETURN
23024 CONTINUE
23022 I=I+1
      GOTO 23021
23023 CONTINUE
      IF (.NOT.(LIN1(I) .LT. LIN2(I)))GOTO 23026
      CMPAR = -1
      GOTO 23027
23026 CONTINUE
      CMPAR = + 1
23027 CONTINUE
      RETURN
      END
      SUBROUTINE COL1 (BUF)
      LOGICAL*1 BUF(100)
      COMMON /CCOMM/ ONE, TWO, THREE
      INTEGER ONE
      INTEGER TWO
      INTEGER THREE
      IF (.NOT.(ONE .EQ. 0))GOTO 23028
      RETURN
23028 CONTINUE
      I = 1
      CALL SKIPBL (BUF, I)
      CALL PUTLIN(BUF(I), 2)
      RETURN
      END
      SUBROUTINE COL2 (BUF)
      LOGICAL*1 BUF(100)
      INTEGER I
      COMMON /CCOMM/ ONE, TWO, THREE
      INTEGER ONE
      INTEGER TWO
      INTEGER THREE
      IF (.NOT.(TWO .EQ. 0))GOTO 23030
      RETURN
23030 CONTINUE
      IF (.NOT.(ONE .EQ. 1))GOTO 23032
      I=1
23034 IF (.NOT.(I.LE.15))GOTO 23036
      CALL PUTCH(32,2)
23035 I=I+1
      GOTO 23034
23036 CONTINUE
23032 CONTINUE
      I = 1
      CALL SKIPBL (BUF, I)
      CALL PUTLIN(BUF(I), 2)
      RETURN
      END
      SUBROUTINE COL3(BUF)
      LOGICAL*1 BUF(100)
      INTEGER I
      COMMON /CCOMM/ ONE, TWO, THREE
      INTEGER ONE
      INTEGER TWO
      INTEGER THREE
      IF (.NOT.(THREE .EQ. 0))GOTO 23037
      RETURN
23037 CONTINUE
      IF (.NOT.(ONE .EQ. 1))GOTO 23039
      I=1
23041 IF (.NOT.(I.LE.10))GOTO 23043
      CALL PUTCH(32,2)
23042 I=I+1
      GOTO 23041
23043 CONTINUE
23039 CONTINUE
      IF (.NOT.(TWO .EQ. 1))GOTO 23044
      I=1
23046 IF (.NOT.(I.LE.15))GOTO 23048
      CALL PUTCH(32,2)
23047 I=I+1
      GOTO 23046
23048 CONTINUE
23044 CONTINUE
      I = 1
      CALL SKIPBL(BUF, I)
      CALL PUTLIN(BUF(I), 2)
      RETURN
      END
      SUBROUTINE COMMON(FILE1, FILE2)
      INTEGER FILE1, FILE2, K, STAT1, STAT2
      INTEGER GETLIN
      LOGICAL*1 BUF1(512), BUF2(512)
      INTEGER CMPAR
      STAT1 = GETLIN(BUF1,FILE1)
      STAT2 = GETLIN(BUF2,FILE2)
23049 CONTINUE
      IF (.NOT.(STAT1 .EQ. -1 .OR. STAT2 .EQ. -1))GOTO 23052
      GOTO 23051
23052 CONTINUE
      K = CMPAR(BUF1, BUF2)
      IF (.NOT.(K .LT. 0))GOTO 23054
      CALL COL1(BUF1)
      STAT1 = GETLIN(BUF1, FILE1)
      GOTO 23055
23054 CONTINUE
      IF (.NOT.(K .GT. 0))GOTO 23056
      CALL COL2(BUF2)
      STAT2 = GETLIN(BUF2, FILE2)
      GOTO 23057
23056 CONTINUE
      CALL COL3(BUF1)
      STAT1 = GETLIN(BUF1, FILE1)
      STAT2 = GETLIN(BUF2, FILE2)
23057 CONTINUE
23055 CONTINUE
23050 GOTO 23049
23051 CONTINUE
      IF (.NOT.(STAT1 .EQ. -1 .AND. TWO .EQ. 1))GOTO 23058
23060 IF (.NOT.(STAT2 .NE. -1))GOTO 23061
      CALL COL2(BUF2)
      STAT2 = GETLIN(BUF2, FILE2)
      GOTO 23060
23061 CONTINUE
      GOTO 23059
23058 CONTINUE
      IF (.NOT.(STAT2 .EQ. -1 .AND. ONE .EQ. 1))GOTO 23062
23064 IF (.NOT.(STAT1 .NE. -1))GOTO 23065
      CALL COL1(BUF1)
      STAT1 = GETLIN(BUF1, FILE1)
      GOTO 23064
23065 CONTINUE
23062 CONTINUE
23059 CONTINUE
      RETURN
      END
