Operating System - OpenVMS
1828047 Members
2019 Online
109973 Solutions
New Discussion

Error creating File on disk.

 
SOLVED
Go to solution
Volker Halle
Honored Contributor

Re: Error creating File on disk.

Craig,

I've created a little DCL procedure to count the no. of free file header slots in INDEXF.SYS (from the Index File Bitmap).

AXPVMS $ @count_FREE_HEADERS dsa1:
IBM_VBN = 37 Hex = 00000025 Octal = 00000000045
MAXFILES = 419004 Hex = 000664BC Octal = 00001462274
IBM_LEN = 103 Hex = 00000067 Octal = 00000000147
Found 378009 free file header slots in INDEXF.SYS on DSA1:

You can use it on any of your disks to determine, if you might soon be running out of free file header slots. Needs READALL priv.

Volker.

$!
$! COUNT_FREE_HEADERS.COM - count free file header slots in INDEXF.SYS
$!
$! Count no. of bits not set in Index File Bitmap to determine the no. of free
$! file header slots in INDEXF.SYS
$!
$! Created 17-MAR-2023 by volker (dot) halle (at) invenate (dot) de
$!
$! https://community.hpe.com/t5/operating-system-openvms/error-creating-file-on-disk/td-p/7184218
$!
$ IF P1 .EQS. ""
$ THEN
$   TYPE SYS$INPUT

        Invoke with @count_FREE_HEADERS diskname

$   EXIT
$ ENDIF
$!
$ debug = "FALSE"
$ IF P2 .NES. "" THEN $ debug = "TRUE"
$!
$ disk = P1 - ":" + ":"
$ IF .NOT. F$GETDVI(disk,"EXISTS") THEN $ EXIT 0
$ IF .NOT. F$GETDVI(disk,"MNT") THEN $ EXIT 0
$!
$ IF F$SEARCH("''disk'[000000]INDEXF.SYS").EQS."" THEN $ EXIT 0
$!
$ n_free_headers = 0            ! count of free header blocks in INDEXF.SYS
$!
$ OPEN/READ/SHARE/ERR=err_open x 'disk'[000000]INDEXF.SYS
$ ON CONTROL_Y THEN $ GOTO eof_x
$!
$ READ/END=eof_x x line                 ! read VBN 0 = boot block
$ READ/END=eof_x x line                 ! read VBN 1 = home block
$!
$! See SYS$LIBRARY:LIB.REQ      for $HM2DEF defintitions
$!
$! macro HM2$W_IBMAPVBN = 22,0,16,0 %;     !  VBN of index file bitmap
$! macro HM2$L_MAXFILES = 28,0,32,0 %;     !  maximum ! files on volume
$! macro HM2$W_IBMAPSIZE = 32,0,16,0 %;    !  index file bitmap size, blocks
$!
$ ibm_vbn = F$CVSI(22*8,16,line)
$ maxfiles = F$CVSI(28*8,32,line)
$ ibm_len = F$CVSI(32*8,16,line)
$!
$ SHOW SYMB ibm_vbn
$ SHOW symb maxfiles
$ SHOW SYMB ibm_len
$!
$ vbn = 2
$find_ibm:
$ READ/END=eof_x x line
$ vbn = vbn + 1
$ IF vbn .LT. ibm_vbn THEN $ GOTO find_ibm
$ IF vbn .GE. ibm_vbn + ibm_len THEN $ GOTO eof_x
$!
$ IF debug THEN $ SHOW SYMB vbn
$!
$ bit_offset = 0
$count_bits:
$ bits = F$CVSI(bit_offset,32,line)
$ IF bits .EQ. 0                                ! -> 32 free headers
$ THEN
$   n_free_headers = n_free_headers + 32        ! count 32 free headers
$ ELSE
$   IF bits .NE. %xFFFFFFFF                     ! not all bits set
$   THEN
$     GOSUB count_bits_in_lw
$   ENDIF
$ ENDIF
$ bit_offset = bit_offset + 32
$!
$! In the last VBN of the Index File Bitmap, stop scanning of MAXFILES bits
$! are exceeded.
$!
$ IF vbn .EQ. ibm_vbn + ibm_len - 1     ! last block of IBM bitmap ?
$ THEN
$   max_bits = maxfiles - (maxfiles/4096)*4096
$   IF bit_offset .LT. max_bits
$   THEN
$     GOTO count_bits
$   ELSE
$     IF debug
$     THEN
$       SHOW SYMB max_bits
$       SHOW SYMB vbn
$     ENDIF
$     GOTO eof_x                        ! scanned all bits up to MAXFILES
$   ENDIF
$ ENDIF
$!
$ IF bit_offset .LT. 512*8 THEN $ GOTO count_bits
$ GOTO find_ibm         ! read next block from Index File Bitmap
$!
$eof_x:
$ CLOSE x
$ WRITE SYS$OUTPUT "Found ''n_free_headers' free file header slots "+-
                        "in INDEXF.SYS on ''P1'"
$ EXIT
$!
$err_open:
$ WRITE SYS$OUTPUT "%COUNT_FREE_HEADERS-E-OPEN_FAILURE, error opening "+-
        " ''disk'[000000]INDEXF.SYS - check privs"
$ EXIT
$!
$count_bits_in_lw:
$ i = 0
$loop_bits:
$ bit = F$CVUI(bit_offset+i,1,line)
$!
$ IF bit .EQ. 0 THEN $ n_free_headers = n_free_headers + 1
$ i = i + 1
$ IF i .LE. 31 THEN $ GOTO loop_bits
$ RETURN
Craigers01
Advisor

Re: Error creating File on disk.

Volker,

That program is amazing. That is what I was initially aspiring to create, util I figured out that I needed a degree in VAX/RMS file structure. It looks like the changes I have implemented (with your guidance), have really freed things up! I will wrap this DCL in a loop to check all my disks, then schedule it to run once a week to alert me of impending doom.

 

Thanks Soo much!

@ check_indexf.com cam1
  IBM_VBN = 37   Hex = 00000025  Octal = 00000000045
  MAXFILES = 418901   Hex = 00066455  Octal = 00001462125
  IBM_LEN = 103   Hex = 00000067  Octal = 00000000147
Found 389487 free file header slots in INDEXF.SYS on CAM1