The code for notrm.c varies according to the release of DP4 used.
If a program is linked with notrm.c (supplied in source form) then replacement sys_error() and sys_fail() functions make calls to a routine called dp4_err(), which the program must supply. dp4_err() is passed 3 or 4 to indicate the error type, followed by the parameters passed to sys_error() or sys_fail().
On return a replacement dp4_halt() function is called, unless the code was compiled with BROKEN defined, in which case the DBMS is completely disabled and the routines return normally. (This is probably not a very good idea)
With notrm as supplied there is no call to an app_close() function from dp4_halt(), but you can add one if you require it.
For release 4.523 notrm.c should have been replaced with the 4.6xx version. Unfortunately this was overlooked and notrm.c was not updated. If you are using release 4.523, you can replace notrm.c with the version supplied for 4.6xx releases
From 4.524/4.6xx the notrm.c code contains a replacement dp4_error() function which maintains compatibility both with pre-existing notrm.c programs and with programs previously written to use the terminal manager. sys_error() and sys_fail() do not need to be replaced.
dp4_error() will call app_error(), and then call the programmer supplied dp4_err() to display the error message if required.
On return from dp4_err() and if the DP4ERR_HALT flag is set the dp4_halt() function is called, unless the code was compiled with BROKEN defined, in which case the DBMS is completely disabled and the routines return normally.