vmsobj_xabkey object

(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of VMS objects, prev: vmsobj_xabitm, next: vmsobj_xabpro)

The vmsobj_xabkey object provides high-level access to an OpenVMS XABKEY (KEY XAB (eXtended Attribute Block)) data structure. You DO need access to the 'OpenVMS Record Management Services Reference Manual'! The PYVMS documentation will neither list all possible attributes (although you can find them by looking into the file VMSOBJ_XABKEY.C) nor will it explain the use of each field in a XABKEY.

The 'vms_xabkeydef' module contains constants and bitmasks that apply to an OpenVMS XABKEY.


Attributes:

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.

KNM
Read/write access for the KeyNaMe attribute - maximum string length is 15 characters. The string is internally copied to a separate area that builds a counted ASCII (ASCIC) string. The readonly attribute "L_KNM" returns the memory address of the OpenVMS ASCIC that describes this string.
>>> 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
>>>

NXT
Read/write access for a(nother) vmsobj_xabXXX object. The readonly attribute "L_NXT" returns the memory address of the OpenVMS XAB that was connected to the XABKEY. Remember that each XAB contains a "NXT" / "L_NXT" attribute to build a chain of multiple XABs.
>>> 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:

For now the 'pyvms' module contains a function to explicitly create a vmsobj_xabkey object within Python.

Examples:

>>> 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
>>>
... @@
(go to: table of contents, index, list of VMS objects, prev: vmsobj_xabitm, next: vmsobj_xabpro)

25-FEB-1999 ZE.