(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: GETDVI, next: GETQUI)


GETJPI - Get Job/Process Information


This routine allows the programmer to receive a single item of information from the specified process per call. The vms_sys.getjpiw() routine provides support to request multiple items at once at the expense of additional work to extract the data from the returned dictionary.

Note: the 'vms_jpidef' module contains bitmasks and constants that are defined in '$JPIDEF'. Access to the item codes ("JPI$_name") is possible via the 'pyvms' module.

Format:

    ctx_out, item_value = \
        vms_lib.getjpi (item_name, pid_ctx [,process_name])
Returns:
ctx_out
pid of the target process or a pid-context that can be used for the next step in a wildcard lookup
item_value
Return information requested from 'item_name'.
Arguments:
item_name
Text-string of item to retrieve (e.g. 'JPI$_BIOLM').
pid_ctx
PID of process to lookup or context-value for the next wildcard lookup.
process_name
Name of process to lookup. Note: normally pid_ctx overrides process_name! Use pid_ctx = 'None' to force usage of process_name.

special notes about some item codes:

JPI$_AUTHPRIV
The authorized privilege image mask is returned as an unsigned Python long integer. Usage of the privilege bitmasks is explained in GENMAN 'programming, processes, privileges'.
JPI$_CREPRC_FLAGS
Bitmask values (PRC_M_xxx) for this field are in module vms_prcdef.
JPI$_CURPRIV
The current privilege image mask is returned as an unsigned Python long integer. Usage of the privilege bitmasks is explained in GENMAN 'programming, processes, privileges'.
JPI$_EXCVEC
LIB$GETJPI returns only one longword.
JPI$_FINALEXC
LIB$GETJPI returns only one longword.
JPI$_IMAGPRIV
The image privilege image mask is returned as an unsigned Python long integer. Usage of the privilege bitmasks is explained in GENMAN 'programming, processes, privileges'.
JPI$_JOBTYPE
Constant values (JPI_K_xxx) for this field are in module vms_jpidef.
JPI$_LOGIN_FLAGS
Bitmask values (JPI_M_xxx) for this field are in module vms_jpidef.
JPI$_MODE
Constant values (JPI_K_xxx) for this field are in module vms_jpidef.
JPI$_PHDFLAGS
Bitmask values for this field are currently not available
JPI$_PROCPRIV
The process privilege image mask is returned as an unsigned Python long integer. Usage of the privilege bitmasks is explained in GENMAN 'programming, processes, privileges'.
JPI$_STATE
Constant values (SCH_C_xxx) for this field are in module vms_statedef.
JPI$_STS + JPI$_STS2
Bitmask values ($PCBDEF) for these fields are currently not available
JPI$_UAF_FLAGS
Bitmask values (UAI_M_xxx) for this field are in module vms_uaidef.
Examples:
>>> import vms_lib
>>> import vms_sys # ASCTIM

>>> pid, state = vms_lib.getjpi ('JPI$_STATE',0)
>>> pid, state
(232, 14)
>>> # this is vms_statedef.SCH_C_CUR

>>> vms_lib.getjpi ('JPI$_PRCNAM',65)
(65, 'SWAPPER')

>>> vms_lib.getjpi ('JPI$_PID',None,'DEST_PROC')
(1058, 1058)

>>> vms_lib.getjpi ('JPI$_PRCNAM',1058)
(1058, 'DEST_PROC')

>>> l_pid, q_lgitim = vms_lib.getjpi ('JPI$_LOGINTIM', 0)
>>> l_pid, q_lgitim
(341, 44135430131500000L)
>>> import vms_sys # ASCTIM
>>> vms_sys.asctim (q_lgitim)
'26-SEP-1998 16:10:13.15'

>>> vms_lib.getjpi ('JPI$_PID',1234)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> vms_lib.getjpi ('JPI$_PID',sys)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: process-id - must be integer or None

>>> vms_lib.getjpi ('JPI$_PID',None,None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (340, '%SYSTEM-F-IVLOGNAM, invalid logical name')

>>> vms_lib.getjpi ('JPI$_PID',None,sys)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: expected read-only buffer, module found

>>> vms_lib.getjpi ('JPI$_PID',None,1)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: expected read-only buffer, module found

*** example of wildcard lookup ***

>>> ctx = -1
>>> while 1:
...         ctx,pid = vms_lib.getjpi ('JPI$_PID',ctx)
...         x,pn = vms_lib.getjpi ('JPI$_PRCNAM',pid)
...         x,li = vms_lib.getjpi ('JPI$_LOGINTIM',pid)
...         print ctx,pid,pn,vms_sys.asctim(li)
... #-while
...
-65535 65 SWAPPER 17-NOV-1858 00:00:00.00
-65531 69 IPCACP 10-MAR-1996 13:23:00.36
-65530 70 ERRFMT 10-MAR-1996 13:23:02.14
[...]
-65527 73 JOB_CONTROL 10-MAR-1996 13:23:08.72
-65526 74 QUEUE_MANAGER 10-MAR-1996 13:23:09.25
-65525 75 SECURITY_SERVER 10-MAR-1996 13:23:12.84
Traceback (innermost last):
  File "<stdin>", line 2, in ?
vms_lib.error: (2472, '%SYSTEM-W-NOMOREPROC, no more processes')
>>>

(go to: table of contents, index, list of vms_lib, prev: GETDVI, next: GETQUI)

10-FEB-1999 ZE.