COBOL Manual for TNS and TNS/R Programs

Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
29-11
Writing to a Console
Topics:
Writing to a Console
Writing to a Terminal or Printer
Reading From a Terminal or Process
Reading and Writing Numeric Data
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 29-5 does) or assign a file to $0 in the
Environment Division and use WRITE statements.
Example 29-5. 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 was here".
PROCEDURE DIVISION.
A.
DISPLAY "Program TELL-THE-LOG: "
ANNOUNCEMENT
UPON RECORD-FOR-POSTERITY.
STOP RUN.