COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-12
Writing to a Terminal or Printer
Each console terminal device on your node has a unique name. The names of 
consoles other than the system operator console are determined by the system 
generation. A program can contain any number of mnemonic names, each associated 
with a terminal device. The syntax of the DISPLAY statement limits the name in the 
UPON phrase to be a mnemonic name. The mnemonic name cannot be a data item; 
therefore, if you have a message that must be displayed on several devices, you need 
one DISPLAY statement for each device.
Writing to a Terminal or Printer
When a process includes code from an HP COBOL program having a DISPLAY 
statement without a mnemonic name attached, the process delivers characters to its 
OUT file. If no OUT file was specified in the initiation of the process, the process 
inherits the OUT file of its parent (the command interpreter, if the process was initiated 
with a RUN command). If the name of the specified OUT file is all spaces, the 
characters are discarded.
To display characters to device $DDD or printer $PPP that is not the OUT file of the 
process, use the qualified form of the DISPLAY statement; for example:
DISPLAY "Hello" UPON MY-NAME-FOR-DOLLAR-DDD.
The compiler accepts this form of the DISPLAY statement only if it has already 
encountered an entry in the SPECIAL-NAMES paragraph associating MY-NAME-FOR-
DOLLAR-DDD with the device $DDD; for example:
SPECIAL-NAMES.
 FILE "$DDD" IS MY-NAME-FOR-DOLLAR-DDD.
Each time a DISPLAY statement in a process executes, the process opens the 
terminal or printer, transmits the characters, and closes the terminal or printer. Some 
other process could open the terminal or printer for exclusive use and hold it open, 
causing the next DISPLAY or ACCEPT statement that tries to reach it to get a “device 
in use” error.
Reading From a Terminal or Process
When a process includes code from an HP COBOL program having an ACCEPT 
statement without a mnemonic name attached, the process reads characters from its 
IN file; if no IN file was specified, the process reads characters from its home terminal.
To read characters from terminal $TTT or process $QQQ that is not the IN file of the 
process, use the qualified form of the ACCEPT statement; for example:
ACCEPT ADVICE FROM MY-NAME-FOR-DOLLAR-QQQ.










