Error Handling and Debugging

Stepping Operations

 

Another common debugging technique involves putting an ESCAPE directive into a program and then "stepping" through the code in console mode during execution. This is an extremely useful method for tracing and following complex problems within program logic. It allows you to check the value of variables at different points and track program flow.

Use the following shortcut keys, followed by ENTER, to apply a stepping operation.

Keys

Stepping Operation

.

Executes next line of code and returns to command prompt.

. n

Executes n lines of code and returns to command prompt.

..

Steps through stack entries (e.g. FOR..NEXT, GOSUB..RETURN or CALL .. PERFORM .. EXIT) until completion.

...

Completes execution of (and then exits) the current program level (CALL .. PERFORM .. EXIT) stack.

;

Steps through compound statements.

; n

Steps through n directives in a compound statement (and then stops).

The F2 key (without ENTER) can be used to repeat the last type of stepping operation performed. (It emulates the . period by default.) The Step menu option in the CommandWindow works in much the same way.