From: SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 30-OCT-1993 10:56:40.28 To: EVERHART CC: Subj: RE: How to $OPEN a file by fileid rather than by name? Date: Sat, 30 Oct 1993 07:20:53 +0100 From: "GWDGV1::MOELLER" To: lauri@elwing.fnal.gov, info-vax@sri.com Cc: GWDGI::"info-vax@sri.com",MOELLER Subject: RE: How to $OPEN a file by fileid rather than by name? Laurelin of Middle Earth writes: > I am trying to open a file by file id number in order to determine the name > of the file. The $RMS manual implies that this can be done, but so far no > such luck for me. > > The current incarnation of my code is included below (along with the .CLD > file below it). To build the executable: >[... program omitted ...] > I'm trying to have $RMS tell me the name of the file with fileid (57,98,0) > on the ELWING$LOCAL: device, but the $OPEN statement fails with %RMS-E-FNF. > In other words, I'm doing something wrong. You have to distinguish between two things: (a) determining the name of a file from the file-id (b) opening a file "by file-id" (for reading/writing) As has already been pointed out, there's the routine LIB$FID_TO_NAME which solves problem (a) - the routine won't open the file, so you need not even have access to the file for it to work. LIB$FID_TO_NAME invokes a disk ACP function, see I/O user's manual Vol.1. RMS allows for (b), but it will *not* look up the file name. You have to provide NAM$T_DVI (device name), NAM$W_FID, and maybe also NAM$W_DID (file-id of the directory), and have to set FAB$V_NAM. The latter bit makes RMS *ignore* all "name"-related fields in the FAB. Wolfgang J. Moeller, Tel. +49 551 201516 or -510, GWDG, D-37077 Goettingen, F.R.Germany PSI%(0262)45050352008::MOELLER Disclaimer: No claim intended! |