GT.M provides the error handling facilities described in the M standard. In addition, GT.M provides a number of extensions for error handling. Both are discussed in the following sections. The following table summarizes some of the tools, which are then described in more detail within the context of various techniques and examples.
Summary of GT.M Error-Handling Facilities |
|
EXTENSION |
EXPLANATION |
OPEN/USE/CLOSE EXCEPTION |
Provides a deviceparameter specifying an XECUTE string or entryref that GT.M invokes upon encountering a device-related exception condition. |
MUMPS /LIST ZLINK :"/LIST" |
Creates a listing file of all the errors detected by the compiler. Detects syntax errors. Useful in the process of re-editing program to correct errors. |
ZGOTO |
Provides for removing multiple levels from the M invocation stack. |
ZMESSAGE |
Creates or emulates arbitrary errors. |
$STACK |
Contains the current level of M execution stack depth. |
$STACK() |
Returns values describing aspects of the execution environment. |
$ECODE |
Contains a list of error codes for “active” errors; these are the errors that have occurred, but have not yet been cleared. |
$ESTACK |
Contains an integer count of M virtual machine stack levels that have been activated and not removed, since the last time $ESTACK was NEW'd. |
$ETRAP |
Contains a string value that GT.M invokes when an error occurs during routine execution. |
$QUIT |
Indicates whether the current block of code was called as an extrinsic function or a subroutine. |
$ZCSTATUS |
Holds the value of the status code for the last compilation performed by a ZCOMPILE command. |
$ZEDIT |
Holds the value of the status code for the last edit session invoked by a ZEDIT command. |
$ZEOF |
Holds the value ‘1’ (TRUE) if the last READ on the current device reached end-of-file, otherwise holds a ‘0’ (FALSE). |
$ZERROR |
Contains a string supplied by the application, typically one generated by the code specified in $ZYERROR. |
$ZLEVEL |
Contains current level of DO/EXECUTE nesting ($STACK+1). |
$ZMESSAGE() |
Translates a VMS/GT.M condition code into text form. |
$ZSTATUS |
Contains the error condition code and location of last exception condition occurring during routine execution. |
$ZTRAP |
Contains an XECUTE string or entryref that GT.M invokes upon encountering an exception condition. |
$ZYERROR |
Contains an entryref to invoke when an error occurs; typically used to maintain $ZERROR. |