COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-9
Transferring Break Ownership
When a command interpreter starts a process, whether or not the process uses the
command interpreter’s terminal for any input or output, the command interpreter retains
ownership of Break 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 29-4
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.