Producing Printed Reports
10.10 Solving Report Problems
Example 10–11 (Cont.) Printing Labels Four-Up
07
LABEL-CITY
PIC X(10).
07
FILLER
PIC XXXX.
07
LABEL-STATE
PIC XX.
07
FILLER
PIC XXXX.
07
LABEL-ZIP
PIC 99999.
07
FILLER
PIC XXXXX.
01
END-OF-FILE
PIC X.
PROCEDURE DIVISION.
A000-BEGIN.
OPEN INPUT
INPUT-FILE
OUTPUT REPORT-FILE.
MOVE SPACES TO LABELS-TABLE.
SET INDEX-1, INDEX-2, INDEX-3 TO 1.
PERFORM A100-READ-INPUT UNTIL END-OF-FILE = "Y".
A050-WRAP-UP.
IF LABEL-NAME(1) IS NOT EQUAL TO SPACES
PERFORM A300-PRINT-FOUR-LABELS.
A050-END-OF-JOB.
CLOSE INPUT-FILE
REPORT-FILE.
DISPLAY "END OF JOB".
STOP RUN.
*
A100-READ-INPUT.
READ INPUT-FILE AT END MOVE "Y" TO END-OF-FILE.
IF END-OF-FILE = "Y" NEXT SENTENCE
ELSE PERFORM A200-GENERATE-TABLE.
*
A200-GENERATE-TABLE.
MOVE INPUT-NAME
TO LABEL-NAME(INDEX-1)
MOVE INPUT-ADDRESS
TO LABEL-ADDRESS(INDEX-2)
MOVE INPUT-CITY
TO LABEL-CITY(INDEX-3)
MOVE INPUT-STATE
TO LABEL-STATE(INDEX-3)
MOVE INPUT-ZIP
TO LABEL-ZIP(INDEX-3)
IF INDEX-1 = 4 PERFORM A300-PRINT-FOUR-LABELS
ELSE
SET INDEX-1, INDEX-2, INDEX-3 UP BY 1.
*
A300-PRINT-FOUR-LABELS.
WRITE REPORT-RECORD FROM NAME-LINE AFTER ADVANCING 3.
WRITE REPORT-RECORD FROM ADDRESS-LINE AFTER ADVANCING 1.
WRITE REPORT-RECORD FROM CSZ-LINE AFTER ADVANCING 1.
MOVE SPACES TO LABELS-TABLE.
SET INDEX-1, INDEX-2, INDEX-3 TO 1.
10–84 Producing Printed Reports
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......