Rational Developer for System z
PL/I for Windows, Version 7.6, Programming Guide

General debugging tips

Debugging is a process of letting your program run until it does something that you did not expect it to do. After finding a bug, you modify the program so that it does not encounter the bug when the program is in the exact machine state that initially produced the bug. This is accomplished by a combination of back-tracking, intuition, and trial and error. The major obstacle to effective debugging is that removing one bug can introduce new bugs into your program. You should consider general debugging tips as well as some debugging techniques specific to PL/I.

Consider the following tips when debugging your programs:

Make one change at a time
When attempting to remedy a bug, introduce only one change into the source code of your program at a time. By introducing a single change, you can compare the program behavior before and after the change to accurately measure the effect of the change.
Follow program logic sequence
Fix your program's bugs in the order in which they are encountered when the program is run.
Watch for unexpected results
Locate a given bug in the program source code at a point that corresponds to an unexpected change in the state of program execution.

For example, the undesired change in the state of program execution might be the unintended assignment of the decimal value "100" to the character variable "z". In this case, you might find that the source code has an error that assigns the wrong variable in an assignment statement.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)