(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: FREE_EF, next: GETJPI)


GETDVI - Get Device/Volume Information


Format:
    item_value = vms_lib.getdvi \
        (item_name, channel_number [,device_name])
Returns:
item_value
Return information requested from 'item_name'. Note: this can be an integer _or_ a string value. 'Boolean' values (TRUE/FALSE) are returned as integers 1/0.
Arguments:
item_name
Text-string of item to retrieve (e.g. 'DVI$_OWNUIC'). This is the primary device characteristic.

One must specifiy a tuple here (e.g. ('DVI$_DEVTYPE',1)), to request the secondary device characteristic. The first element of the tuple is the item code. The second element of the tuple is the value 1 (=DVI$M_SECONDARY). This value is logically OR-ed with the binary value of the item code.

WARNING! One should not use this as a 'trick' to construct new item codes! The interface uses the text string to look up the VMSDEF information and takes this data to decide about the data type to return.

channel_number
I/O channel, assigned to the device about which the information should be retrieved. Use 'None' to skip the channel parameter and use device_name instead.
device_name
Name of device to get information about. Note: normally channel_number overrides device_name! Use channel_number = 'None' to force usage of device_name.
Examples:
>>> import vms_lib

>>> ownuic = vms_lib.getdvi ("DVI$_OWNUIC",None,"DKA100:")
>>> hex (ownuic)
'0x10004'        <-- [1,4]

>>> vms_lib.getdvi ("DVI$_LOGVOLNAM",None,"DKA100:")
'DISK$D1'

>>> vms_lib.getdvi ("DVI$_FREEBLOCKS",None,"DKA100:")
528888
>>>
>>> # 32 is a channel number that was learned via
>>> #    SDA> show process/channel
>>> vms_lib.getdvi ("DVI$_DEVNAM",32,None)
'_DKA100:'
>>> vms_lib.getdvi ("DVI$_FREEBLOCKS",32,None)
528888
>>> vms_lib.getdvi ("DVI$_FREEBLOCKS",32)
528888


>>> used_blocks = vms_lib.getdvi ("DVI$_MAXBLOCK",None,"DKA100:") - \
...               vms_lib.getdvi ("DVI$_FREEBLOCKS",None,"DKA100:")
>>> used_blocks
1562256

>>> vms_lib.getdvi ("DVI$_TT_HOSTSYNC",None,"SYS$COMMAND:")
1    <-- means TRUE
>>> vms_lib.getdvi ("DVI$_TT_DIALUP",None,"SYS$COMMAND:")
0    <-- means FALSE

>>> vms_lib.getdvi ("DVI$_FULLDEVNAM",None,"SYS$COMMAND:")
'_HERE$FTA10:'


>>> # FTA12: is a terminal which is used in an editor session
>>> #  the editor attaches a mailbox (to catch broadcast messages)
>>> #  to the terminal
>>> vms_lib.getdvi(('DVI$_DEVTYPE',0),None,'FTA12:')
112        <--  Device_Type: VT300_Series
>>> vms_lib.getdvi(('DVI$_DEVTYPE',1),None,'FTA12:')
1          <--  DT$_MBX
>>>
>>> vms_lib.getdvi(('DVI$_MBX',0),None,'FTA12:')
0          <--  primary device is not a mailbox
>>> vms_lib.getdvi(('DVI$_MBX',1),None,'FTA12:')
1          <--  secondary device is a mailbox
>>>


>>> vms_lib.getdvi ("DVI$_FULLDEVNAM",None,"NO_DEVICE")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (324, '%SYSTEM-F-IVDEVNAM, invalid device name')

>>> vms_lib.getdvi ("INVALID_ITEM",None,"SYS$COMMAND:")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 1: unknown DVI$_ item code

>>> vms_lib.getdvi ("DVI$_FULLDEVNAM",'X',"SYS$COMMAND:")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: channel - must be 16-bit integer or None

>>> vms_lib.getdvi ("DVI$_FULLDEVNAM",None,None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (324, '%SYSTEM-F-IVDEVNAM, invalid device name')

>>> vms_lib.getdvi ("DVI$_FULLDEVNAM",None,1)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: expected read-only buffer, int found
>>> # that means 'string' ------^^^^^^^^^

>>> vms_lib.getdvi ('DVI$_LOGVOLNAM',None,sys)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: expected read-only buffer, int found
>>> # that means 'string' ------^^^^^^^^^

>>> s = 65536*'X'
>>> vms_lib.getdvi (s,None,"DEVNAM")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 1: item-code - string size limited to\
 65535 characters
>>>

>>> vms_lib.getdvi ("DVI$_DEVNAM",None,s)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 3: device-name - string size limited to\
 65535 characters
>>>

(go to: table of contents, index, list of vms_lib, prev: FREE_EF, next: GETJPI)

03-DEC-1998 ZE.