Recording Information about Errors

GT.M provides a number of extensions to examine and record information about an error condition.

The extensions are:

The ZSHOW command displays information about the current M environment. A ZSHOW argument may contain an expression that contains codes selecting one or more types of information for output.

B: selects ZBREAK information

C: selects available $ZCALL() table entry names

D: selects open device information

I: selects intrinsic special variables

L: selects locks held by the process

S: selects the M stack

V: selects local variables

*: selects all possible ZSHOW information

A ZSHOW with no argument displays the M stack on the current device. It lists the program stack from initiation to the current execution level.

The ZWRITE command prints the current value of defined variables. ZWRITE provides a tool for examining or saving variable context. ZWRITE and ZSHOW can only display the current local variables, not any local variable states that have been protected by NEW commands. A WRITE may also display current global variables.

The $ECODE special variable contains a M standardized/user defined/GT.M specific error code. For details on $ECODE refer to the "Intrinsic Special Variable" chapter in this manual.

The $STACK special variable contains the current level of M execution stack depth. For details on $STACK refer to the "Intrinsic Special Variable" chapter in this manual.

The $STACK() function returns strings describing aspects of the execution environment. For details on $STACK() refer to the "Functions" chapter in this manual.

The $ZLEVEL special variable maintains an integer that indicates the level of nesting of DO and XECUTE commands. $ZLEVEL always contains an integer count of the number of levels displayed by issuing a ZSHOW "S" in that context.

The $ZSTATUS special variable records the error condition code and location of the last error condition during execution.

For I/O operations, GT.M uses the $ZA, $ZB and $ZEOF special variables. $ZA contains a status determined by the last read on the current device. For more information about I/O operations, refer to the "Input/Output Processing" chapter in this manual.

To simplify record keeping, an application may set $ZTRAP to an error-handling routine that records information about an error. The next section provides an example of a routine ERR.M that does this.