3 fitting reports on the page, 4 printing totals before detail lines – Compaq COBOL AAQ2G1FTK User Manual

Page 388

Advertising
background image

Producing Printed Reports
10.10 Solving Report Problems

Table 10–2 (Cont.) Results of Group Indicating

Without Group Indicating

With Group Indicating

STATE

CITY

STORE
NUMBER

STATE

CITY

STORE
NUMBER

Massachusetts

Maynard

111111

Massachusetts

Maynard

111111

Massachusetts

Maynard

222222

222222

Massachusetts

Maynard

333333

333333

Massachusetts

Maynard

444444

444444

Massachusetts

Tewksbury

111111

Massachusetts

Tewksbury

111111

Massachusetts

Tewksbury

222222

222222

New Hampshire

Manchester

111111

New Hampshire

Manchester

111111

New Hampshire

Manchester

222222

222222

New Hampshire

Merrimack

333333

New Hampshire

Merrimack

333333

New Hampshire

Merrimack

444444

444444

New Hampshire

Merrimack

555555

555555

New Hampshire

Nashua

666666

New Hampshire

Nashua

666666

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

Advertising