The number of locators available at any time is quite large, but each locator consumes various computer resources which may be limited, so it is important to ensure that locators are annulled once they have been finished with, i.e. when access to the associated data object is no longer required.
Annulling an HDS locator renders it invalid and resets its value to DAT__NOLOC. It differs from simply setting the locator's variable to this value, however, because it ensures that all resources associated with it are released and made available for re-use. A locator is annulled using the routine DAT_ANNUL, as follows:
CALL DAT_ANNUL( LOC, STATUS )
Note that annulling an invalid locator will produce an error, but this
will be ignored if the STATUS argument is not set to SAI__OK when
DAT_ANNUL is called (i.e. indicating that a previous error has
occurred). This means that it is not usually necessary to check
whether a locator is valid before annulling it, so long as the only
possible reason for it being invalid is a previous error which has set
a STATUS value.