Operating System - OpenVMS

number of free file headers available

Bo Midberg
Valued Contributor

number of free file headers available

How can I see the number of free file headers available on a device?

The DCL lexical function F$GETDVI(device,"MAXFILES") gives the maximal number of file headers on a device, but there is no item for how many that are free or used, and directory/grand_total device:[*...] is so slow.

Hein van den Heuvel
Honored Contributor

Re: number of free file headers available

DIR /GRAN [*...] will not give the answer you want anyway.

It only gives a minimum in use.

There may be more, many more, headers used notably due to multi-header files because of fragmentation or heavy ACL usage.

And the limit may be lower than MAXFILES due to INDEXF.SYS being limited to 1 header, so if it have too many small extents, then the real max may be MUCH lower. So this is reall tricky, because the current volume may have some number of free headers, but the ability to create more. How many more. will depend on the number of INDEXF.SYS extents available and the size of the extents to be made.

So in a sense the SIZE of the INDEF.SYS is a big indicator.

All of this is best visualized Jur's DFU or the DFO product.

Or you could write  a (DCL) program to count the bits in the index File Bitmap.

The index file bitmap starts at virtual block v*4+1 for m blocks.

v=cluster, m=maxfiles derived.

Hein van den Heuvel
Honored Contributor

Re: number of free file headers available

hi, I happend to stumble into a little DCL script I wrote decades ago, which display the number if INDEXF.SYS map pointers in use.

Now this is only inderectly important for the original question, in the sense that when there are only  a few map pointers left, you'd better make them count (large extent) or else the ability to create files will hit a limit.

The reason for posting my headers.com is more to show how to peel information from INDEXF.SYS structure, some might label this a 'hack' and they would be correct.





$if p1.eqs."" then inquire p1 "Device name"
$if p1.eqs."" then exit
$p1 = p1 - ":"
$ibmapsize = (f$getdvi(p1,"maxfiLes") + 4095) / 4096
$indexf_header_vbn = (f$getdvi(p1,"cluster") * 4) + ibmapsize + 1
$!write sys$output ibmapsize, "	", indexf_header_vbn
$!dump/head/bloc=(count:1,star:'indexf_header_vbn') 'p1':[000000]indexf.sys
$open/read/share=write indexf 'p1':[000000]indexf.sys
$vbn = 0
$vbn = vbn + 1
$read/end=ooops indexf header
$if vbn.lt.indexf_header_vbn then goto loop
$mpoffset = 0 ! Watch for negative numbers
$acoffset = 0
$map_inuse = 0
$mpoffset[0,8] = f$cvsi(1*8,8,header)
$acoffset[0,8] = f$cvsi(2*8,8,header)
$map_inuse[0,8] = f$cvsi(58*8,8,header)
$write sys$output p1,": Indexf.sys map max = ", 2*(acoffset - mpoffset -1), -
		  " (bytes). In use ", 2*map_inuse, " (bytes)."
$stat = $status
$close/nolog indexf
$exit 'stat




Bo Midberg
Valued Contributor

Re: number of free file headers available

These tools did provide a hint, but did not aid in calulating the amount of files that may be added.

Reviewed the number of files compared with the number of headers, and found that the ratio was about 3 headers for each file.