COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
OMITTED
OMITTED
GIVING ERROR-RETURN.
IF ERROR-RETURN < 2
* Found a match
PERFORM REPORT-A-MATCH
ADD 1 TO CPU-PIN
ELSE
IF ERROR-RETURN = 2
* No more on current CPU
PERFORM INCREMENT-CPU-OR-QUIT
ELSE
IF ERROR-RETURN < 99
* CPU not configured or incommunicado
PERFORM INCREMENT-CPU-OR-QUIT
ELSE
DISPLAY "INTERNAL ERROR IN PARAMETERS"
STOP RUN.
REPORT-A-MATCH.
PERFORM EDIT-CPU-PIN.
DISPLAY "(" NUMERIC-CPU "," NUMERIC-PIN ") "
PROCESS-EDITED " "
PRIORITY " ".
DISPLAY PROGRAM-FILE-NAME " "
HOME-TERMINAL " ".
EDIT-CPU-PIN.
MOVE CPU-PIN TO BYTE-PAIR.
PERFORM SEPARATE-BYTE-PAIR.
MOVE NUMERIC-LEFT-BYTE TO NUMERIC-CPU.
MOVE NUMERIC-RIGHT-BYTE TO NUMERIC-PIN.
EDIT-ACCESSOR-ID.
MOVE PROCESS-ACCESSOR-ID TO BYTE-PAIR.
PERFORM SEPARATE-BYTE-PAIR.
MOVE NUMERIC-LEFT-BYTE TO PROCESS-GROUP.
MOVE NUMERIC-RIGHT-BYTE TO PROCESS-MEMBER.
SEPARATE-BYTE-PAIR.
MOVE LOW-VALUES TO SEPARATED-BYTES.
MOVE LEFT-BYTE OF CONSECUTIVE-BYTES TO LEFT-LOW-BYTE OF SEPARATED-BYTES.
MOVE RIGHT-BYTE OF CONSECUTIVE-BYTES TO RIGHT-LOW-BYTE OF SEPARATED-BYTES.
INCREMENT-CPU-OR-QUIT.
IF CURRENT-CPU < 15
ADD 1 TO CURRENT-CPU
MOVE CURRENT-CPU TO BINARY-WORKTABLE
MULTIPLY 256 BY BINARY-WORKTABLE
MOVE BINARY-WORKTABLE TO CPU-PIN
ELSE
DISPLAY "------------------------------"
STOP RUN.
Identifying the Creator
A process can use the PROCESS_GETINFO_ routine to determine the identity of the process that
created it, which enables the process to be selective. It can terminate if it was created by an
inappropriate agent. It can open different files depending on the identity of its creator. It can send
messages to its creator explicitly. It can even suspend or stop its creator if its process accessor ID
matches its creator’s creator accessor ID.
When you issue a RUN command, such as RUN X, your TACL process initiates the specified
process. The process produced from loadfile X has the TACL process as its creator.
In addition, suppose your process uses CLU_PROCESS_CREATE_ to initiate a new process. The
child process can discover the identity of its parent process, if the child is not running as a process
pair (in that case, the parent of the primary process is the backup process).
Example 313 uses the PROCESS_GETINFO_ routine to report the identity of its creator to its home
terminal. To handle the possibility of an unnamed process, the example uses the same mechanism
to decipher its creator’s process name that is used in WHO-SENT-THAT in Identifying the Message
Source (page 930). After identifying its creator process, the example determines whether it can stop
its creator; if it can, it does.
Managing a Process 937










