*THIS PROGRAM READS A SEQUENTIAL FILE CONTAINING
*AN EMPLOYEE-ID AND A CHANGE TO THE EMPLOYEE’S LAST-NAME.

     03  WS-UPDATE-COUNTER    PIC S9(4) COMP. VALUE ZERO.
     03  WS-COMMIT-COUNTER    PIC S9(4) COMP  VALUE ZERO.
     03  WS-COMMIT-FREQ       PIC S9(4) COMP VALUE +100.

     PERFORM 1000-UPDATE-LOOP THRU 1000-EXIT
        UNTIL WS-YN-INPUT1-EOF = ‘Y’
     DISPLAY ‘NUMBER OF UPDATES=‘ WS-UPDATE-COUNTER.

 1000-UPDATE-LOOP.
      READ INPUT1-FILE
           AT END MOVE ‘Y’ TO WS-YN-INPUT1-EOF
                  GO TO 1000-EXIT
      END-READ
      MOVE INPUT1-EMP-ID TO EMPLOYEE-EMP-ID
      OBTAIN CALC EMPLOYEE-REC
      IF DB-REC-NOT-FOUND
        DISPLAY ‘RECORD NOT FOUND EMP-ID=‘ INPUT1-EMP-ID
        GO TO 1000-EXIT
      END-IF
      PERFORM IDMS-STATUS
      MOVE INPUT1-LAST-NAME TO EMPLOYEE-LAST-NAME
      MODIFY EMPLOYEE-REC
      PERFORM IDMS-STATUS
      ADD 1 TO WS-UPDATE-COUNTER
      ADD 1 TO WS-COMMIT-COUNTER
      IF WS-COMMIT-COUNTER NOT < WS-COMMIT-FREQ
          PERFORM 8000-COMMIT THRU 8000-EXIT
      END-IF
      .
 1000-EXIT. EXIT.

 8000-COMMIT.
     COMMIT.
     PERFORM IDMS-STATUS.
     MOVE ZERO TO WS-COMMIT-COUNTER.
 8000-EXIT. EXIT.
