Processing with Run-time and Syntax Errors

When GT.M encounters a run-time or syntax error, it stops executing and displays an error message. GT.M reports the error in the message. In this case, GT.M reports an undefined local variable and the line in error, name+3^DMEX. Note that GT.M re-displays the GTM> prompt so that debugging may continue.

To re-display the line and identify the error, use the ZPRINT command.

Example:

        GTM>ZPRINT, name+3
        %GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        ZP, name+3
        ^_____ 
        GTM>
        

This example shows the result of incorrectly entering a ZPRINT command in Direct Mode. GT.M reports the location of the syntax error in the command line with an arrow. $ECODE and $ZSTATUS do not maintain this error message because GT.M did not produce the message during routine execution. Enter the correct syntax, (i.e., remove the comma) to re-display the routine line in error.

Example:

        GTM>WRITE $ZPOS
          
            name+3^DMEX
          
          
        

This example writes the current line position.

$ZPOSITION is a read-only GT.M special variable that provides another tool for locating and displaying the current line. It contains the current entry reference as a character string in the format label+offset^routine, where the label is the closest preceding label. The current entry reference appears at the top of the M invocation stack, which can also be displayed with a ZSHOW "S" command.

To display the current value of every local variable defined, use the ZWRITE command with no arguments.

Example:

        GTM>ZWRITE
        ln=12
        name="Revere, Paul"
        

This ZWRITE displays a listing of all the local variables currently defined.

[Note]

ZWRITE displays the variable name. ZWRITE does not display a value for bame, confirming that it is not defined.