(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: RUN_PROGRAM, next: SET_SYMBOL)


SET_LOGICAL - Set Logical Name


This routine is used to set a supervisor-mode logical name.

vms_lib.set_logical() does _not_ raise an exception when the LIB$SET_LOGICAL routine returns an error. You must check 'status' in the dictionary that is returned.

Format:

    dict = vms_lib.set_logical (logical-name, [value-string] [,table] \
            [,attributes] [,item-list])
Returns:
dict
A dictionary that has the following keys:
'status'
The condition value returned from LIB$SET_LOGICAL.
'LNM$_name'
Any output items that have been specified in the item-list and that are supported by LIB$SET_LOGICAL.

It is only put into the dictionary, when LIB$SET_LOGICAL returns a success status.

Arguments:
logical-name
Logical name to be defined or redefined.
value-string
Value to be given to the logical name. For multiple values use the item-list parameter.
table
Name of the table in which to create the logical name. If omitted, LNM$PROCESS is used.
attributes
Logical name or translation attributes. Please see the VMS documentation for details.
item-list
Item list describing the equivalence names for this logical name. You can also specify 'LNM$_TABLE' as an output item.
Examples:
>>> import vms_lib
>>> import os   # only for testing

>>> vms_lib.set_logical('LNM1','VAL1')
{'status': 1}   <-- return status from LIB$SET_LOGICAL
>>> os.system ('show logical /full LNM1')
   "LNM1" [super] = "VAL1" (LNM$PROCESS_TABLE)
1               <-- return status from os.system()
>>>


>>> vms_lib.set_logical('LNM2','VAL2','LNM$JOB')
{'status': 1}   <-- return status from LIB$SET_LOGICAL
>>> os.system('show logical /full LNM2')
   "LNM2" [super] = "VAL2" (LNM$JOB_814E0700)
1               <-- return status from os.system()
>>>


>>> import vms_lnmdef
>>> vms_lib.set_logical('LNM3','VAL3','LNM$JOB',vms_lnmdef.LNM_M_CONCEALED)
{'status': 1}   <-- return status from LIB$SET_LOGICAL
>>> os.system('show logical /full LNM3')
   "LNM3" [super] = "VAL3" [concealed] (LNM$JOB_814E0700)
1               <-- return status from os.system()
>>>


>>> vms_lib.set_logical('LNM3','VAL3','LNM$JOB',vms_lnmdef.LNM_M_CONCEALED+
... vms_lnmdef.LNM_M_TERMINAL)
{'status': 1585}  <-- return status from LIB$SET_LOGICAL
>>>
>>> import vms_sys
>>> vms_sys.getmsg (1585)[0]
'%SYSTEM-S-SUPERSEDE, logical name superseded'
>>>

* Note: the logical name LNM3 has been replaced


>>> vms_lib.set_logical('LNM5',None,'LNM$GROUP',None,
...   ( ('LNM$_ATTRIBUTES',vms_lnmdef.LNM_M_CONCEALED),
...     ('LNM$_STRING','S5A'),('LNM$_STRING','S5B')
...   )
... )
{'status': 1}   <-- return status from LIB$SET_LOGICAL
>>> os.system('show logical /full LNM5')
   "LNM5" [super] = "S5A" [concealed] (LNM$GROUP_010040)
        = "S5B" [concealed]
1               <-- return status from os.system()
>>>


>>> vms_lib.set_logical('LNM6',None,'LNM$GROUP',None,
...   ( ('LNM$_ATTRIBUTES',vms_lnmdef.LNM_M_CONCEALED),
...     ('LNM$_STRING','S6A'),
...     ('LNM$_ATTRIBUTES',0),
...     ('LNM$_STRING','S6B')
...   )
... )
{'status': 1}   <-- return status from LIB$SET_LOGICAL
>>> os.system('show logical /full LNM6')
   "LNM6" [super] = "S6A" [concealed] (LNM$GROUP_010040)
        = "S6B"
1               <-- return status from os.system()
>>>


>>> d = vms_lib.set_logical('LNM7',None,'LNM$GROUP',None,
...   ( ('LNM$_TABLE','X'),
...     ('LNM$_ATTRIBUTES',vms_lnmdef.LNM_M_CONCEALED),
...     ('LNM$_STRING','S7A'),
...     ('LNM$_ATTRIBUTES',vms_lnmdef.LNM_M_CONCEALED),
...     ('LNM$_STRING','S7B'),
...     ('LNM$_ATTRIBUTES',0),
...     ('LNM$_STRING','S7C')
...   )
... )
>>> d
{'LNM$_TABLE': 'LNM$GROUP_010040', 'status': 1}

-- 'LNM$_TABLE' is an output-item
-- 'status' is the condition value returned from LIB$SET_LOGICAL

>>> os.system('show logical /full LNM7')
   "LNM7" [super] = "S7A" [concealed] (LNM$GROUP_010040)
        = "S7B" [concealed]
        = "S7C"
1               <-- return status from os.system()
>>>

>>> vms_lib.set_logical('LNM8',None,'LNM$GROUP',None,
...   ( ('LNM$_ACMODE',3),
...     ('LNM$_ATTRIBUTES',vms_lnmdef.LNM_M_CONCEALED),
...     ('LNM$_STRING','S7A'),
...     ('LNM$_ATTRIBUTES',0),
...     ('LNM$_STRING','S7B')
...   )
... )
{'status': 20}  <-- return status from LIB$SET_LOGICAL
>>>
>>> import vms_sys
>>> vms_sys.getmsg (20)[0]
'%SYSTEM-F-BADPARAM, bad parameter value'
>>>

(go to: table of contents, index, list of vms_lib, prev: RUN_PROGRAM, next: SET_SYMBOL)

17-OCT-1998 ZE.