Flowchart for if88in1.cbl:

This is the flowchart that accompanies if88in1.cbl. It includes links from the flowchart to the code in the program.




       IDENTIFICATION DIVISION.
       PROGRAM-ID.  SAMPLEIF.
       AUTHOR.  GROCER.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT INS-FILE
               ASSIGN TO "C:\PCOBWIN\CIS12FST\INS.DAT".
           SELECT PRINT-FILE
               ASSIGN TO PRINTER.
       DATA DIVISION.
       FILE SECTION.
       FD  INS-FILE
           DATA RECORD IS INS-REC.
       01  INS-REC.
           05  IDNO       PIC XXXX.
           05  NAMZ       PIC X(20).
           05  TYPZ       PIC X.
               88  TYPE-LIFE              VALUE "L".
               88  TYPE-CAR               VALUE "C".
               88  TYPE-HOME              VALUE "H".
           05  AMT-COV    PIC 9(7)V99.
           05  PREM-YR    PIC 9(4)V99.
       FD  PRINT-FILE
           DATA RECORD IS PRINTZ.
       01  PRINTZ         PIC X(80).
       WORKING-STORAGE SECTION.
       01  INDICATORS.
           05  MORE-RECS      PIC XXX           VALUE "YES".
               88  END-OF-FILE                  VALUE "NO ".
       01  WORK-AREAS.
           05  PREM-MO-WS     PIC 999V99        VALUE 0.
       01  ACCUMULATORS.
           05  TOT-MO-PREM-WS PIC 9(5)V99       VALUE 0.
       01  PAGE-CONTROL.
           05  PAGE-NO-WS     PIC 99            VALUE 1.
           05  LINE-CT-WS     PIC 99            VALUE 0.
           05  DATE-WS.
               10  YR-WS      PIC 99.
               10  MO-WS      PIC 99.
               10  DA-WS      PIC 99.
       01  DETAIL-LINE.
           05  FILLER         PIC X.
           05  IDNO-PR        PIC XXXX.
           05  FILLER         PIC XXXX.
           05  NAMZ-PR        PIC X(20).
           05  FILLER         PIC XXXX.
           05  TYPZ-MSG-PR    PIC X(13).
           05  FILLER         PIC XXXX.
           05  AMT-COV-PR     PIC $$,$$$,$$$.99.
           05  FILLER         PIC XXXX.
           05  PREM-MO-PR     PIC $$$$.99.
           05  FILLER         PIC X(6).
       01  PAGE-HDR.
           05  FILLER         PIC X       VALUE SPACES.
           05  DATE-HDR.
               10  MO-HDR     PIC 99.
               10  FILLER     PIC X       VALUE "/".
               10  DA-HDR     PIC 99.
               10  FILLER     PIC X       VALUE "/".
               10  YR-HDR     PIC 99.
           05  FILLER         PIC X(23)   VALUE SPACES.
           05  FILLER         PIC X(16)   VALUE "INSURANCE REPORT".
           05  FILLER         PIC X(21)   VALUE SPACES.
           05  FILLER         PIC X(5)    VALUE "PAGE".
           05  PAGE-NO-HDR    PIC Z9.
           05  FILLER         PIC X(6)    VALUE SPACES.
       01  COL-HDR.
           05  FILLER         PIC X(13)   VALUE " ID #    NAME".
           05  FILLER         PIC X(20)   VALUE SPACES.
           05  FILLER         PIC X(17)   VALUE "INSURANCE        ".
           05  FILLER         PIC X(15)   VALUE "     COVERAGE  ".
           05  FILLER         PIC X(15)   VALUE "MONTH PREM     ".
       01  TOTAL-LINE.
           05  FILLER         PIC X(64)   VALUE SPACES.
           05  TOT-MO-PREM-TL PIC $$$,$$$.99.
           05  FILLER         PIC X(6)    VALUE SPACES.
       PROCEDURE DIVISION.
       MAINLINE.
           PERFORM A-100-INITIAL.
           PERFORM B-100-PROCESS.
           PERFORM C-100-TERMINATE.
           STOP RUN.
       A-100-INITIAL.
           OPEN INPUT INS-FILE
                OUTPUT PRINT-FILE.
           ACCEPT DATE-WS FROM DATE.
           MOVE MO-WS TO MO-HDR.
           MOVE DA-WS TO DA-HDR.
           MOVE YR-WS TO YR-HDR.
       B-100-PROCESS.
           READ INS-FILE
               AT END
                   MOVE "NO " TO MORE-RECS.
           PERFORM B-200-LOOP
               UNTIL END-OF-FILE.
           PERFORM B-210-TOTAL-ROUT.
       B-200-LOOP.
           IF PAGE-NO-WS = 1 OR LINE-CT-WS > 55
               PERFORM B-300-HDR-ROUT.
           MOVE SPACES TO DETAIL-LINE.
           MOVE IDNO TO IDNO-PR.
           MOVE NAMZ TO NAMZ-PR.
           IF TYPE-LIFE
               MOVE "LIFE" TO TYPZ-MSG-PR
           ELSE
               IF TYPE-CAR
                   MOVE "AUTOMOBILE" TO TYPZ-MSG-PR
               ELSE
                   IF TYPE-HOME
                       MOVE "HOME OWNERS" TO TYPZ-MSG-PR
                   ELSE
                       MOVE "** INVALID **" TO TYPZ-MSG-PR.
           MOVE AMT-COV TO AMT-COV-PR.
           DIVIDE PREM-YR BY 12
               GIVING PREM-MO-WS ROUNDED.
           MOVE PREM-MO-WS TO PREM-MO-PR.
           ADD PREM-MO-WS TO TOT-MO-PREM-WS.

           WRITE PRINTZ FROM DETAIL-LINE
               AFTER ADVANCING 1 LINES.
           ADD 1 TO LINE-CT-WS.
           READ INS-FILE
               AT END
                   MOVE "NO " TO MORE-RECS.
       B-210-TOTAL-ROUT.
           MOVE TOT-MO-PREM-WS TO TOT-MO-PREM-TL.
           WRITE PRINTZ FROM TOTAL-LINE
               AFTER ADVANCING 2 LINES.
       B-300-HDR-ROUT.
           MOVE PAGE-NO-WS TO PAGE-NO-HDR.
           WRITE PRINTZ FROM PAGE-HDR
               AFTER ADVANCING PAGE.
           WRITE PRINTZ FROM COL-HDR
               AFTER ADVANCING 2 LINES.
           MOVE SPACES TO PRINTZ.
           WRITE PRINTZ
               AFTER ADVANCING 1 LINES.
           ADD 1 TO PAGE-NO-WS.
           MOVE 4 TO LINE-CT-WS.
       C-100-TERMINATE.
           CLOSE INS-FILE
                 PRINT-FILE.