(go to: table of contents, index, list of vms_sys, prev: FILESCAN, next: FIND_HOLDER)
Format:
FIND_HELD - Find Identifiers Held by User
Returns the identifiers held by a specified holder.
27-SEP-1998 ZE.
id, attrib, fnd_ctx = vms_sys.find_held (holder [,contxt])
Returns:
Arguments:
Examples:
The Python function only accepts a tuple of 2 integers - not a quadword
represented by a Python long integer. For OpenVMS V6.1 the first element is the
holder's UIC identifier, the second element must be 0. Check the system services
reference manual for your version of OpenVMS.
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_2 SYSTEM /attributes=dynamic
%UAF-I-GRANTMSG, identifier ID_2 granted to SYSTEM
UAF> show /identifier /full ID_1
Name Value Attributes
ID_1 %X80010011 RESOURCE
Holder Attributes
SYSTEM RESOURCE
UAF> show /identifier /full ID_2
Name Value Attributes
ID_2 %X80010012 DYNAMIC
Holder Attributes
SYSTEM DYNAMIC
UAF>
>>> import vms_sys
>>> uic = 0x10004 # SYSTEM has UIC [1,4]
>>> id, attrib, fnd_ctx = vms_sys.find_held ((uic,0), None)
>>> id, attrib, fnd_ctx
(-2147418095, 1, 0)
>>>
>>> # idtoasc() can be used, but a second context MUST be supplied or
>>> # the current context is destroyed!
>>> namlen, nambuf, resid, attrib, id_ctx = vms_sys.idtoasc (id,0)
>>> nambuf
'ID_1'
>>> fnd_ctx, id_ctx # FIND_HELD and IDTOASC contexts
(0, 1) # can be different if other contexts are active
>>> vms_sys.finish_rdb (id_ctx) # clear idtoasc context
0
>>> # Note: there is no sign that [1,4] has more identifiers
>>> # granted - a loop (as shown below) must be used
>>> vms_sys.finish_rdb (fnd_ctx)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (316, '%SYSTEM-F-IVCHAN, invalid I/O channel')
>>> # Note: no context was established
>>> uic = 0x10004 # SYSTEM is UIC [1,4]
>>> contxt = 0 # initialize context
>>> id, attrib, fnd_ctx = vms_sys.find_held ((uic,0), contxt)
>>> id, attrib, fnd_ctx
(-2147418095, 1, 1)
>>> print hex (id)
0x80010011 <-- this is ID_1
>>> namlen, nambuf, resid, attrib, id_ctx = vms_sys.idtoasc (id, 0)
>>> nambuf
'ID_1'
>>> fnd_ctx, id_ctx # FIND_HELD and IDTOASC contexts
(1, 2) # can be different if other contexts are active
>>> vms_sys.finish_rdb (id_ctx) # clear IDTOASC context
0
>>> import vms_kgbdef
>>> print attrib, vms_kgbdef.KGB_M_RESOURCE
1 1
>>>
>>> # next call to FIND_HELD
>>> contxt = fnd_ctx
>>> id, attrib, fnd_ctx = vms_sys.find_held ((uic,0), contxt)
>>> id, attrib, fnd_ctx
(-2147418094, 2, 1)
>>> print hex (id)
0x80010012 <-- this is ID_2
>>> print attrib, vms_kgbdef.KGB_M_DYNAMIC
2 2
>>>
>>> # next call to FIND_HELD
>>> contxt = fnd_ctx
>>> id, attrib, fnd_ctx = vms_sys.find_held ((uic,0), contxt)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>> # SS$_NOSUCHID signals the end of the search loop
>>> # it is not necessary to call FINISH_RDB in his situation
>>> vms_sys.finish_rdb (fnd_ctx)
0 <-- the context has been cleared
>>> uic = 0x20003 # no grants on UIC [2,3]
>>> id, attrib, fnd_ctx = vms_sys.find_held ((uic,0), None)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>>
>>> id_check = 0x80000001 # this is a rights identifier
>>> id, attrib, fnd_ctx = vms_sys.find_held ((id_check,0))
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (8740, '%SYSTEM-F-IVIDENT, invalid identifier format')
>>>
(go to: table of contents,
index,
list of vms_sys,
prev: FILESCAN,
next: FIND_HOLDER)