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

Skipping to a Printer Control Tape Channel Punch
If you are writing to a printer that has a VFU control feature, handled either by punched paper
tape or an electronic equivalent, you can specify that the printer is to advance to a certain vertical
position before (or after) the record delivered by the WRITE statement is written on the paper. To
do this, you must:
Know what channels are defined for the printer
Use the SPECIAL-NAMES paragraph of the Environment Division to associate your own
mnemonic name with the channel you plan to use
Use a BEFORE or AFTER ADVANCING phrase having that mnemonic name
So, if you have a printer on which a skip to channel 6 puts you at line 50 of a page, your program
must specify something like:
SPECIAL-NAMES.
CHANNEL-6 IS CH-6.
Then the WRITE statement to print the contents of record SUBTOTAL-Z on line 50 of the current
page is:
WRITE SUBTOTAL-Z AFTER ADVANCING CH-6
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.
Figure 38 LINAGE Clause Layout
912 Printer and Spooler Output