(go to: table of contents, index, list of vms_sys, prev: FORMAT_ACL, next: GETMSG)
It is only put into the dictionary, when SYS$GETJPIW returns a success status.
A 'counted ASCII string' (ASCIC) - which means that the first byte contains
the string length - is returned as a normal string (one without the count byte
at the beginning). You can use Python's len() function to find out how long
the returned string is.
Note that vms_sys.process_scan()
can be used to establish a context to select a subset of processes.
It is possible to put an item tuple - e. g.: ('JPI$_PRCNAM',None) - instead
of a single string - e. g.: 'JPI$_PRCNAM' -, but this is not required for
output-only items.
The Python interface routine expects a
vmsobj_iosb object. If the programmer specifies
'None' for the iosb argument, then the interface routine automatically
generates a vmsobj_iosb object, passes the OpenVMS IOSB to SYS$GETJPIW and
returns the object in 'dict'!
GETJPIW - Get Job/Process Information
This routine allows the programmer to receive a single or several items of
information per call from the specified process.
The vms_lib.getjpi() routine provides support
for only a single item, but uses a much simpler interface.
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:
12-JUN-1999 ZE.
dict = vms_sys.getjpiw ([efn] [,pidadr] [,prcnam], itmlst \
[,iosb] [,astadr] [,astprm])
Returns:
Arguments:
Note that the 'data' that is returned can itself be a tuple for some
items - see below.
Examples:
>>> import vms_sys
>>> # Note: no IOSB is specified, but the interface routine creates
>>> # one anyway and returns it in 'dict'.
>>> itmlst = ( ('JPI$_PRCNAM',), ('JPI$_ACCOUNT',) )
>>> # pidadr = 0 means current process
>>> # v
>>> dict = vms_sys.getjpiw (None, 0, None, itmlst)
>>> for key in dict.keys():
... print key, '=', dict.get(key)
... #-for
...
JPI$_PRCNAM = ZESSIN_FTA14
pidadr = 341 <-- the real PID is always returned
iosb = <vmsobj_iosb, IOSB at 0x00218bd8>
JPI$_ACCOUNT = HOME
status = 1
>>>
>>> # 'status' only tells if $GETJPIW was started successfully
>>> status = dict.get ('status')
>>> print status
1
>>> print vms_sys.getmsg (status)
('%SYSTEM-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>>
>>> # The final status code of $GETJPIW is in the first longword
>>> # of the iosb (I/O status block).
>>> iosb = dict.get ('iosb')
>>> status_final = iosb.l0
>>> print status_final
1
>>> print vms_sys.getmsg (status_final)
('%SYSTEM-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>>
>>> # Create an iosb object and pass it to the interface routine -
>>> # the same object will be returned in 'dict'.
>>> import pyvms
>>> iosb = pyvms.vmsobj_iosb()
>>>
>>> itmlst = ( ('JPI$_PRCNAM',), ('JPI$_ACCOUNT',) )
>>> dict = vms_sys.getjpiw (None, 0, None, itmlst, iosb)
>>> for key in dict.keys():
... print key, '=', dict.get(key)
... #-for
...
JPI$_PRCNAM = ZESSIN_FTA14
pidadr = 341
iosb = <vmsobj_iosb, IOSB at 0x0021c208>
JPI$_ACCOUNT = HOME
status = 1
>>>
>>> # same id means same object
>>> id (iosb)
2209888
>>> dict_iosb = dict.get('iosb')
>>> id (dict_iosb)
2209888
>>>
>>> itmlst = ( ('JPI$_PRCNAM',), ('JPI$_ERR',) )
>>> dict = vms_sys.getjpiw (None, 0, None, itmlst)
Traceback (innermost last):
File "<stdin>", line 1, in ?
ValueError: itmlst - unknown item code: JPI$_ERR
>>>
>>> itmlst = ( ('JPI$_PRCNAM',), ('JPI$_ACCOUNT',) )
>>>
>>> # vmsobj_iosb or None expected -----------------v
>>> dict = vms_sys.getjpiw (None, 0, None, itmlst, 'X')
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 5: iosb - must be vmsobj_iosb or None
>>>
@@ more vms_sys.getjpiw() examples
>>>
(go to: table of contents,
index, list of vms_sys,
prev: FORMAT_ACL,
next: GETMSG)