COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-10
Communicating With an Operator or Process
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.
Example 29-4. Transferring Break Ownership
WORKING-STORAGE SECTION.
01 FILE-NUMBER PIC S9(4).
01 PROCESS-HANDLE PIC X(20).
01 ERROR-NUMBER PIC S9(5) COMP.
01 PREV-BREAK-OWNER.
03 PREV-OWNER NATIVE-2.
03 PREV-ACCESS-MODE NATIVE-2.
...
PROCEDURE DIVISION.
...
OPEN I-O A-TERM.
ENTER TAL "COBOLFILEINFO" USING A-TERM
OMITTED
OMITTED
FILE-NUMBER.
* Get ownership of Break, saving previous info.
ENTER TAL "SETMODE" USING FILE-NUMBER,
11,
1,
1,
PREV-BREAK-OWNER.
...
... { HP COBOL program now owns Break }
...
* Restore Break ownership according to saved info.
ENTER "COBOL_SETMODE_ " USING FILE-NUMBER,
11,
PREV-OWNER,
PREV-ACCESS-MODE.