(LOGO.JPG) Python for OpenVMS

This example if a simple front-end to the vms_lib.fid_to_name() interface. Note that there is not much error checking implemented.


#$% VMS_LIB_FID_TO_NAME.PY
# -----

import sys, vms_lib

vms_lib.set_symbol ("FID2NAME", "?")
if (len (sys.argv) != 2):
  sys.exit(1)

import string

t_device, t_fid = string.splitfields (sys.argv[1], ":", 2)
t_device = t_device + ":"

t_ind, t_rev, t_rvn = string.splitfields (t_fid[1:-1], ",", 3)

w_ind = int (t_ind)
w_rev = int (t_rev)
w_rvn = int (t_rvn)

# print (t_device, (w_ind, w_rev, w_rvn) )

status, acp_status, filespec = \
        vms_lib.fid_to_name (t_device, (w_ind, w_rev, w_rvn) )
# print status, acp_status, filespec

if (status != 1):
  sys.exit(status)

vms_lib.set_symbol ("FID2NAME", filespec)

sys.exit(1)

# -----
#%$


Example run:

$ python VMS_LIB_FID_TO_NAME.PY "ROCH$DKB100:(36125,1,1)"
%SYSTEM-W-NOSUCHFILE, no such file
$ show symbol FID2NAME
  FID2NAME = "?"
$ python VMS_LIB_FID_TO_NAME.PY "ROCH$DKB200:(36125,1,1)"
$ show symbol FID2NAME
  FID2NAME = "DISK$D2:[PYTHON.PYTHON-1_5_2.VMS]SETUP.COM;25"
$


(go to: table of contents, index)

20-FEB-2000 ZE.