(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: LP_LINES, next: PARSE_SOGW_PROT)


PARSE_ACCESS_CODE - Parse Access Encoded Name String

Format:
    status, access-mask, end-position = vms_lib.parse_access_code \
                (access-string, [access-names], ownership-category)
Returns:
status
Condition value as returned by LIB$PARSE_ACCESS_CODE.
access-mask
A 16-bit value in a Python integer.
end-position
Indicates the offending location when a parse error occured.
Arguments:
access-string
Each access name is abbreviated to one letter - e.g. "RWE".
access-names
Object of type 'vmsobj__access_names'.
ownership-category
See examples below and the RTL manual.
Examples:
>>> import vms_lib
>>> import vms_sys

>>> # define ownership categories
>>> own_cat_sys = 0x000f
>>> own_cat_own = 0x00f0
>>> own_cat_grp = 0x0f00
>>> own_cat_wld = 0xf000

>>> status, access_mask, end_position = \
...     vms_lib.parse_access_code ('S:RW', None, own_cat_sys)
>>> print status, access_mask, end_position
1409588 0 0
>>> print vms_sys.getmsg (status) [0]
%LIB-F-INVARG, invalid argument(s)
>>>


>>> print vms_lib.parse_access_code ('W',  None, own_cat_sys)
(1, 2, 1)
>>> print vms_lib.parse_access_code ('RW', None, own_cat_sys)
(1, 3, 2)
>>> print vms_lib.parse_access_code ('RW', None, own_cat_grp)
(1, 768, 2)
>>> print hex (768)
0x300
>>>

0x300
  ^^^
  ||\-- system
  |\--- owner
  \---- group


>>> status, access_mask, end_position = \
...     vms_lib.parse_access_code ('RWX', None, own_cat_sys)
>>> print status, access_mask, end_position
1409588 0 2
>>> print vms_sys.getmsg (status) [0]
%LIB-F-INVARG, invalid argument(s)
>>>


>>> accnam = vms_lib.get_accnam ()
>>> print accnam [0:4]
['READ', 'WRITE', 'EXECUTE', 'DELETE']
>>> accnam [0] = 'A'
>>> accnam [1] = 'B'
>>> accnam [2] = 'C'
>>> accnam [3] = 'D'
>>> print accnam [0:4]
['A', 'B', 'C', 'D']
>>>
>>> status, access_mask, end_position = \
...     vms_lib.parse_access_code ('AB', accnam, own_cat_sys)
>>> print status, access_mask, end_position
1 3 2
>>> status, access_mask, end_position = \
...     vms_lib.parse_access_code ('CD', accnam, own_cat_sys)
>>> print status, access_mask, end_position
1 12 2
>>>

(go to: table of contents, index, list of vms_lib, prev: LP_LINES, next: PARSE_SOGW_PROT)

12-AUG-1999 ZE.