Compaq COBOL AAQ2G1FTK User Manual

Page 315

Advertising
background image

Producing Printed Reports

10.6 Programming a Linage-File Compaq COBOL Report

ADVANCING PAGE clause or the AFTER ADVANCING PAGE clause. For an
example of the WRITE statement, see Section 10.6.7.

Section 10.6.5 describes how to handle a page-overflow condition.

10.6.5 Programming for the End-of-Page and Page-Overflow Condition

A page-overflow condition occurs when your program writes more lines than the
logical page can accommodate. Although the compiler automatically advances
to the next logical page when you use the LINAGE-COUNTER register, header
information is not printed, and the next line begins on the next logical page.

If you want your program to advance to the next page and print page headers on
the new page when the page is full, you should include routines in your program
that limit the number of lines on each logical page.

Example 10–4 demonstrates how to include these routines in your program using
the logical page shown in Figure 10–7.

In Figure 10–7, each detail line of the report represents a separate purchase
at the XYZ Clothing Store. Each page can contain from 1 to 18 purchase lines.
Each customer can have an unlimited number of purchases. A total of purchases
for each customer is to appear on line 25 of that customer’s last statement page.
Headers appear on the top of each page.

The input file, INPUT.DAT, consists of individual purchase records sorted
in ascending order by customer account number and purchase date. In
Example 10–4, the LINAGE clause defines a footing area so the program can
check for an end-of-page condition. When the condition is detected, the program
executes its header routine to print lines 1 to 7.

Producing Printed Reports 10–15

Advertising