(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: GETJPIW, next: GETTIM)


GETMSG - Get Message


Format:
    bufadr, outadr = vms_sys.getmsg (msgid [,flags])
Returns:
bufadr
The message string.
outadr
Optional information returned by SYS$GETMSG. This is a 4-byte tuple.
Byte 0
Reserved.
Byte 1
Count of FAO arguments associated with message.
Byte 2
User-specified value in message, if any.
Byte 3
Reserved.
Arguments:
msgid
Condition value to be translated - a Python integer.
flags
A Python integer which indicates what message components are to be returned. See the system services reference manual that explains which bit affects which component.
Examples:
>>> import vms_sys

>>> bufadr, outadr = vms_sys.getmsg(0xc)
>>> bufadr, outadr
('%SYSTEM-F-ACCVIO, access violation, reason mask=!XB, virtual\
 address=!XL,PC=!XL, PSL=!XL', (0, 4, 0, 0))
>>> # 4 FAO arguments -------------^ (!XB, !XL !XL !XL)

>>> bufadr, outadr = vms_sys.getmsg(0x2c)
>>> bufadr, outadr
('%SYSTEM-F-ABORT, abort', (0, 0, 0, 0))
>>> # no FAO argument ---------^

>>> # get only the message text (standard Python functionality)
>>> vms_sys.getmsg(0x2c)[0]
'%SYSTEM-F-ABORT, abort'
>>>

>>> # omit argument 2, use process default-v
>>> bufadr, outadr = vms_sys.getmsg (0x2c, None)
>>> bufadr
'%SYSTEM-F-ABORT, abort'
>>>

>>> # omit argument 2, use process default-v
>>> bufadr, outadr = vms_sys.getmsg (0x2c, 0)
>>> bufadr
'%SYSTEM-F-ABORT, abort'
>>>
$ set MESSAGE /noSEVERITY /noTEXT
$ python
[...]
>>> import vms_sys
>>> bufadr, outadr = vms_sys.getmsg(0x2c, 0)
>>> bufadr
'%SYSTEM-ABORT'
>>>
$ set MESSAGE /SEVERITY /TEXT


>>> # use flags argument to define which component to show
>>> bufadr, outadr = vms_sys.getmsg(0x2c, 5)
>>> bufadr
'%F, abort'
>>> bufadr, outadr = vms_sys.getmsg(0x2c, 10)
>>> bufadr
'%SYSTEM-ABORT'
>>> # the following names for the bits of the 'flags' argument
>>> #   are 'artifically' constructed
>>> GETMSGFLG_M_TXT      = 1
>>> GETMSGFLG_M_MESSAGE  = 2
>>> GETMSGFLG_M_SEVERITY = 4
>>> GETMSGFLG_M_FACILITY = 8
>>> flags = GETMSGFLG_M_FACILITY + \
...         GETMSGFLG_M_SEVERITY + \
...         GETMSGFLG_M_TXT
>>> bufadr, outadr = vms_sys.getmsg(0x2c, flags)
>>> bufadr
'%SYSTEM-F, abort'
>>>


>>> vms_sys.getmsg ('X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation
>>> vms_sys.getmsg (1,'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: flags - must be integer or None
>>>

(go to: table of contents, index, list of vms_sys, prev: GETJPIW, next: GETTIM)

17-OCT-1998 ZE.