COBOL Manual for TNS and TNS/R Programs
Printer and Spooler Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
30-20
Skipping to a New Page
Skipping to a New Page
To have your program deliver a print line to the top of a new page, include an AFTER
ADVANCING PAGE phrase in the WRITE statement. If you want the program to deliver
a print line, then skip to the top of a page, include a BEFORE ADVANCING PAGE
phrase in the WRITE statement.
Formatting Pages of a Printed Report
By using the LINAGE clause in the file description of a report file and by including the
AT END-OF-PAGE phrase in each WRITE statement that adds lines to the report, you
can produce attractive reports with little effort. This technique requires you to use a bit
of structured programming.
The idea behind the LINAGE clause is that each page of the report has a top-margin
area and a bottom-margin area, where the program writes no characters, and a body
area, where the program does write characters. The body area ends with a footing
area, made up of zero or more lines, where the program can write when it detects that
the remainder of the body area is full. A typical use of this is for subtotals and totals for
columns of data in the remainder of the body.
A standard 11-inch page printed at 6 lines per inch can accommodate 66 lines. You
could establish 3 blank lines at the top, 3 blank lines at the bottom, and 60 lines of
body between them. If you establish a footing line at 55, then the end-of-page condition
arises after line 54 is written. If you want a one-line footing, use:
FOOTING AT 66
Figure 30-1. LINAGE Clause Layout
Top Margin
Body
(Includes Footing)
Footing
Bottom Margin
Top
Body
Bottom
VST708.vsd