5.5 Monitoring and Changing Variables
From the Source pane or the Monitors menu, you can add variables and expressions to the Monitors pane,
so that you can keep track of how their contents change during program execution. You can add multiple
variables and expressions to the Monitors pane from the Monitors menu.
To add a variable or expression to the Monitors pane from the Source pane
-
In the Source pane, select or double-click the variable or expression you want to monitor.
For this lesson, select CUSTNO.
-
Right-click on the highlighted variable, and select
Add to Program Monitor from the pop-up menu.
To add a variable or expression to the Monitors pane from the Monitors menu (Optional)
For this lesson we will not be adding an actual variable or expression from the Monitors
menu. If you wish to familiarize yourself with this process, please note the steps below.
- In the Source pane, you may optionally select or double-click the variable or
expression you want to monitor. If this step is completed, the
variable or expression will appear in the Enter expression to be
evaluated field of the Monitor Expression dialog box and entering the
variable's name in this field will not be required.
- Select Monitors > Monitor Expression from the menu bar
to invoke the Monitor Expression dialog box.
- If step 1 was not completed, enter the variable or expression you want to
monitor in the Enter expression to be evaluated field.
- The Program monitor radio button is selected by default.

- Click OK to add the variable or expression to the monitor and dismiss
the dialog box.
Modifying a variable's value
- After adding a variable to be monitored, click on the Monitors tab in the
main debugger window.
- Double-click on the value of the variable CUSTNO.
The field changes into an entry field.

- Type in the new value 0010100 for the variable
CUSTNO and press Enter.

The variable CUSTNO is successfully changed to 0010100.
Click on
to indicate that you have completed these steps.