      REM DIFF
*
*
*
*
*
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
      INCLUDE PL.INIT.INCLUDE
*
      FILE1 = SENT<1,2>
      FILE2 = SENT<1,3>
*
      OPEN FILE1 TO FILE1.FD ELSE STOP 201,FILE1
      OPEN FILE2 TO FILE2.FD ELSE STOP 201,FILE2
*
      HEADING '     ' : FILE1 'L#60' : ' ' : FILE2 : "'L'"
*
      EOF = NO
      LOOP
         READNEXT ID ELSE EOF = YES
      UNTIL EOF DO
         READ D1 FROM FILE1.FD , ID ELSE D1 = ''
         READ D2 FROM FILE2.FD , ID ELSE D2 = ''
         DD1 = ''
         DD2 = ''
         I1 = DCOUNT(D1,AM)
         FOR I = 1 TO I1
            DD1<I> = TRIM(D1<I>)
         NEXT I
         I1 = DCOUNT(D2,AM)
         FOR I = 1 TO I1
            DD2<I> = TRIM(D2<I>)
         NEXT I
         BEGIN CASE
            CASE DD1 = '' OR DD2 = ''
               PRINT ID
               PRINT '     ' :
               IF DD1 = '' THEN
                  PRINT 'NOT ON FILE' 'L#60' : ' '
               END ELSE
                  PRINT '' 'L#60' : ' ' :
               END
               IF DD2 = '' THEN
                  PRINT 'NOT ON FILE'
               END ELSE
                  PRINT
               END
               PRINT
            CASE DD1 = DD2
            CASE YES
               PRINT ID
               GOSUB 100
               PRINT
         END CASE
      REPEAT
*
      STOP
*
100   REM
*
      N1 = 1
      N2 = 1
*
      N1.END = DCOUNT(DD1,AM)
      N2.END = DCOUNT(DD2,AM)
*
      LOOP
         IF N1 > N1.END THEN
            FOR N = N2 TO N2.END
               PRINT N 'R#4' : ' ' : '' 'L#60' : ' ' : D2<N> 'L#60'
            NEXT N
            RETURN
         END
         IF N2 > N2.END THEN
            FOR N = N1 TO N1.END
               PRINT N 'R#4' : ' ' : D1<N> 'L#60'
            NEXT N
            RETURN
         END
*
         IF DD1<N1> <> DD2<N2> THEN
            FLG = NO
            FOR N = 1 TO 20
               BEGIN CASE
                  CASE DD1<N1> = ''
                  CASE DD1<N1> = '*'
                  CASE DD2<N2> = '*'
                  CASE DD1<N1> = DD2<N2+N>
                     FOR I = 0 TO (N-1)
                        NN1 = '' ; NN2 = N2+I ; GOSUB 200
                     NEXT I
                     N2 = N2 + N
                     FLG = YES
                  CASE DD1<N1+N> = DD2<N2>
                     FOR I = 0 TO (N-1)
                        NN1 = N1 + I ; NN2 = '' ; GOSUB 200
                     NEXT I
                     N1 = N1 + N
                     FLG = YES
               END CASE
            NEXT N
            IF NOT(FLG) THEN
               NN1 = N1 ; NN2 = N2 ; GOSUB 200
               N1 = N1 + 1
               N2 = N2 + 1
            END
         END ELSE
            N1 = N1 + 1
            N2 = N2 + 1
         END
         IF N1 > N1.END AND N2 > N2.END THEN RETURN
      REPEAT
*
200   REM Display a line
*
      IF NN1 THEN
         PRINT NN1 'R#4' : ' ' : D1<NN1> 'L#60' : ' ' :
      END ELSE
         PRINT '     ' : '' 'L#60' : ' ' :
      END
      IF NN2 THEN
         PRINT NN2 'R#4' : ' ' : D2<NN2> 'L#60'
      END ELSE
         PRINT
      END
*
      RETURN
   END
