COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
DISPLAY
If you use the DISPLAY statement to send messages to a printer for shared access, you must associate
a mnemonic name with the printer device name (such as $LP) in the SPECIAL-NAMES paragraph.
This association is established at compilation time. Each DISPLAY statement transmits characters
to a single device—there is no mechanism for changing the destination of a DISPLAY statement.
Every time your process executes a DISPLAY statement, it must open the printer, write one line of
characters, and close the printer. The printer is then available to other processes until the next time
your process executes a DISPLAY statement. You cannot use the DISPLAY statement to deliver
characters to a spooler.
In the OSS environment, if a DISPLAY statement includes mnemonic-name, it must be either the
OSS pathname of a Guardian file or the name of an OSS text file.
WRITE
If you use the WRITE statement to send messages to a printer, you can determine the assignment
between the file and the device:
• At compilation through the SELECT clause of the FILE-CONTROL paragraph
• At the beginning of execution with the TACL command ASSIGN or ADD DEFINE (in the
Guardian environment only)
• During execution through the invocation of the routine COBOLASSIGN
The WRITE statement has these advantages over the DISPLAY statement:
• If there are several printers and the one you expected to use is busy, you can redirect the file
to another printer.
• You can open the file for exclusive access (the default exclusion mode for printers) and be
certain that no other process can send characters to the device while you are using it.
• You can recover from input-output errors by using declaratives.
• You can use the PARAM PRINTER-CONTROL command to handle the condition of the printer’s
being out of paper (in the Guardian environment only).
914 Printer and Spooler Output










