How Calls to DP4 Error Functions are Generated

Calls to the database manager and to the terminal manager are made using a parameter block (SRV_PARA or TRM_PARA in dp4ci.h). If an error is detected, on return the field para.error will be set to a non zero value and various other fields are set to give more information about the error. para.error is where the error level passed to dp4_halt() comes from.

Attentive readers will have noted that the generation of calls to sys_error() and sys_fail() through para.error being 3 or 4 was described only in connection with SRVn. This is because traditionally TRM generates calls to sys_error() and sys_fail() internally and then returns with para.error 2, so that when control returns to the application an error message has already been produced.

With 4.6xx/4.523 you can optionally force the terminal manager to return error information in the same way as for calls to the database manager. This is achived by setting the high order bit of df_libtype as follows:

df_libtype |= 0x8000;

This is not recommended because in some situations it is difficult for TRMn to return the information needed for the call to the error function. Additionally TRMn always returns to the point at which errors were generated, and does not longjmp(), so treating them in the same way as SRVn might potentially introduce problems with errors never actually getting reported.