COBOL Manual for TNS and TNS/R Programs

Process Initiation, Communication, and
Management
HP COBOL Manual for TNS and TNS/R Programs522555-006
31-39
Changing the Creator ID
Changing the Creator ID
One reason the operating environment keeps track of the creator of a process is to be
able to notify a creator when a descendant process terminates. If process $PARENT
starts process $CHILD, the operating environment notifies $PARENT through the
$RECEIVE mechanism when $CHILD terminates.
It is possible for a third process, $THIRD, to instruct the operating environment to alter
the system tables to make $THIRD the recorded parent of $CHILD. $THIRD does this
by calling the PROCESS_SETINFO_ procedure. This operation is legal only if $THIRD
has the same process accessor ID as $CHILD; the $THIRD process has no explicit
control other than that. The fault-tolerant facility uses PROCESS_SETINFO_ to enable
each member of a process pair to be notified if the other terminates.
After $THIRD has called PROCESS_SETINFO_, any notification of $CHILD’s
termination is sent to $THIRD, rather than to $PARENT. Also, if $CHILD calls
PROCESS_GETINFO_, the operating environment reports back to $CHILD that
$THIRD is $CHILD’s creator. For more information about PROCESS_GETINFO_ or
PROCESS_SETINFO_, see the Guardian Procedure Calls Reference Manual.
Suspending a Process
A process might need to automatically suspend its execution. It might be a sampling
routine that wakes up, takes and records some measurements, and suspends itself for
a time. It might be a monitoring routine that wakes up every 10 minutes and checks
whether a specified terminal or a certain program is in use.
By calling the DELAY routine, a process can suspend its execution for a number of
hundredths of a second.
Example 31-17 uses suspension to watch for a remote system to become available so
it can send a message to a routine on the remote system.
Example 31-17. Suspending a Process (page1of2)
IDENTIFICATION DIVISION.
PROGRAM-ID. DOZER.
AUTHOR. BUFFY COBOL.
INSTALLATION. TRANSACTIONS ANONYMOUS.
DATE-WRITTEN. 29 FEBRUARY 1988.
DATE-COMPILED.
**************************************************************************
* This program sends one message to $BOSS on system \HQ. If that *
* process cannot be opened, the program tries again every five minutes. *
**************************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP TXP.
OBJECT-COMPUTER. HP TXP.