howto:find_the_filename_when_all_you_have_is_the_file_id

Information

There are occasions where you have a File_ID of a file, but not the name. Probably related to $ ANALYZE/DISK errors such as this one:

%ANALDISK-W-MULTALLOC, file (3224,22,0)
        multiply allocated blocks
        VBN 37225 to 37227
        LBN 6934554 to 6934556, RVN 1

So how do you determine the name of the file in question?

Procedure

Create a command procedure with the following information:

$! fid_header_dump.com
$ if p1 .eqs. "" then inquire p1 "Disk name"
$ if p1 .eqs. "" then exit
$ if p2 .eqs. "" then inquire p2 "File ID"
$ p2 = p2 - "(" - ")"
$ if p2 .eqs. "" then exit
$!
$ show symbol p1
$ p1 = p1 - ":" + ":"
$ disk = f$parse (p1,,,"device")
$ show symbol disk
$ fid = f$element (0, ",", p2)
$!
$ cluster = f$getdvi (disk, "cluster")
$ maxfil = f$getdvi (disk, "maxfiles")
$ bitmap = (maxfil + 4095) / 4096
$ skip = cluster * 4 + bitmap
$ block = skip + fid
$ dump /file_header 'disk'[000000]indexf.sys /block=(s:'block',c:1)

Example usage:

For this example, the ANALYZE/DISK command was on disk DSA2, so that is provided into the command.

$ @fid_header_dump dsa2 "(3224,22,0)"
  P1 = "DSA2"
  DISK = "DSA2:"

Dump of file DSA2:[000000]INDEXF.SYS;1 on  1-FEB-2019 11:58:20.28
File ID (1,1,0)   End of file block 471860 / Allocated 471888

Virtual block number 3921 (00000F51), 512 (0200) bytes

Header area
    Identification area offset:           40
    Map area offset:                      100
    Access control area offset:           255
    Reserved area offset:                 255
    Extension segment number:             0
    Structure level and version:          2, 1
    File identification:                  (3224,22,0)
    Extension file identification:        (0,0,0)
    VAX-11 RMS attributes
        Record type:                      Variable
        File organization:                Sequential
        Record attributes:                Implied carriage control
        Record size:                      18
        Highest block:                    144
        End of file block:                1
        End of file byte:                 38
        Bucket size:                      0
        Fixed control area size:          0
        Maximum record size:              255
        Default extension size:           0
        Global buffer count:              0
        Directory version limit:          0
    File characteristics:                 <none specified>
    Caching attribute:                    Writethrough
    Map area words in use:                3
    Access mode:                          0
    File owner UIC:                       [STAFF,MMACGREGOR]
    File protection:                      S:RWED, O:RWED, G:RE, W:
    Back link file identification:        (2091,15,0)
    Journal control flags:                <none specified>
    Active recovery units:                None
    File entry linkcount:                 0
    Highest block written:                1
    Client attributes:                    None

Identification area
    File name:                            LOGIN.COM;1    <<<< FILENAME DISPLAYED HERE
    Revision number:                      2
    Creation date:                         1-FEB-2019 11:53:13.36
    Revision date:                         1-FEB-2019 11:53:13.42
    Expiration date:                      <none specified>
    Backup date:                          <none specified>

Map area
    Retrieval pointers
        Count:        144        LBN:   16220592

Checksum:                                 10562
howto/find_the_filename_when_all_you_have_is_the_file_id.txt · Last modified: 2019/02/01 19:20 by mmacgregor