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
MOVE INPUT-ADDRESS TO LABEL-ADDRESS(ROW-INDEX, ADDRESS-INDEX)
MOVE INPUT-CITY
MOVE INPUT-STATE
MOVE INPUT-ZIP
IF ROW-INDEX = 6 AND NAME-INDEX = 4
PERFORM A300-PRINT-PAGE-OF-LABELS VARYING ROW-INDEX
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
ELSE
A300-PRINT-PAGE-OF-LABELS.
WRITE REPORT-RECORD FROM NAME-LINE(ROW-INDEX)
WRITE REPORT-RECORD FROM ADDRESS-LINE(ROW-INDEX)
WRITE REPORT-RECORD FROM CSZ-LINE(ROW-INDEX)
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
STATE
CITY
Arizona
Grand Canyon
Arizona
Grand Canyon
Arizona
Grand Canyon
Arizona
Tucson
Arizona
Tucson
Arizona
Tucson
TO LABEL-NAME(ROW-INDEX, NAME-INDEX)
TO LABEL-CITY(ROW-INDEX, CSZ-INDEX)
TO LABEL-STATE(ROW-INDEX, CSZ-INDEX)
TO LABEL-ZIP(ROW-INDEX, CSZ-INDEX)
FROM 1 BY 1 UNTIL ROW-INDEX IS GREATER THAN 6
SET NAME-INDEX
ADDRESS-INDEX
CSZ-INDEX
SET ROW-INDEX UP BY 1.
AFTER ADVANCING 3.
AFTER ADVANCING 1.
AFTER ADVANCING 1.
STORE
NUMBER
STATE
111111
Arizona
123456
222222
333333
Arizona
444444
555555
Producing Printed Reports
10.10 Solving Report Problems
TO 1
UP BY 1
With Group Indicating
CITY
Grand Canyon
Tucson
(continued on next page)
Producing Printed Reports 10–87
STORE
NUMBER
111111
123456
222222
333333
444444
555555
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?