COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

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
This file description illustrates the LINAGE clause for this type of page:
FD SHOW-LINAGE
LABEL RECORDS ARE OMITTED
LINAGE IS 60 LINES
WITH FOOTING AT 55
LINES AT TOP 3
LINES AT BOTTOM 3.
One tenet of structured programming is that there be one WRITE procedure for each output file;
the program builds the line for delivery and then performs the write procedure. This situation is a
perfect basis for using the LINAGE clause.
If your code writes each text line before advancing one line, you can use AT END-OF-PAGE phrase
to detect that the program has already written the last line in the body of the report page. If the
page needs subtotals or column footings, you can specify a number of footing lines in the LINAGE
clause. This action causes the end-of-page condition to arise when the process attempts to write
into the footing area. You can then use an AT END-OF-PAGE phrase in the main WRITE statement
and specify that when the end-of-page condition arises, a footing-area procedure is to be performed.
Example 299 illustrates this technique.
Example 299 END-OF-PAGE Phrase
WRITE-PROCEDURE SECTION.
...
WRITE SHOW-LINAGE-REC BEFORE ADVANCING 1
AT END-OF-PAGE PERFORM DO-FOOTING.
...
DO-FOOTING.
MOVE SUMMATION-LINES TO SHOW-LINAGE-REC.
WRITE SHOW-LINAGE-REC BEFORE ADVANCING 2.
PERFORM COLLECT-SUBTOTALS-TO-PRINT.
WRITE SHOW-LINAGE-REC BEFORE ADVANCING PAGE.
If you have trouble tracing the interactions of BEFORE phrases, AFTER phrases, numbers of lines
to advance, page advances, and channel skips, you can always discover exactly what printer
control commands are being used by following this procedure:
1. Direct your output to a spooler collector with a fictitious location.
2. Use the PERUSE command LIST to specify that the lines for at least two pages be listed to a
printer or to the spooler collector in octal, showing all control codes:
LIST /OUT $S.#LPF/ 1/2 O C
This step lists each print line, each SETMODE operation, and each CONTROL operation.
3. See the Spooler Programmer’s Guide to identify the codes in the SETMODE and CONTROL
operations.
Logging Program Activity Information to a Printer
To record a log of program activity to a printer, you can use either of these statements:
DISPLAY
WRITE (usually preferable)
Logging Program Activity Information to a Printer 913