5.4 Debugging an RPG Application
VisualAge RPG includes a powerful debugger to help in locating logic errors in your
program. Let's look at some of the debugger features.
Windows NT 4.0 Users Click Here
Windows 95 or Windows 98 Users Click Here
Debugging VARPG with Windows NT 4.0
Follow these steps:
- To start the debugger click on the
Debug tool bar icon
, or select Project > Debug from
the menu bar. An MS DOS window appears followed by the IBM Distributed Debugger window.
- In the source pane of the
Distrubuted Debugger window scroll to the PRESS action
subroutine for the OK push button (PSBOK).
- Set a breakpoint on the CHAIN
statement that sets the focus attributes by double-clicking on the statement number.
- Run your application by clicking
on the Run icon
, on the source view Tool Bar.
As you move the mouse pointer over the Debugger Tool Bar icons, a
short description of each icon displays.
- Enter a customer number on the
Customer Inquiry window and click OK. When the breakpoint is
reached, the statement is highlighted.
- To examine the contents of a
program variable, scroll to any statement that contains a variable. This technique does
not work on the EVAL operation code. Double click on the variable to select it. Right
click once on the selected variable and from the pop up menu select Add to Program
Monitor.
- The Monitors pane displays the
variable contents.
- Allow the program to run by
clicking on the Run icon on the Debugger Tool bar.
- Click OK on the Customer
Information window.
- Click EXIT
on the Customer Inquiry window to end the debug session and your program.
- Click OK on the Debugger Message
window.
- Close the Debugger by selecting
File from the menu bar.
- Select Exit.
- Click on
to indicate that you've done all the steps.
Debugging VARPG with Windows 95 or Windows 98
Follow these steps:
- To start the debugger click on the
Debug tool bar icon
, or select Project > Debug from the menu bar. The
Debug Session Control window appears followed by another window with the source view of
your program.
- In the source view scroll to the
PRESS action subroutine for the OK push button (PSBOK).
- Set a breakpoint on the CHAIN
statement that sets the focus attributes by double-clicking on the statement number.
.gif)
- Run your application by clicking
on the Run icon
, on the source view Tool Bar.
As you
move the mouse pointer over the Debugger Tool Bar icons, a short description of each icon
displays.
- Enter a customer number on the
Customer Inquiry window and click OK. When the breakpoint is reached, the statement is
highlighted.
.gif)
- To examine the contents of a
program variable, scroll to any statement that contains a variable. This technique does
not work on the EVAL operation code. You can also select the variable name by clicking the
right mouse button and positioning the pointer over the full variable name to highlight
it. When the variable is selected, double-click on it to select the variable for
monitoring.
- Double-click on the variable name.
The Program Monitor window appears with the variable contents.
.gif)
- Allow the program to run by
clicking on the Run icon on the Debugger Tool bar.
- Click EXIT on the Customer Inquiry
window to end the debug session and your program.
- Click Cancel to close the Startup
Information window.
- Close the Debugger - Session
window.
- Click on
to indicate that you've done all the steps.
This completes Exercise 5. You have just added error handling code
and worked with messages and action links. Now you are ready to create another component
to display, in a subfile, a list of customers with their numbers.
But before you do, we recommend
you do the Quiz.