(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vmsobj, next: vmsobj_fab)

This section explains the use of 'VMS objects'.

'VMS objects' serve as an access means to complex data structures like FABs or RABs. The goal is to make as much functionality available as possible, but keeping the Python interpreter stable. For example, it is not possible to directly store an address in a data structure.


The components of a structure are accessible through the get- and set-attribute interfaces of the object. Beginning with version 1.5.2-V006 it is possible to view the attributes with Python's "dir()" function.

The dictionary that is internally used for this functionality, however, does not contain the data values - they are just "None" - and it is always recreated. The reason for this special restriction is that the list of names should just be used as a reminder - more detailled information MUST be taken from the OpenVMS documentation.

>>> import pyvms
>>>
>>> fab = pyvms.vmsobj_fab()
>>> dir (fab)
['B_ACMODES', 'B_BID', 'B_BKS', 'B_BLN', 'B_DNS', 'B_FAC', 'B_FNS',
...
', 'M_WCK', 'NAM', 'W_BLS', 'W_DEQ', 'W_GBC', 'W_IFI', 'W_MRS', 'XAB']
>>>
>>> dict = fab.__dict__
>>> print dict
{'M_RU': None, 'M_TMP': None, 'L_FOP': None, 'M_TRN': None,
...
'CTX': None, 'M_SHRPUT': None}
>>>
>>>
>>> membuf = pyvms.vmsobj__membuf(5)
>>> dir (membuf)
['buffer', 'size', 'zero']
>>>

Integer data types (Byte, Word, Long) can be accessed directly:

>>> # set FAB$L_ALQ
>>> fab.L_ALQ = 100
>>> print fab.L_ALQ
100
>>>

>>> # set FAB$B_BKS
>>> fab.B_BKS = 12
>>> print fab.B_BKS
12
>>>

Single bits can be directly set/cleared and queried by specifying the name as the attribute:

>>> # set FAB$M_GET
>>> fab.M_GET = 1
>>> print fab.M_GET
1
>>> print fab.B_FAC  # FAB$M_GET is in FAB$B_FAC
2
>>>

Other, more complex datatypes will be described together with the object.


(go to: table of contents, (go to: table of contents, index, list of vmsobj, next: vmsobj_fab)

19-DEC-1999 ZE.