Flint.Wbst@XEROX.COM.UUCP (06/10/86)
I assume that I am missing something very basic, but after pouring through RMS manuals, I still don't have an answer. Can I determine that a file is a directory file or not simply by looking at some field in the fab/rab/xab/nam structures ?? Conversely, can I create a directory file simply by setting a bit in the same field (as opposed to using LIB$CREATE_DIR) ?? My needs are simple: I generally already have the file open and would like to distinguish whether the file is a directory without going to more trouble than necessary and I need to create directory files and set the creation date by using a XABDAT structure when opening the file. I have noticed that when I dump/header a directory file the result specifies 'directory' in the file characteristics field... but I haven't figured out the correlation to the RMS structures (if there is one). Many thanks.... (sorry my VMS has grown rusty) -- ed
LEICHTER-JERRY@YALE.ARPA (06/13/86)
[The author is interested in determining whether a file is a directory, and in creating directory without using LIB$CREATE_DIR.] The "file is a directory" bit is in the UCHAR word of the file header; it is accessible via an ACP QIO using the ATR$C_UCHAR attribute - see the first chapter of the I/O User's Guide, Part I (section 1.3.5 in the VMS V4.2 doc set). If RMS were to make this information available anywhere, it would be in the file header characteristics XAB (XABFHC); however, it's not listed. (There's a lot of other low-level crud that is available through the ACP interface, but which RMS doesn't pass through - which is perhaps just as well; Lord knows, RMS is complex enough as it is!) Unfortunately, you can't do ACP (or any) QIO's to a file that RMS has opened for you unless you requested UFO - User File Open - mode, in which case you can't do any RMS operations. So even testing the bit on a file already opened by RMS is painful. Even if you COULD just turn on the "file is a directory" bit, you really wouldn't want to: Directories have to be correctly formated, and the format of directory contents - in fact, even the format of an empty direc- tory - are undocumented. LIB$CREATE_DIR is the ONLY way to go, if you expect your program to work at reliably. -- Jerry -------