Producing Printed Reports
10.10 Solving Report Problems
Table 10–2 (Cont.) Results of Group Indicating
Without Group Indicating
STATE
CITY
Massachusetts
Maynard
Massachusetts
Maynard
Massachusetts
Maynard
Massachusetts
Maynard
Massachusetts
Tewksbury
Massachusetts
Tewksbury
New Hampshire
Manchester
New Hampshire
Manchester
New Hampshire
Merrimack
New Hampshire
Merrimack
New Hampshire
Merrimack
New Hampshire
Nashua
10.10.3 Fitting Reports on the Page
If you need more columns than physically can fit on a page, you can do the
following:
•
Eliminate as many unused spaces as possible between columns. Columns
should not be run together; however, you can use one blank space instead of
several.
•
Eliminate nonessential information.
•
Print two or more lines with staggered headers and columns.
•
Print two reports.
10.10.4 Printing Totals Before Detail Lines
A report that must include totals at the top of the page before the detail lines has
three solutions as follows:
•
Store the logical print lines in a table, total the table, and then print from the
table.
•
Pass through the file twice. The first time, compute the totals. The second
time, print the report. This method is slow and complicated if there are many
subtotals.
•
Write the lines into a file with a sort key containing the report, page, and
line number. When your program writes the last line and computes the total,
have it assign a page and line number to the total line's sort key. Use an
appropriate page and line number to cause the total line to sort in front of its
detail lines. After the program completes, sort the file, read it, drop the sort
key, and produce the report.
10–88 Producing Printed Reports
STORE
NUMBER
STATE
111111
Massachusetts
222222
333333
444444
111111
Massachusetts
222222
111111
New Hampshire
222222
333333
New Hampshire
444444
555555
666666
New Hampshire
With Group Indicating
STORE
CITY
NUMBER
Maynard
111111
222222
333333
444444
Tewksbury
111111
222222
Manchester
111111
222222
Merrimack
333333
444444
555555
Nashua
666666
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?