(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: DO_COMMAND, next: FIND_FILE)


FID_TO_NAME - Convert Device and File ID to File Specification


Please note that You MUST check status and/or acp_status because FID_TO_NAME() does NOT raise an exception when something goes wrong!

Format:

    status, acp_status, filespec = \
        vms_lib.fid_to_name (device_name, file_id [,directory_id])
Returns:
status
The return-status from LIB$FID_TO_NAME. The Python interface uses dynamic string descriptors so it can also return a status from LIB$SFREE1_DD.
acp_status
The status resulting from traversing the backward links.
filespec
The resulting file specification string.
Arguments:
device_name
Name of the device on which the file resides. (64 characters or less!)
file_id
The file identifier. This is a tuple of 3 (16-bit) integers.
directory_id
The directory file identifier. Please read the description of LIB$FID_TO_NAME for details.
Examples:
$ COPY _NLA0: TEST.TMP
$ DIRECTORY /FILE_ID TEST.TMP

Directory DKA100:[PYTHON.PYTHON-1_5.VMS]

TEST.TMP;1           (12621,13,0)

Total of 1 file.

$ python
... (Python's banner omitted) ...
>>> import vms_lib

>>> status, acp_status, filespec = vms_lib.fid_to_name (
... 'DKA100:', (12621,13,0))
>>> print status, acp_status, filespec
1 1 DISK$D1:[PYTHON.PYTHON-1_5.VMS]TEST.TMP;1
>>>
>>> import vms_sys
>>> vms_sys.getmsg (status)[0]
'%SYSTEM-S-NORMAL, normal successful completion'
>>>


>>> status, acp_status, filespec = vms_lib.fid_to_name (
... 'DKA100:', (12621,13,999))
>>> print status, acp_status, filespec
2456 2456 DISK$D1:
>>>
>>> import vms_sys
>>> vms_sys.getmsg (status)[0]
'%SYSTEM-W-NOTVOLSET, volume is not part of a volume set'
>>>


>>> status, acp_status, filespec = vms_lib.fid_to_name (
... 'DKA100:', (12621,999,0))
>>> print status, acp_status, filespec
2320 2320 DISK$D1:
>>>
>>> import vms_sys
>>> vms_sys.getmsg (status)[0]
'%SYSTEM-W-NOSUCHFILE, no such file'
>>>


>>> status, acp_status, filespec = vms_lib.fid_to_name (
... 'DKA100:', (12621,99999,0))
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: file-id - tuple-element:1 is not a 16-bit integer
>>> # The first tuple element is numbered 0.

>>> status, acp_status, filespec = vms_lib.fid_to_name (
... 'DKA100:', (12621,17,'X'))
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: file-id - tuple-element:2 is not a 16-bit integer
>>> # The first tuple element is numbered 0.

>>> status, acp_status, filespec = vms_lib.fid_to_name ('DKA100:', 'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: file-id - must be a tuple of 3 16-bit integers
>>>

(go to: table of contents, index, list of vms_lib, prev: DO_COMMAND, next: FIND_FILE)

23-MAR-1999 ZE.