SPACEDIR PROGRAM Richard DeJordy American Mathematical Society The SPACEDIR program was written to help track the usage of disk space on an ODS2 volume. (Also, because I was preparing a session on ODS2 Volume Structures for a session at a symposim and wanted a real-live program for it.) The program opens (without any locking), the INDEXF.SYS file of a volume specified on the command line as the first (and only) parameter. The home block is located (only as the second block of the file) and the offset to the file headers calculated. Then, for each file header, it determines if the file is a directory (FH2$V_DIRECTORY bit in FH2$L_FILECHAR is set). If it is a directory, it makes and entry into a quadrouply linked list of directory files on the device. The links are forward and backward by file number and forward and backward by back link point, i.e. the file number of the directory in which this directory appears on the disk. After creating the list, it goes through the INDEXF.SYS file again, this time recording the number of files and aggregate size of each file into fields in the appropriate directories entry on the linked list. After this, each entry's individual entries are aggregated into each directory which is above it in the disk "directory structure". Finally, the list is output in alphabetical order by directry, completing all subdirectories before moving to a new directory (much like one might see on a backup listing). The one exception to this is that the [000000] is always listed first, even if there is another directory off the main level of the device that starts with a $. This allows the first line to show the aggregate totals (number of files, blocks used, and blocks allocated) for the device. Each output line is described as # [dirname] # allocated, # files. Cum: # files, #/# blocks used/allocated. If the [dirname] is 40 characters or less, the lines are justified such that all the colums line up. If the [dirname] is more than 40 characters, there is no padding or alignment. The program can rubn on an RA90 in pretty poor shape, with 1762 directories and 75223 files in under 10 minutes on a 6320 with a moderate load. Enhancements to speed (such as btrees instead of linked lists), cosmetics, and flexibility (user defined output), are creeping into mind as I write this (2:30am one day before I leave for the Symposium). Please feel free to send comments, suggestion, or money to: Rich DeJordy American Mathematical Society P.O. Box 6248 Providence, RI 02940 (401)455-4029 Internet; RAD@MATH.AMS.COM