Producing Printed Reports
10.10 Solving Report Problems
Example 10–12 (Cont.) Printing Labels Four-Up in Sort Order
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-LABELS.
A200-GENERATE-LABELS.
MOVE INPUT-NAME
TO LABEL-NAME(ROW-INDEX, NAME-INDEX)
MOVE INPUT-ADDRESS
TO LABEL-ADDRESS(ROW-INDEX, ADDRESS-INDEX)
MOVE INPUT-CITY
TO LABEL-CITY(ROW-INDEX, CSZ-INDEX)
MOVE INPUT-STATE
TO LABEL-STATE(ROW-INDEX, CSZ-INDEX)
MOVE INPUT-ZIP
TO LABEL-ZIP(ROW-INDEX, CSZ-INDEX)
IF ROW-INDEX = 6 AND NAME-INDEX = 4
PERFORM A300-PRINT-PAGE-OF-LABELS VARYING ROW-INDEX
FROM 1 BY 1 UNTIL ROW-INDEX IS GREATER THAN 6
MOVE SPACES TO LABELS-TABLE
SET ROW-INDEX, NAME-INDEX, ADDRESS-INDEX, CSZ-INDEX TO 1
ELSE
PERFORM A210-UPDATE-INDEXES.
A210-UPDATE-INDEXES.
IF ROW-INDEX =
6 SET ROW-INDEX
TO 1
SET NAME-INDEX
ADDRESS-INDEX
CSZ-INDEX
UP BY 1
ELSE
SET ROW-INDEX UP BY 1.
A300-PRINT-PAGE-OF-LABELS.
WRITE REPORT-RECORD FROM NAME-LINE(ROW-INDEX)
AFTER ADVANCING 3.
WRITE REPORT-RECORD FROM ADDRESS-LINE(ROW-INDEX)
AFTER ADVANCING 1.
WRITE REPORT-RECORD FROM CSZ-LINE(ROW-INDEX)
AFTER ADVANCING 1.
10.10.2 Group Indicating
The group indicating process greatly improves a report’s readability where long
sequences of entries have some element in common. You print the element once,
then leave it blank for subsequent lines, as long as there is no change in that
element. For example, if your sample file’s sort sequence is State (major key) and
City (minor key), you get sequences like those in Table 10–2.
Table 10–2 Results of Group Indicating
Without Group Indicating
With Group Indicating
STATE
CITY
STORE
NUMBER
STATE
CITY
STORE
NUMBER
Arizona
Grand Canyon
111111
Arizona
Grand Canyon
111111
Arizona
Grand Canyon
123456
123456
Arizona
Grand Canyon
222222
222222
Arizona
Tucson
333333
Arizona
Tucson
333333
Arizona
Tucson
444444
444444
Arizona
Tucson
555555
555555
(continued on next page)
Producing Printed Reports 10–87
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......