As you debug, the
Watch window displays the values of variables and expressions.
To display the window, click
Debug > Windows > Watch > Watch
n while debugging.
Use the
Watch window to:
- View the value of variables using one of these methods to add a variable to the
Watch window:
- Right-click a variable in the editor and click
Add Watch.
- In the
Watch window, click an empty row in the
Name column, and type a variable.
- View the value of expressions by clicking an empty row in the
Name column, and typing an expression.
The supported expressions are: normal numeric arithmetic expression with intrinsic functions and the single use of alphanumeric
intrinsic functions. For example, if you have the following variables defined:
01 a pic 999 value 2.
01 b pic xxxx comp-x value 3.
01 xyz value "abc".
You can use expressions of the type:
a + b * 1
a + function max(10,20)
function upper-case(xyz)
1 + 10
function hex-of(b)
The following expressions are not supported - logical operators such as b-and and b-or; ISO2002 user defined methods; inline
method invokes, and intrinsic functions which are evaluated at compile time.
- Change the display format for all values from decimal to hexadecimal by right-clicking in the
Watch window, and then clicking
Hexadecimal Display.
- Change the display format of values on an individual row:
- Select a row.
- Press
F2.
- Type a modifier after the name of the variable or the expression as follows:
- h or x
- Type
Variable,h or
Variable,x to always display the variable or the expression in hexadecimal format.
- d
- Type
Variable,d to always display numeric variables in decimal format and strings - as text.