The number of primary locators associated with an HDS container file is called its reference count and may be determined using the DAT_REFCT routine as follows:
CALL DAT_REFCT( LOC, REFCT, STATUS )
Here, LOC is a locator associated with any object in the file and the reference count is returned via the integer REFCT argument. The file will remain open for as long as this value is greater than zero.
Normally, a file's reference count will fall to zero due to
annulling the last primary locator associated
with it (usually the locator obtained when the file was originally
opened), and at this point the file will be closed. Before this
happens, however, any mapped primitive objects within it will be
unmapped. In addition, any secondary locators that remain associated
with data objects in the same file will be annulled (i.e. they
will become invalid).7 No further reference to objects within the
file may be made until it has been explicitly re-opened.