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

MOVE RIGHT-BYTE OF CONSECUTIVE-BYTES TO NUMERIC-RIGHT-BYTE.
MOVE BYTE-AS-NUMBER TO CREATOR-MEMBER.
MOVE PROCESS-ACCESSOR-ID TO BYTE-PAIR.
MOVE LEFT-BYTE OF CONSECUTIVE-BYTES TO NUMERIC-RIGHT-BYTE.
MOVE BYTE-AS-NUMBER TO PROCESS-GROUP.
MOVE RIGHT-BYTE OF CONSECUTIVE-BYTES TO NUMERIC-RIGHT-BYTE.
MOVE BYTE-AS-NUMBER TO PROCESS-MEMBER.
Search Mode
The PROCESS_GETINFOLIST_ routine lets you search for a process that meets one or more of these
criteria:
Has a specified process ID
Has a specified creator accessor ID
Has a specified process accessor ID
Has a specified home terminal
Has a priority not greater than a specified priority
Came from a specified loadfile name
For example, you can search for a process that is running at a priority of less than 40, has $THIRTY
as its home terminal, and was loaded from loadfile $MEDIUM.PEPPER.STEAK.
Using search mode, you can implement processes for such tasks as determining whether a certain
named process is running, identifying processes that are running at inappropriate priorities, or
determining whether a process is using a certain terminal.
The only required parameter is the 2-byte binary item containing a processor and PIN value. The
routine uses this to determine where to start its search. The remaining parameters can be present
or specified as OMITTED. The values to be matched in the search are specified by the same
parameters the operating environment is to use to return the values appropriate to the process it
finds.
In Example 312, an HP COBOL program finds and reports all processes on its system that have
the same process accessor ID as the program.
Example 312 Reporting Processes With Program’s Accessor ID
IDENTIFICATION DIVISION.
PROGRAM-ID. WHAT-AM-I-DOING.
AUTHOR. BRINDLEY COBOL.
INSTALLATION. TRANSACTIONS ANONYMOUS.
DATE-WRITTEN. 29 FEBRUARY 1988.
DATE-COMPILED.
*****************************************************************
* This program hunts out and reports all processes owned by *
* the current user. *
*****************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP TXP.
OBJECT-COMPUTER. HP TXP.
DATA DIVISION.
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.
01 NUMERIC-CPU PIC S9(2) COMPUTATIONAL.
01 NUMERIC-PIN NATIVE-2.
01 BYTE-PAIR PIC S9(4) COMP.
01 CONSECUTIVE-BYTES REDEFINES BYTE-PAIR.
Managing a Process 935