COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
WHEN OTHER
IF SU-ERROR < 256
DISPLAY FUP-FAILED
" -- File management error #"
SU-ERROR
ELSE
* -- Received raw error from NEWPROCESS system procedure.
* -- Decompose it into left byte and right byte values.
DIVIDE SU-ERROR
BY 256
GIVING NEWPROCESS-ERR-LEFT
REMAINDER NEWPROCESS-ERR-RIGHT.
DISPLAY FUP-FAILED
" -- NEWPROCESS error # = ("
NEWPROCESS-ERR-LEFT
","
NEWPROCESS-ERR-RIGHT
")"
END-IF
END-EVALUATE
...
WATCH.
READ MESSAGE-IN-FILE.
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 315 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 315 Suspending a Process
IDENTIFICATION DIVISION.
PROGRAM-ID. DOZER.
AUTHOR. BUFFY COBOL.
942 Process Initiation, Communication, and Management










