-INIT.
    OPEN INPUT INPUT1-FILE
    PERFORM 8500-CHECK-RESTART THRU 8500-EXIT.
    PERFORM 1000-UPDATE-LOOP THRU 1000-EXIT
       UNTIL WS-YN-INPUT1-EOF = ‘Y’
    DISPLAY ‘NUMBER OF UPDATES=‘ WS-UPDATE-COUNTER.

-CHECK-RESTART.
    OPEN INPUT COMMIT1-FILE
    READ COMMIT1-FILE
         AT END MOVE ‘Y’ TO WS-YN-COMMIT1-EOF
    END-READ
    IF WS-YN-COMMIT1-EOF = ‘Y’
       DISPLAY ‘8500 NO RESTART REQUIRED’
    ELSE
       DISPLAY ‘8500 RESTARTING AT UPDATE-COUNTER=’
                COMMIT1-UPDATE-COUNTER
       PERFORM 8510-SKIP-INPUT1-REC THRU 8510-EXIT
           COMMIT1-UPDATE-COUNTER TIMES
       MOVE COMMIT1-UPDATE-COUNTER TO WS-UPDATE-COUNTER
    END-IF.
    CLOSE COMMIT1-FILE.
-EXIT. EXIT.

-SKIP-INPUT1-REC.
     READ INPUT1-FILE
          AT END MOVE ‘Y’ TO WS-YN-INPUT1-EOF
                 DISPLAY ‘8510: ERROR //INPUT1 EOF ON RESTART’
                 MOVE 16 TO RETURN-CODE
                 STOP RUN
      END-READ.
-EXIT. EXIT.
