LEICHTER-JERRY@YALE.ARPA (08/06/87)
I want to get directory-style information from a VAX Pascal program. For example, I want to be able to "do a directory", and get all of the file-names file-sizes, protections, etc. But I want this info to go into an array of records, not to the screen or to a file. Is there some easy way to do this (I haven't found any in the Run-time library or the VMS system calls) or do I have to read from the directory file directly? If this is the case, where can I get info on the format of the VMS directory files? There are two separate issues here: VMS directories, like Unix directories, store very limited information about a file: Basically, the file name and a pointer to the file itself (File ID on VMS, inode on Unix). The rest of the information is stored with the file itself. So there are two problems: 1. Find all the filename/file id pairs in a given directory; 2. Given a filename/file id, get other information about the file. Problem 1 is solved using the $PARSE and $SEARCH services directly, or with the LIB$FILE_SCAN RTL routine, which takes care of a lot of the boilerplate of using RMS for you. Problem 2 is solved with the RMS $OPEN service; a side-effect of $OPEN is to fill the various XAB's with file status information. Reading the directory itself is unsupported - the format is not documented - and in any case only solves Problem 1. If for some reason you don't like RMS, you can use the disk ACP interface directly to solve Problem 2. This has no advantages I know of. -- Jerry -------