(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: GETJPI, next: GETSYI)


GETQUI - Get Queue Information


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

Format:

    import vms_quidef, vms_lib
    result = vms_lib.getqui (function_code, item_name, \
        search_number, search_name, search_flags)
Returns:
result
Return information requested from 'item_name'.
Arguments:
function_code
Text-string of function to perform (e.g. 'QUI$_CANCEL_OPERATION' or 'QUI$_DISPLAY_ENTRY').
item_name
Text-string of item to retrieve (e.g. 'QUI$_JOB_NAME').
search_number
Numeric value (e.g. an entry number) used to process the request. Use 'None' to signal an empty parameter.
search_name
Character string (e.g. a queue name) used to process the request.
search_flags
Optional bit mask. Constants are containted in the vms_quidef module (e.g. vms_quidef.QUI_M_SEARCH_ALL_JOBS).
special notes about some item codes:
QUI$_CHARACTERISTICS
A Python long integer. Warning! This is a 128-bit mask.
QUI$_CHARGE_CODE
Is an alias name to QUI$_ACCOUNT_NAME.
QUI$_FILE_IDENTIFICATION
Contains several information combined in a 28-byte 'string'.
@@Should be changed to a 'tuple of bytes', but GETQUI can't do that, yet.
Examples:
>>> import vms_lib
>>> import vms_quidef

>>> vms_lib.getqui ("QUI$_DISPLAY_ENTRY","QUI$_JOB_NAME",5)
'X2'
>>> vms_lib.getqui ("QUI$_DISPLAY_ENTRY","QUI$_PRIORITY",5)
100
>>> q_sbmtim = vms_lib.getqui ("QUI$_DISPLAY_ENTRY", \
...   "QUI$_SUBMISSION_TIME",9)
>>> import vms_sys
>>> vms_sys.asctim (q_sbmtim)
' 2-NOV-1997 19:30:55.49'
>>>

>>> vms_lib.getqui ("QUI$_DISPLAY_ENTRY","QUI$_NOTE",5)
''
>>> vms_lib.getqui ("QUI$_DISPLAY_ENTRY","QUI$_QUEUE_NAME",5)
'HERE_BACKUP'
>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_MANAGER_NAME",
...     None,"HERE_SYSTEM")
'SYS$QUEUE_MANAGER'
>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_PENDING_JOB_COUNT",
...     None,"HERE_SYSTEM")
0
>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_PENDING_JOB_COUNT",
...     None,"UUCP_BATCH")
2
>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_AUTOSTART_ON",None,
...     "HERE_SYSTEM")
''
>>> vms_lib.getqui ("QUI$_DISPLAY_ENTRY","QUI$_NOTE",9999)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (295386, '%JBC-E-NOSUCHENT, no such entry')

>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_PENDING_JOB_COUNT",
...    None,"NO-QUEUE")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (294970, '%JBC-E-NOSUCHQUE, no such queue')

>>> vms_lib.getqui ("BAD-FUNCTION")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 1: unknown QUI$_ function code

>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","BAD-ITEM")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 2: unknown QUI$_ item code

>>> vms_lib.getqui ("QUI$_NOTE","QUI$_NOTE",None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 1: not a QUI$_ request function code

>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_DISPLAY_QUEUE",None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 2: wrong QUI$_ item name for this argument

>>> vms_lib.getqui ("QUI$_DISPLAY_QUEUE","QUI$_MANAGER_NAME",sys,
...     "HERE_SYSTEM")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: search-number - must be integer or None

*** example of wildcard lookup ***

>>> import vms_quidef, vms_lib
>>> vms_lib.getqui ("QUI$_CANCEL_OPERATION")
>>> while 1:
...     queue_name = ''
...     try:
...         queue_name = vms_lib.getqui("QUI$_DISPLAY_QUEUE",
...           "QUI$_QUEUE_NAME",None,'*')
...     except vms_lib.error:
...         break
...     queue_desc = vms_lib.getqui("QUI$_DISPLAY_QUEUE",
...       "QUI$_QUEUE_DESCRIPTION",None,'*',
...       vms_quidef.QUI_M_SEARCH_FREEZE_CONTEXT)
...     print 'Queue:', queue_name, '<', queue_desc, '>'
...     while 1:
...         try:
...             js = vms_lib.getqui("QUI$_DISPLAY_JOB",
...                 "QUI$_JOB_STATUS",-1,'*',
...                 vms_quidef.QUI_M_SEARCH_ALL_JOBS)
...         except vms_lib.error:
...             break
...         jn = vms_lib.getqui("QUI$_DISPLAY_JOB",
...             "QUI$_JOB_NAME",-1,'*',
...             vms_quidef.QUI_M_SEARCH_ALL_JOBS+
...             vms_quidef.QUI_M_SEARCH_FREEZE_CONTEXT)
...         en = vms_lib.getqui("QUI$_DISPLAY_JOB",
...             "QUI$_ENTRY_NUMBER",-1,'*',
...             vms_quidef.QUI_M_SEARCH_ALL_JOBS+
...             vms_quidef.QUI_M_SEARCH_FREEZE_CONTEXT)
...         print 'Job:', jn, '(', en, ')'
... #end
...
Queue: BATQ_BACKUP <  >
Queue: BATQ_BATCH <  >
Job: Q ( 833 )
Job: Q ( 834 )
Queue: BATQ_RAYTRACE01 <  >
Queue: BATQ_RAYTRACE02 <  >
Queue: BATQ_SYSTEM <  >
Job: Q ( 832 )
Queue: HERE_BACKUP <  >
Queue: HERE_BATCH <  >
Queue: HERE_RAYTRACE01 < Raytracing, PRIO:1 >
Queue: HERE_RAYTRACE02 < Raytracing, PRIO:2 >
Queue: HERE_SYSTEM <  >
Queue: UUCP_BATCH < UUCP Daemons and Administrative Processing >
Job: UUXQT_BATCH ( 753 )
Job: UUXQT_BATCH ( 761 )
Job: UUXQT_BATCH ( 784 )
>>> vms_lib.getqui("QUI$_CANCEL_OPERATION")
>>> vms_lib.getqui("QUI$_CANCEL_OPERATION")
>>> queue_name = vms_lib.getqui("QUI$_DISPLAY_QUEUE",
...             "QUI$_QUEUE_NAME",None,'*')
>>> queue_name = vms_lib.getqui("QUI$_DISPLAY_QUEUE",
...             "QUI$_QUEUE_NAME",None,'*')
>>> print 'Queue:', queue_name, '<', queue_desc, '>'
Queue: BATQ_BATCH <  >
>>> # (queue does not have a description)
>>> vms_lib.getqui ("QUI$_CANCEL_OPERATION")
>>>

(go to: table of contents, index, list of vms_lib, prev: GETJPI, next: GETSYI)

09-JAN-1999 ZE.