COBOL Manual for TNS and TNS/R Programs
Process Initiation, Communication, and
Management
HP COBOL Manual for TNS and TNS/R Programs—522555-006
31-23
Determining the Node (System Number)
A process can obtain its process ID by passing its process number to the
PROCESSHANDLE_DECOMPOSE_ procedure, which returns the processor and PIN
values as separate integer values. If you do not know the process number, you can get
it by calling the PROCESSHANDLE_GETMINE_ procedure.
Determining the Node (System Number)
When NonStop systems are linked together through Expand to constitute a network,
each system (or node) of the network has a system number. If copies of a process are
running on different nodes, the process might need to determine the system number of
the system on which it is running. The process might report diagnostic messages to a
central log and include its system name, number, or both.
A process can obtain the system number of the system on which it is running by calling
the routines PROCESSHANDLE_GETMINE_, PROCESSHANDLE_DECOMPOSE_,
and NODENUMBER_TO_NODENAME_, as Example 31-11 shows.
Example 31-10. PROCESSHANDLE_GETMINE_ and
PROCESSHANDLE_DECOMPOSE_ Procedures
WORKING-STORAGE SECTION.
01 PROCESS-HANDLE PIC X(20).
01 CPU-PIN.
05 CPU PIC S9(2) COMPUTATIONAL.
05 PIN NATIVE-2.
01 ERROR-NUMBER PIC S9(5) COMPUTATIONAL.
01 NULL-PH PIC X(20) VALUE ALL HIGH-VALUES.
...
PROCEDURE DIVISION.
...
ENTER TAL "PROCESSHANDLE_GETMINE_"
USING PROCESS-HANDLE
GIVING ERROR-NUMBER
ENTER TAL "PROCESSHANDLE_DECOMPOSE_"
USING PROCESS-HANDLE
CPU
PIN
GIVING ERROR-NUMBER
Example 31-11. Determining a Process’s Node (System Number) (page 1 of 2)
IDENTIFICATION DIVISION.
PROGRAM-ID. WHERE-AM-I.
AUTHOR. BECK COBOL.
INSTALLATION. TRANSACTIONS ANONYMOUS.
DATE-WRITTEN. 29 FEBRUARY 1988.
DATE-COMPILED.