Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!CITHEX.CALTECH.EDU!carl From: carl@CITHEX.CALTECH.EDU.UUCP Newsgroups: comp.os.vms Subject: Re: code to set file protection Message-ID: <870628091331.00e@CitHex.Caltech.Edu> Date: Sun, 28-Jun-87 12:25:54 EDT Article-I.D.: CitHex.870628091331.00e Posted: Sun Jun 28 12:25:54 1987 Date-Received: Tue, 30-Jun-87 01:10:00 EDT References: <1663@uwmacc.UUCP> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 29 > I am in need of some code to change a existing file's protection. I've > looked through the RMS manuals and found only the protection XAB. The > description of this XAB indicates that one can change a existing files > protection if you open it, write it (or otherwise update it), and then close > it with the XAB attached. I can not make this work. Even if I could, I > might not want to modify the file. The C program at the end of this answer will make it work. You don't have to actually write or update the file; you must simply open it for PUT or UPD access (my program uses the latter), and set the protection to something other than what it used to be. There is one hitch that I can't overcome, though: RMS apparently won't let you set the protection to (S:,O:,G:,W:); it thinks of the value %XFFFF in the XAB$WPRO field as meaning "leave it the way it was". > The only other mechanism I can find for this purpose is the QIOW IO$Modify > function. This requires the whole directory and file parsing route to get > the file id. I suppose one could use RMS for this part of the task. Is a > FIB block and channel number hidden in any of the RMS structures? The QIOW call might let you get around the problem I mentioned above. The easy way to use the QIOW is is to use RMS to get the file id. To do this, you specify a NAM block as well as the FAB block; then you $OPEN the file, and get the FID out of NAM$WFID. > Am I missing something? Seems there should be a better way to do this. Well, you could, of course, use LIB$SPAWN to create a process to execute a DCL "SET PROTECTION" command to change the protection :-(