REPORT SECTION.

RD  REPORT-LISTING

    CONTROLS ARE FINAL ST-NO-IN

    PAGE LIMIT IS 50 LINES

    HEADING 6

    FIRST DETAIL 10.

01  TYPE IS PAGE HEADING.

    05  LINE NUMBER IS 6.

        10  COLUMN NUMBER 30             PIC X(17)

            VALUE "POPULATION REPORT".

        10  COLUMN NUMBER 55             PIC XX/

            SOURCE WS-MO.

        10  COLUMN NUMBER 58             PIC XX/

            SOURCE WS-DA.

        10  COLUMN NUMBER 61             PIC XXXX

            SOURCE WS-YR.

        10  COLUMN NUMBER 67             PIC X(5)

            VALUE "PAGE ".

        10  COLUMN NUMBER 74             PIC Z9

            SOURCE PAGE-COUNTER.

    05  LINE NUMBER IS 8.

        10  COLUMN NUMBER 21             PIC X(8)

            VALUE "STATE NO".

        10  COLUMN NUMBER 42             PIC X(16)

            VALUE "TOTAL POPULATION".

01  TYPE IS CONTROL FOOTING ST-NO-IN.

    05  LINE NUMBER PLUS 2.

        10  COLUMN NUMBER 24             PIC Z9

            SOURCE ST-NO-IN.

        10  STATE-POP COLUMN NUMBER 40   PIC ZZ,ZZZ,ZZ9

            SUM POP-IN.

01  TYPE IS CONTROL FOOTING FINAL.

    05  LINE NUMBER PLUS 3.

        10  COLUMN NUMBER 15             PIC X(20)

            VALUE "TOTAL USA POPULATION".

        10  COLUMN NUMBER 39             PIC ZZZ,ZZZ,ZZ9

            SUM STATE-POP.

PROCEDURE DIVISION.

000-MAIN-MODULE.

    PERFORM 100-INITIALIZATION-MODULE

    PERFORM UNTIL NO-MORE-RECORDS

        READ POPULATION-MASTER

             AT END MOVE "NO " TO ARE-THERE-MORE-RECORDS

             NOT AT END PERFORM 300-CALC-MODULE

        END-READ

    END-PERFORM

    PERFORM 900-TERMINATION-MODULE

    STOP RUN.

100-INITIALIZATION-MODULE.

    OPEN INPUT  POPULATION-MASTER

         OUTPUT POPULATION-REPORT

    MOVE FUNCTION CURRENT-DATE TO WS-DATE

    INITIATE REPORT-LISTING.

300-CALC-MODULE.

    GENERATE REPORT-LISTING.

900-TERMINATION-MODULE.

    TERMINATE REPORT-LISTING

    CLOSE POPULATION-MASTER

          POPULATION-REPORT.