COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

unless another process explicitly obtains ownership of Break from the operating environment. All
a process needs to do to obtain that ownership is:
Open the terminal for I-O (to get a stable file number, because DISPLAY and ACCEPT open
and close the terminal each time they are executed)
Call the COBOL_SETMODE_ routine with:
The file-name
The function code 11
The CPU, PIN (processor number, process number) of the process to receive ownership
as the first parameter
Zero as the second parameter
If you start a process from the command interpreter, and that process takes ownership of Break
but does not return ownership before terminating, the command interpreter does not regain title
to Break. You might have to get a system operator to stop and restart your command interpreter
in order for it to regain Break ownership.
Transferring Break Ownership
For one process to pass ownership of Break to another process, the first process must determine
the CPU and PIN of the second process. Then the first process can transfer Break ownership to the
other process by calling the operating system routine SETMODE with the appropriate values for
parameters 1 and 2 (see Getting Break Ownership).
The most common reason to transfer Break ownership to another process is to return it to its previous
owner after you have accessed it.
If the process will return Break ownership to its previous owner after a time, another parameter
must be included in the call to receive the 4-byte value of the restoration parameters. This enables
the process to call SETMODE with the 4 bytes as parameters 1 and 2 when it surrenders the
ownership of the Break, as Example 293 shows.
Because the message that Break has been pressed is a system message, a nonprivileged process
cannot directly transfer the message to another process. Some other protocol must be established
between the two processes.
Example 293 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.
894 Terminal Input and Output