Python on OpenVMS
(go to: table of contents, index,
list of VMS objects,
prev: vmsobj_lksb,
next: vmsobj_rab)
The vmsobj_nam object provides high-level access to an OpenVMS NAM (NAMe 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_NAM.C)
nor will it explain the use of each field in a NAM.
The 'vms_namdef' module contains bitmasks and
constants that apply to an OpenVMS NAM.
Attributes:
Most BWL,M attributes can be directly read and written as shown in the
introduction. Exceptions are noted below:
- DEV
- Readonly access to the device name from the
"ESA" or
"RSA" buffers.
"B_DEV" returns the length and "L_DEV"
returns the memory address of the string.
- W_DID
- The directory identification is read / written as a 3-item 16-bit integer
tuple. Additional attributes to access part of the DID are available:
"W_DID_NUM", "W_DID_SEQ", "W_DID_RVN", "B_DID_RVN", "B_DID_NMX".
- DIR
- Readonly access to the directory name from the
"ESA" or
"RSA" buffers.
"B_DIR" returns the length and "L_DIR"
returns the memory address of the string.
- DVI
- Readonly access to the device identification field in the OpenVMS NAM.
Internally, this is an ASCIC field, but the interface routine returns
a simple Python string without the length byte.
- ESA
- Read/write access to the expanded string area. The buffer space is hidden
behind a 'vmsobj__membuf'
object.
On a read access the field NAM$B_ESL determines the returned string length,
because this field is written by RMS. The field NAM$B_ESS is set, when a
vmsobj__membuf object is assigned to the "ESA" attribute.
"L_ESA" returns the memory address of the string buffer.
"B_ESS" returns the buffer size and "B_ESL"
returns the resulting string size as set by RMS.
- W_FID
- The file identification is read / written as a 3-item 16-bit integer
tuple. Additional attributes to access part of the FID are available:
"W_FID_NUM", "W_FID_SEQ", "W_FID_RVN", "B_FID_RVN", "B_FID_NMX".
- NAME
- Readonly access to the file name from
"ESA" or
"RSA" buffers.
"B_NAME" returns the length and "L_NAME"
returns the memory address of the string.
- NODE
- Readonly access to the node name from the
"ESA" or
"RSA" buffers.
"B_NODE" returns the length and "L_NODE"
returns the memory address of the string.
- RLF
- Related file processing is done with a second 'vmsobj_nam' object
connected to this attribute.
"L_RLF" returns the memory address of the next OpenVMS NAM.
- RSA
- Read/write access to the resultant string area. The buffer space is hidden
behind a 'vmsobj__membuf'
object.
On a read access the field NAM$B_RSL determines the returned string length,
because this field is written by RMS. The field NAM$B_RSS is set, when a
'vmsobj__membuf' object is assigned to the "RSA" attribute.
"L_RSA" returns the memory address of the string buffer.
"B_RSS" returns the buffer size and "B_RSL"
returns the resulting string size as set by RMS.
- TYPE
- Readonly access to the file type from the
"ESA" or
"RSA" buffers.
"B_TYPE" returns the length and "L_TYPE"
returns the memory address of the string.
- VER
- Readonly access to the file version from the
"ESA" or
"RSA" buffers.
"B_VER" returns the length and "L_VER"
returns the memory address of the string.
Creation:
For now the 'pyvms' module contains a function to
explicitly create a vmsobj_nam object within Python.
Examples:
>>> import pyvms
>>> # create a vmsobj_nam object
>>>
>>> nam = pyvms.vmsobj_nam ()
>>> type (nam)
<type 'vmsobj_nam'>
>>> nam
<vmsobj_nam, NAM at 0x001acbf8>
>>>
>>> # invalid attribute access
>>> nam.no_attr = 0
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: non-existing vmsobj_nam attribute
>>> nam.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_lksb,
next: vmsobj_rab)
11-FEB-1999 ZE.