When a command associated with access to foreign data completes, the NDF library checks to determine if it was successful.
It first looks at the status value returned by the C ``system'' call which invoked the command. These status values are operating-system dependent but, on most systems, there is provision for the command to return either a ``success'' or an ``error'' status to the command interpreter and for the invoking application to receive this. If the NDF library does not receive a success status back, it deduces that the command has failed and generates an appropriate error report. The NDF_ routine that was invoked then returns to the application with its STATUS argument set and the application would probably then abort and display the error message.
For commands that invoke conversion utilities (associated with either of the environment variables NDF_FROM_... or NDF_TO_...), the NDF library will also check to see that the output dataset from the conversion operation has been created. Where this dataset is a native format NDF, it will be opened to check that it contains a valid NDF data structure. Any problem will again result in an error report from the invoking application.
When writing data access commands or conversion utilities, the recommended course of action if an error occurs is for diagnostic error information to be written to the standard error channel, and for the invoked command to return with an ``error'' status value appropriate to the command interpreter in use.
It is generally wise to avoid having the conversion utility re-prompt for new input, as this can be confusing for the user who may not be aware that conversion is taking place. This can normally be arranged by appropriately redirecting the standard input and/or output channels to a null device so that the command will abort and control will return to the NDF library if an attempt is made to prompt for (or read) new input.