[comp.os.vms] VMS/RMS question

SERAFINI%RAL@AMES-IO.ARPA (04/23/87)

info-vaxers,

I feel foolish for asking this question, but I've looked everywhere I know
and can't find a solution.  

How can I find out if a file is readable or writable given the current
process' priveleges?  I've tried F$File_Attributes to get the protection
string, but I found the gotcha that a file can have read protection set,
but the directory file that contains the file doesn't. Obviously, having to
check read protection on every directory in the path is a real hassle,
especially from DCL.  Is there some system service I don't know about
that combines all the processing necessary to achieve this? I know it's
non-trivial, and I assume that it's been done but I just haven't learned
yet.  The problem also exists for trying to write files.  Is there a better
solution than opening the file and testing for failure?

Thanks much.
Dave Serafini
Sterling Software 
NASA/Ames Research Center

serafini%ral@ames-io.arpa   or RAL::SERAFINI (SPAN node 24.6)

tedcrane@batcomputer.tn.cornell.edu (Ted Crane) (04/27/87)

In article <8704250736.AA09643@ucbvax.Berkeley.EDU> SERAFINI%RAL@AMES-IO.ARPA.UUCP writes:
>How can I find out if a file is readable or writable given the current
>process' priveleges?  
>Is there some system service I don't know about...

To put it briefly: SYS$CHECK_ACCESS and SYS$CHKPRO (spelling?).  A
brief summary of these is available through the on-line help:
	$ help sys $ch

Programming these the first time can be a pain to do, since you have to 
set up the data structures in whatever your language of habit is.  After
that, it's cookbook.

More reference material: System Services Reference.