COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
ENTER "COBOL_SETMODE_ " USING FILE-NUMBER,
11,
PREV-OWNER,
PREV-ACCESS-MODE.
Communicating With an Operator or Process
A running HP COBOL program can use the DISPLAY statement to write to the operator console (a
write-only device). Likewise, a running HP COBOL program can use the DISPLAY statement to write
characters to any terminal or printer and can use the ACCEPT statement to read characters from
any terminal or process.
When a process includes code from an HP COBOL program and that HP COBOL code reports a
run-time error, it reports the error to the process’ home terminal. The home terminal for a process
must be chosen with care. Run-time diagnostic messages can easily get lost if an unattended terminal
is used for them.
Writing to a Console
The system operator console terminal device on any HP system is named $0 (“dollar zero”). It can
be a hard-copy device or the Operations and Service Processor (OSP). In either case, the system
operator (any super group member) can redirect the messages to another device or disable the
delivery of messages entirely.
Minimize messages to the operator in both development programs and production programs.
If your HP COBOL application needs to announce something to the system operator, it must either
associate a mnemonic name with $0 and use DISPLAY statements to communicate with the operator
(as Example 294 does) or assign a file to $0 in the Environment Division and use WRITE statements.
Example 294 Using DISPLAY Statements to Write to a Console
IDENTIFICATION DIVISION.
PROGRAM-ID. TELL-THE-LOG.
AUTHOR. KILROY COBOL.
INSTALLATION. TRANSACTIONS ANONYMOUS.
DATE-WRITTEN. 29 FEBRUARY 1984.
DATE-COMPILED.
*********************************************************
* This program delivers a line to the system console. *
*********************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP TXP.
OBJECT-COMPUTER. HP TXP.
SPECIAL-NAMES.
FILE "$0" IS RECORD-FOR-POSTERITY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ANNOUNCEMENT PICTURE X(16) VALUE "Kilroy ws here".
PROCEDURE DIVISION.
A.
DISPLAY "Program TELL-THE-LOG: "
ANNOUNCEMENT
UPON RECORD-FOR-POSTERITY.
STOP RUN.
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
Communicating With an Operator or Process 895










