From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: File Management utility
Date: 13 Nov 1992 06:49:42 GMT
Organization: HST Wide Field/Planetary Camera
Distribution: world
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu

In article <01GR2LTWD6SI000TNW@ACAD.DRAKE.EDU>, SK0001@ACAD.DRAKE.EDU (Sal Kabalani) writes:
>1- I loaded a FOO.DIR file into TPU and looked at it. It contains all the
>   filenames in the directory FOO, plus some other information. I am assuming
>   this information is date/time, size, location on disk, etc. for each file in
>   that directory.

Your assumption is nowhere near correct.  You really DON'T want to try to
manipulate directory entries yourself.  Use the system services or library
routines to do it.  That's the documented, reliable and supported way to do it.
However, just for the sake of completeness, here's a description of a record in
a directory file:

          |---------------------------------------|
          |           Record Byte Count           |
          |---------------------------------------|
          |             Version Limit             |
          |-------------------|-------------------|
          |  Name Byte Count  |       Flags       |
          |-------------------|-------------------|
          |                                       |
          |                                       |
          |                                       |
          |           File Name String            |
          |                                       |
          |                                       |
          |                                       |
          |---------------------------------------|
          |                                       |
          |                                       |
          |              Value Field              |
          |                                       |
          |                                       |
          |---------------------------------------|



Count     This two byte field is  the  standard  byte  count
          field of a variable length record.

Limit     This word contains the maximum number of  versions
          that  are  to  be retained for this name and type.
          An attempt to enter more versions than  the  limit
          will  result  in  the deletion of the least recent
          version, or an error return, at  the  implementing
          system's option.

Flags     This byte contains the type code of the  directory
          entry  and  assorted flags bits.  The type code is
          contained in the three low bits of the flags byte.
          It is always

          DV.FID    The value field is  a  list  of  version
                    numbers and 48 bit File ID's.

          The following flag bits are defined:

          DV.PRV    Set if the  preceding  directory  record
                    contains  the same name and type as this
                    one.
          DV.NXV    Set if the next  directory  record  con-
                    tains  the  same  name  and type as this
                    one.

Name      This field contains the  file  name  and  type  in
          ASCII,  separated  by  a  dot.  The dot is present
          even if either name, or type, or both,  are  null.
          Only  upper case alphabetic and numeric characters
          may be present in  the  name  and  type.   If  the
          length  of  the  name  is odd, it is padded with a
          single null.

Value     This field contains the "value" of  the  directory
          entry;  i.e., the information returned to the user
          from a lookup operation. The value field is a list
          of version numbers and  corresponding  file  ID's,
          appearing  in  descending order by version number.
          The  number of entries in the list is deduced from
          the record byte count.  The version  number  is  a 
          signed  word in the range 1-32767.  The file ID is
          a set of three words which  together  specify  the
          file header in INDEXF.SYS associated with a file.

>2- I dont want to re-invent the wheel. I there is such a utility that does what
>   I need, I would like to consider it, instead of writing my own. Does anyone
>   know if such a utility exists ? I would still like to know the FOO.DIR
>   record format, for educational purposes, if nothing else.

Well, if you've got the RSX-11 layered product, you COULD use PIP.  What's
wrong with the DCL commands you already mentioned?
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.