COBOL Manual for TNS/E Programs (H06.03+)

Process Initiation, Communication, and
Management
HP COBOL Manual for TNS/E Programs520347-003
31-21
Determining the Node (System Number)
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-10 shows.
Example 31-9. 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-10. 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.
*************************************************************
* This program obtains and reports its own system number *
* and system name. *
*************************************************************