$ZError

$ZE[RROR] is supposed to hold the application-specific error-code corresponding to the GT.M error-code stored in $ECODE/$ZSTATUS (see “$ECode” and “$ZStatus”).

$ZERROR contains a default value of "Unprocessed $ZERROR, see $ZSTATUS" at process startup.

$ZERROR can be SET but not NEWed.

The mapping of a GT.M error-code to the application-specific error-code is achieved as follows. Whenever GT.M encounters an error, $ECODE/$ZSTATUS gets set first. It then invokes the code that $ZYERROR points to if it is not null. It is intended that the code invoked by $ZYERROR use the value of $ZSTATUS to select or construct a value to which it SETs $ZERROR. If an error is encountered by the attempt to execute the code specified in $ZYERROR, GT.M sets $ZERROR to the error status encountered. If $ZYERROR is null, GT.M does not change the value of $ZERROR. In all cases, GT.M proceeds to return control to the code specified by $ETRAP/$ZTRAP or device EXCEPTION whichever is applicable. For details, see “$ZYERror”.