(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: HIBER, next: INIT_VOL)


IDTOASC - Translate Identifier to Identifier Name


Translates the specified identifier value to its identifier name.

Format:

    nambuf, resid, attrib, fnd_ctx = \
        vms_sys.idtoasc (id [,contxt])
Returns:
nambuf
Identifier name text string.
resid
Identifier value of the identifier name returned in 'nambuf'.
attrib
Mask of attributes associated with the holder record specified by holder. Bitmask values are defined in module 'vms_kgbdef'.
fnd_ctx
Context value after the call to IDTOASC. This value must be fed unchanged into the 'contxt' argument on the next call. A value is always returned, even if the 'contxt' argument is omitted.
Arguments:
id
Binary identifier value to be translated. -1 indicates a wildcard search.
contxt
Context value used when repeatedly calling IDTOASC. See the system services reference manual for more information.
Examples:
UAF> add /identifier ID_1 /attributes=resource
%UAF-I-RDBADDMSG, identifier ID_1 value %X80010011 added to rights \
 database
UAF> add /identifier ID_2 /attributes=dynamic
%UAF-I-RDBADDMSG, identifier ID_2 value %X80010012 added to rights \
 database
UAF> grant /identifier ID_1 SYSTEM /attributes=resource
%UAF-I-GRANTMSG, identifier ID_1 granted to SYSTEM
UAF> grant /identifier ID_1 ZESSIN /attributes=resource
%UAF-I-GRANTMSG, identifier ID_1 granted to ZESSIN
UAF> show /identifier /full ID_1
  Name                             Value           Attributes
  ID_1                             %X80010011      RESOURCE
    Holder                           Attributes
    SYSTEM                           RESOURCE
    ZESSIN                           RESOURCE
UAF>


>>> import vms_sys

>>> def show_uic (uic_value):
...   high_word = uic_value / 65536
...   low_word  = uic_value - (high_word * 65536)
...   # Note: [1:], because octal values will be preceeded by '0'
...   uic_string = \
...     '[' + oct(high_word)[1:] + ',' + oct(low_word)[1:]  + ']'
...   print uic_string
...
>>>


>>> id = 0x80010011    # identifier ID_1
>>> nambuf, resid, attrib, fnd_ctx = \
...     vms_sys.idtoasc (id, None)
>>> nambuf, resid, attrib, fnd_ctx
('ID_1', -2147418095, 1, 0)
>>> print hex (-2147418095)
0x80010011
>>>
>>> import vms_kgbdef
>>> print attrib, vms_kgbdef.KGB_M_RESOURCE
1 1
>>>


>>> id = 0x10004        # UIC [1,4]
>>> nambuf, resid, attrib, fnd_ctx = \
...     vms_sys.idtoasc (id, None)
>>> nambuf, resid, attrib, fnd_ctx
('SYSTEM', 65540, 0, 0)
>>> show_uic (resid)
[1,4]
>>>


>>> id      = -1  # do a wildcard lookup
>>> context = 0
>>> while (1):
...   nambuf, resid, attrib, fnd_ctx = \
...     vms_sys.idtoasc (id, context)
...   print nambuf
...   context = fnd_ctx
...
BATCH
DECNET
DECWINDOWS
DEFAULT
DIALUP
FAL$SERVER
FIELD
[...]
VPM$SERVER
ZESSIN
Traceback (innermost last):
  File "<stdin>", line 2, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>> # this loop intentionally aborted by an exception
>>> # Note: it is not necessary to release the context with a call
>>> #       to FINISH_RDB because the loop ran to completion
>>>

(go to: table of contents, index, list of vms_sys, prev: HIBER, next: INIT_VOL)

28-SEP-1998 ZE.