$ZS[TATUS] contains a string value specifying the error condition code and location of the last exception condition that occurred during routine execution.
GT.M maintains $ZSTATUS as a string consisting of three or more substrings. The string consists of the following:
An error message number as the first substring.
The entryref of the line in error as the second substring; a comma (,) separates the first and second substrings.
The message detail as the third substring. The format of this is a percent sign (%) identifying the message facility, a hyphen (-) identifying the error severity, another hyphen identifying the message identification followed by a comma (,), which is followed by the message text if any:
Format: %<FAC>-<SEV>-<ID>, <TEXT> Example: %GTM-E-DIVZERO, Attempt to divide by zero
GT.M sets $ZSTATUS when it encounters errors during program execution, but not when it encounters errors in a Direct Mode command.
$ZSTATUS is a read-write Intrinsic Special Variable, (i.e., it can occur on the left side of the equal sign (=) in the argument to the SET command). While it will accept any string, FIS recommends setting it to null. M routines cannot modify $ZSTATUS with the NEW command.
GTM>WRITE $ZSTATUS 150373110,+1^MYFILE,%GTM-E-DIVZERO, Attempt to divide by zero
This example displays the status generated by a divide by zero (0).