vmsobj_lksb object

(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of VMS objects, prev: vmsobj_iosb, next: vmsobj_nam)

The vmsobj_lksb object is used to provide writeable(!) storage to OpenVMS system routines (like SYS$ENQW) that use an LKSB (LocK Status Block). This is necessary, because a regular Python object must not have its value changed.

A programmer can create multiple, independend vmsobj_lksb objects and use them in parallel.


Attributes:
W_STATUS
Read/write access to the first word (16-bit value) within the LKSB. This is also known as the 'condition value' field. Data type is a Python integer.
W_RESERVED
Readonly access to the second word within the LKSB. This field is reserved. Data type is a Python integer.
L_LOCKID
Read/write access to the second longword (32-bit value) within the LKSB. This is the identification of the lock. Data type is a Python integer. The first longword is divided into the W_STATUS and W_RESERVED fields.
O_LVB
Read/write access to the second quadword (64-bit value) within the LKSB. This is the lock value block. Data type is a Python long integer. The first quadword is divided into the W_STATUS, W_RESERVED and L_LOCKID fields.

Creation:

For now the 'pyvms' module contains a function to explicitly create a vmsobj_lksb object within Python. Note that interface routines (e.g. vms_sys.enqw) can implicitly create a vmsobj_lksb object!

The routine that allocates a new OpenVMS LKSB does automatically zero its contents. @@@

Examples:

>>> import pyvms

>>> # create a zero-filled lksb
>>>
>>> lksb = pyvms.vmsobj_lksb ()
>>> type (lksb)
<type 'vmsobj_lksb'>
>>> lksb
<vmsobj_lksb, LKSB at 0x00218530>
>>>

>>> lksb.b0
0
>>> lksb.w1
0
>>> lksb.l1
0
>>> lksb.q
0L
>>>

>>> lksb.b0 = 1
>>> lksb.w1 = 0x34
>>> lksb.l1 = 0xabcdef
>>>

>>> hex (lksb.w3)
'0xab'
>>> hex (lksb.l0)
'0x340001'
>>> hex (lksb.l1)
'0xabcdef'
>>> hex (lksb.q )
'0xABCDEF00340001L'
>>>

>>> lksb.b
(1, 0, 52, 0, 239, 205, 171, 0)
>>> lksb.w
(1, 52, 52719, 171)
>>> lksb.l
(3407873, 11259375)
>>> lksb.q
48358647401807873L
>>>


>>> lksb.b0 = 'X'
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: vms__cvt_py2bin(): data of item must be integer
>>>
>>> lksb.no_attr = 0
Traceback (innermost last):
  File "<stdin>", line 1, in ?
AttributeError: non-existing vmsobj_lksb attribute
>>>
>>> lksb.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_iosb, next: vmsobj_nam)

29-MAY-1999 ZE.