COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-2
Using ACCEPT and DISPLAY With a Terminal
Using ACCEPT and DISPLAY With a Terminal
ACCEPT and DISPLAY statements transfer small amounts of data between a device
and a process. The device is not a file; it is neither mentioned in the HP COBOL
program’s FILE-CONTROL paragraph nor described in the program’s File Section.
Whenever a process executes an ACCEPT or DISPLAY statement, the HP COBOL
run-time routines automatically open the device, perform the operation, and close the
device.
Any ACCEPT and DISPLAY statements that do not include a mnemonic name to
specify a device interact with the standard input and output devices of their process,
respectively.
Topics:
•
Guardian Environment
•
OSS Environment
Guardian Environment
In the Guardian environment, each process has an IN file, an OUT file, and a home
terminal file. You can specify these files in the RUN command, using the IN, OUT, and
TERM run options or with the PARAM EXECUTION-LOG command (see Section 25,
Executing and Debugging HP COBOL Programs). If you do not specify one or all of the
files in the RUN command, the process inherits the corresponding file of the command
interpreter that accepted the RUN command.
If you want a process’s ACCEPT and DISPLAY statements to interact with a terminal
other than that on which you issued the RUN command to start the process, you have
two alternatives:
•
Use the SPECIAL-NAMES paragraph to associate a mnemonic name with the
other terminal and qualify the ACCEPT and DISPLAY statements with that name.
•
Mention the other terminal in the RUN command IN and OUT options when you
initiate the process.
If a process needs to choose among several terminals for input or output, the use of
the mnemonic name requires that all device assignments be established at compile
time; therefore, several ACCEPT or DISPLAY statements, each associated with a fixed
device, must be present in the program, and the process must choose the ACCEPT or
DISPLAY to use.
Example 29-1
shows the use of ACCEPT and DISPLAY statements with the IN file and
the OUT file and with a terminal that is known to the file system as $TRM053.