Producing Printed Reports
10.5 Programming a Conventional File Report
Example 10–3 (Cont.) Page Advancing and Line Skipping
01
FORM1-LINE-14.
02
PIC X(4)
VALUE SPACES.
02
FORM1-STREET
PIC X(20).
01
FORM1-LINE-15.
02
PIC X(4)
VALUE SPACES.
02
FORM1-CITY
PIC X(15).
02
PIC X
VALUE SPACE.
02
FORM1-STATE
PIC XX.
02
PIC X
VALUE SPACE.
02
FORM1-ZIP
PIC 99999.
01
FORM2-HEADER-1.
02
PIC X(15) VALUE SPACES.
02
PIC X(30) VALUE "
PERSONNEL MASTER LISTING
".
02
PIC X(10) VALUE SPACES.
02
PIC XXXXX VALUE "Page ".
02
F2H-PAGE
PIC ZZZZZ.
01
FORM2-HEADER-2.
02
PIC X(15) VALUE SPACES.
02
PIC X(30) VALUE "**** COMPANY CONFIDENTIAL ****".
PROCEDURE DIVISION.
A000-BEGIN.
OPEN INPUT
INPUT-FILE
OUTPUT FORM1-REPORT
FORM2-REPORT.
PERFORM A900-PRINT-HEADERS-ROUTINE.
PERFORM A100-PRINT-REPORTS UNTIL END-OF-FILE = "Y".
CLOSE INPUT-FILE
FORM1-REPORT
FORM2-REPORT.
DISPLAY "END OF JOB".
STOP RUN.
A100-PRINT-REPORTS.
READ INPUT-FILE AT END MOVE "Y" TO END-OF-FILE.
IF END-OF-FILE NOT = "Y"
PERFORM A200-PRINT-REPORTS.
A200-PRINT-REPORTS.
IF FORM2-LINE-COUNTER IS GREATER THAN MAX-LINES-ON-FORM2
PERFORM A900-PRINT-HEADERS-ROUTINE.
WRITE FORM2-PRINT-LINE FROM INPUT-RECORD
AFTER ADVANCING 2 LINES.
ADD 2 TO FORM2-LINE-COUNTER.
MOVE I-LAST
TO FORM1-LAST.
WRITE FORM1-PRINT-LINE FROM FORM1-LINE-3
AFTER ADVANCING 3 LINES.
MOVE I-NAME
TO FORM1-NAME.
WRITE FORM1-PRINT-LINE FROM FORM1-LINE-13
AFTER ADVANCING 10 LINES.
MOVE I-STREET
TO FORM1-STREET.
WRITE FORM1-PRINT-LINE FROM FORM1-LINE-14.
MOVE I-CITY
TO FORM1-CITY.
MOVE I-STATE
TO FORM1-STATE.
MOVE I-ZIP
TO FORM1-ZIP.
WRITE FORM1-PRINT-LINE FROM FORM1-LINE-15.
(continued on next page)
10–10 Producing Printed Reports