Have a Question?
Print

00022: Program to print the file access count

Title:

Program to print the file access count

Description:

There is a file access count (also referred to as the user count or usage count of a file) located in the header of the file. This is used so that BBx can tell if someone’s process was killed, power shut off, etc. during the update of a file. This is usually used in conjunction with the setopts vector byte 3, bit $40$. The access count starts at byte 509 of the file and is 4 bytes long. It is incremented in the event of a change in the MKEYED file’s key space through the addition of a record or the removal of a record (there could be a case where the change of a record through a WRITE sets it as well), and decremented on the close of the MKEYED file. That way, in case a process is ever interrupted at a pessimal time, where file corruption could result, the header count will sit at nonzero (often minus one) when the file isn’t actively being used. 

Here’s a quick program to print the access count: 

0010 OPEN (1,ISZ=-1)”datafile” 
0020 READ RECORD(1,SIZ=508)A$ 
0030 READ RECORD(1,SIZ=4)B$ 
0040 PRINT HTA(B$) 





Last Modified: 09/17/2001 Product: PRO/5 Operating System: All platforms

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top