Unfortunately, it is all too easy to neglect to annul an identifier, especially if the number of NDFs used by an application is large. It is a particular problem if an application is fairly complex and can potentially terminate at many points with an unknown number of NDF identifiers allocated. In such cases, it is often far easier simply to say ``annul all the identifiers I've used in this part of the program''. The NDF_BEGIN and NDF_END routines allow this.
These routines are used in pairs to delimit a section of an application, rather like a Fortran 77 IF...END IF block, although often they will enclose the entire application. When NDF_END is called, it will annul all the NDF identifiers issued since the matching call to NDF_BEGIN, for example:
CALL NDF_BEGIN
CALL NDF_ASSOC( 'IN1', ... )
CALL NDF_ASSOC( 'IN2', ... )
<allocate more NDF identifiers>
CALL NDF_END( STATUS )
As with IF...END IF blocks, matching pairs of calls to NDF_BEGIN and NDF_END may be nested, every call to NDF_END being accompanied by a corresponding call to NDF_BEGIN. This makes it possible to annul only those identifiers acquired within a certain part of an application if required. So long as no NDF identifiers are acquired outside the outermost BEGIN...END block, this type of program structure provides a complete safeguard against forgetting to annul an identifier. Explicit calls to NDF_ANNUL can then largely be eliminated.