It is sometimes necessary to determine whether an NDF exists before deciding to create a new one. The routine NDF_EXIST is provided to allow this by associating an existing NDF with a parameter and returning an NDF identifier for it, if it exists. If the NDF does not exist, then no error results, but the routine returns with a ``null'' identifier value of NDF__NOID (defined in the include file NDF_PAR). In effect, this routine behaves identically to NDF_ASSOC, except that if the NDF does not exist, control is returned to the calling routine rather than re-prompting the user to supply a new name. The following illustrates how NDF_EXIST might be used:
INCLUDE 'NDF_PAR' ... CALL NDF_EXIST( 'OUT', 'UPDATE', INDF, STATUS ) IF ( INDF .EQ. NDF__NOID ) THEN CALL NDF_CREAT( 'OUT', '_INTEGER', NDIM, LBND, UBND, INDF, STATUS ) END IF
Here, an existing NDF is accessed if it exists, otherwise a new structure
is created and used instead.