10.15 Debugging

One very useful debugging tool is the PRINT statement. This statement can show values of certain values at any point in a program. When this is not enough, there is a program trace feature which will display what is being executed and what values are being referenced. Normally the program trace is turned off. To turn on the program trace, use the SET statement. The attribute name is TRACE and setting this attribute to something other than zero will start the program trace feature. There are two Report Writer parameters that work very nicely to turn the program trace on and off. These are $TRUE (which will turn the program trace on) and $FALSE (which will turn the program trace off).

The output from the program trace is printed on the standard error file. This output shows which source line generated the code that is being executed, the code being executed and the operators of the code. When a field or variable is being referenced, the index of the field or variable in the symbol table is listed first to help identify which field is being referenced if the field is not unique. After the field or variable name is printed, the contents will also be printed. (Note: For an example of this output, see the chapter entitled Report Writer Programming Guide in this manual.)