 IDENTIFICATION DIVISION.
 PROGRAM-ID.  Segments.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER.  BRANDXY.
 OBJECT-COMPUTER.  BRANDXY
     SEGMENT-LIMIT 30.
*
*   File Control and Data Division omitted for brevity.
*
 PROCEDURE DIVISION.
 0000-MAIN SECTION 00.
 0000-MAIN-PARA.
     PERFORM 0010-INITIAL.
     PERFORM 1000-MAIN-LOOP
         UNTIL INPUT-EOF.
     PERFORM 9010-FINAL.
     STOP RUN.

 0010-INITIAL SECTION 90.
 0010-INITIAL-PARA.
     OPEN INPUT MAIN-INPUT
                EDIT-TABLE-FILE
          OUTPUT EDIT-OUTPUT
                 ERROR-REPORT.
     PERFORM 0100-READ-MAIN-INPUT.

 0100-READ-MAIN-INPUT SECTION 00.
 0100-READ-MAIN-INPUT-PARA.
     READ MAIN-INPUT
         AT END
            MOVE ‘Y’ TO INPUT-EOF-STATUS.

 1000-MAIN-LOOP SECTION 00.
 1000-MAIN-LOOP-PARA.
      EVALUATE INPUT-TYPE
         WHEN ‘AUTO’
           PERFORM 2000-AUTO-POLICY-EDIT
         WHEN ‘LIFE’
           PERFORM 3000-LIFE-POLICY-EDIT
         WHEN OTHER
           MOVE 1234 TO ERROR-CODE
           PERFORM 1500-HANDLE-ERROR
       END-EVALUATE.
       PERFORM 0100-READ-MAIN-INPUT.

 1200-EDIT-DATES SECTION 22.
 1200-EDIT-DATES-PARA.
*   Date editing routine

 1500-HANDLE-ERROR SECTION 45.
 1500-HANDLE-ERROR-PARA.
*   Format and write reject into to report

 2000-AUTO-POLICY-EDIT SECTION 60.
 2000-AUTO-POLICY-EDIT-PARA.
*   Edit details for Automobile Insurance policy transactions
*   Including:
      MOVE AUTO-RENEWAL-DATE TO DATE-FIELD.
      PERFORM 1200-EDIT-DATES.
      IF DATE-STATUS NOT = ZERO
          MOVE DATE-STATUS TO ERROR-CODE
          PERFORM 1500-HANDLE-ERROR.
*    More editing

 3000-LIFE-POLICY-EDIT SECTION 70.
 3000-LIFE-POLICY-EDIT-PARA.

*    Edit details for Life Insurance policy transactions
*    Including:
      MOVE POLICY-ACTIVATION-DATE TO DATE-FIELD.
      PERFORM 1200-EDIT-DATES.
      IF DATE-STATUS NOT = ZERO
          MOVE DATE-STATUS TO ERROR-CODE
          PERFORM 1500-HANDLE-ERROR.
*   More editing
*
 9010-FINAL SECTION 90.
 9010-FINAL-PARA.
     CLOSE MAIN-INPUT
           EDIT-TABLE-FILE
           EDIT-OUTPUT
           ERROR-REPORT.
