From: sysop                           
Subject: HEADER.COM (File Header Dump Utility)
News-Software: VAX/VMS VNEWS 1.4-b1  
Keywords:  INDEXF HEADER
Organization: Department of Nuclear Engineering Sciences
Date: 14 Aug 1992 14:57 EST  

Hello all,

	I've been having some bad disk problems, and was needing to look at
the file headers in INDEXF and their backlink IDs to determine what was 
happening (some files with null backlinks) since my ANALYZE is busted right
now.  Thanks to the info I got from the group, I was able to write a little
DCL comfile to help me.  Maybe it will be useful to some of you.


-------------------------------------------------------------------------------
Shawn A. Clifford, System Manager | Internet: sysop@robot.nuceng.ufl.edu
Nuclear Engineering Sciences      |		sac@eng.ufl.edu
University of Florida             | Home Phone: 904/335-4914
Gainesville, Florida  32611       | Work Phone: 904/392-1450  FAX: 904/392-3380
-------------------------------------------------------------------------------




$! Title:	HEADER.COM
$! Author:	Shawn A. Clifford
$! Purpose:	Returns the file header information form INDEXF.SYS about
$!		a specified file.
$! Usage:	@HEADER [full_filespec | file_number]
$!
$!	full_filespec : full VMS file specification;
$!			include device if other than current disk
$!	file_number   : the file number part of the full file ID;
$!			ie.   $ DIR/FILE LOGIN.COM
$!				LOGIN.COM         (528,7,0)
$!			file number is 528;
$!			current disk is used
$!			
$! NOTE:	Caller MUST have read access to INDEXF.SYS!
$! ----------------------------------------------------------------------
$! 'f$verify(0)
$ set symbol/scope=(nolocal,noglobal)
$ set on
$ on warning then goto end
$ on control_y then continue
$!
$! ---------------------------------------------------------------
$! Get the filename to be processed.  Need full spec if not on the
$! caller's current disk (SYS$DISK).
$! ---------------------------------------------------------------
$!
$ if (P1.nes."")
$ then
$	fname=P1
$ else
$	read/prompt="Enter file specification or file number:  " sys$command fname
$ 	if (fname.eqs."") then exit ($status)
$ endif
$!
$ if (f$type(fname).eqs."INTEGER")
$ then
$	n=fname
$	disk=f$getdvi("sys$disk","devnam") - "_" - ":"
$	goto disk_info
$ endif
$!
$! --------------------------------------------------------------------
$! Process the file and calculate the VBN for the beginning of the file
$! header within INDEXF.SYS.
$!
$!	VBN = (Cluster_Size * 4) + (Maxfiles + 4095)/4096 + File_Number
$!
$! --------------------------------------------------------------------
$!
$ fid=f$file("''fname'","fid")			! Get file id (FID)
$ n=f$ext(1,f$loc(",",fid)-1,fid)		! Get just the file number
$ n='n'						! Convert from string to #
$ disk=f$file("''fname'","dvi")			! Get the disk name
$disk_info:
$ b=f$getdvi("''disk'","cluster")		! Cluster size in blocks
$ m=f$getdvi("''disk'","maxfiles")		! Get max # files for disk
$!
$ w := write sys$output
$ vbn=(b*4) + (m+4095)/4096 + n			! Calculate VBN
$!	Dump the file header in INDEXF.SYS
$ dump/file_header/block=(count:1,start:'vbn') 'disk':[000000]INDEXF.SYS
$end:
$ exit ($status)
Newsgroups: comp.os.vms