(go to: table of contents, index, list of VMS objects, prev: vmsobj_xabitm, next: vmsobj_xabpro)
The 'vms_xabkeydef' module contains constants
and bitmasks that apply to an OpenVMS XABKEY.
Most BWLQ,M attributes can be directly read and written as shown in the
introduction. Exceptions are noted below:
Attributes dealing with collating sequences are not available.
"L_COLNAM", "L_COLSIZ" and
"L_COLTBL" are readonly.
For now the 'pyvms' module contains a function to
explicitly create a vmsobj_xabkey object within Python.
Examples:
Attributes:
>>> xabkey = pyvms.vmsobj_xabkey ()
>>> type (xabkey)
<type 'vmsobj_xabkey'>
>>>
>>> keyname = 'Key-1'
>>> xabkey.KNM = keyname
>>>
>>> xabkey.L_KNM
1991364
>>> xab_knm = xabkey.KNM
>>> keyname, xab_knm
('Key-1', 'Key-1')
>>> print id (keyname), id (xab_knm)
2233912 2233704
>>> # -> different ids indicate different string objects
>>> xabkey.KNM = None
>>> xab_knm = xabkey.KNM
>>> xab_knm
''
>>> # -> a string is always returned
>>> xabkey.L_KNM
0
>>>
>>> xabkey.KNM = 0
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: attribute must be string or None
>>>
>>> xabkey.L_KNM = 2
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: read-only vmsobj_xabkey attribute
>>>
>>> xabkey = pyvms.vmsobj_xabkey ()
>>> type (xabkey)
<type 'vmsobj_xabkey'>
>>>
>>> print xabkey.NXT
None
>>> print xabkey.L_NXT
0
>>>
>>> # this example uses a XABALL
>>> xaball = pyvms.vmsobj_xaball ()
>>> type (xaball)
<type 'vmsobj_xaball'>
>>>
>>> xabkey.NXT = xaball
>>> xaball
<vmsobj_xaball, XABALL at 0x00221568>
>>> xabkey.NXT
<vmsobj_xaball, XABALL at 0x00221568>
>>> hex (xabkey.L_NXT)
'0x221568'
>>>
>>> xabkey.NXT = None
>>> print xabkey.NXT
None
>>> xabkey.L_NXT
0
>>>
>>> xabkey.NXT = 0
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: must be a XABxxx object or None
>>>
>>> xabkey.L_NXT = 2
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: read-only vmsobj_xabkey attribute
>>>
Creation:
>>> import pyvms
>>> # create a vmsobj_xabkey object
>>>
>>> xabkey = pyvms.vmsobj_xabkey ()
>>> type (xabkey)
<type 'vmsobj_xabkey'>
>>> xabkey
<vmsobj_xabkey, XABKEY at 0x00221668>
>>>
>>> # invalid attribute access
>>> xabkey.no_attr = 0
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: non-existing vmsobj_xabkey attribute
>>> xabkey.no_attr
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: no_attr
>>>
...
@@