Sometimes you may find yourself in need of a procedure that can help you
locate program errors that you cannot visually find by looking at your program. RPG-ILE's
program debugger can be very useful in these situations. It allows you to trace a program as
it is executing, stepping through a program a statement at a time, or stopping at "breakpoints"
that you designate so you can see the values of fields at that point of execution. Follow the
steps below to start the "debugging" mode for your programs.
1. Include the following H spec in your source. The editor might complain that the statement is
not correct. Just ignore it and save your program. H OPTION(*NODEBUGIO) No more stepping
through the F specs.
2. Compile your program using option 14, and hit F4 for the prompt screen. Hit F10 for more
options, and next to "Debugging views", key in *LIST and hit Enter.
3. Go to the command line at the bottom of the screen, and key in STRDBG and hit F4. Enter
the name of the program and the library and hit Enter.
4. In the Display Module Source screen, page down to the line(s) where you want to set your
breakpoint(s). Hit F6 to add the breakpoint(s). You will see a message at the bottom of the
screen telling you where you have added a breakpoint. Hit F3 to exit this screen.
5. Now, call your program and you will see the Display Module Source screen again, with the
cursor at your specified breakpoint. Hit F10 to begin stepping through your program.
6. When you are finished with the Debugger, be sure to enter ENDDBG on the command line to end
the debugger session. You will also want to recompile your program normally before using the
application.