Display the values of variables

You can display the values of program variables when you are at a breakpoint.

You can have this done automatically on the breakpoint display by specifying the variable names on the Add Breakpoint (ADDBKP) command, or you can enter the Display Program Variable (DSPPGMVAR) command at the breakpoint by pressing F10 to show the command entry display. Only 10 variables can be specified on one Display Program Variable (DSPPGMVAR) command. For character and bit variables, you can tell the system to begin displaying the value of the variable starting at a certain position and for a specified length. Variables can be displayed in either character or hexadecimal format.

Note:
  1. If you specify an array variable, you can do one of the following:
    1. Specify the subscript values of the array element you want to display. The subscript values can either be integer values or the names of numeric variables in the program.
    2. Display the entire array by not entering any subscripts.
    3. Display a single-dimension cross-section of the array by specifying values for all subscripts except one, and an asterisk for that one subscript value.
  2. Variable names can be specified as simple or qualified names, but must be placed between apostrophes. A qualified name can be specified in either of two ways:
    1. Variable names alternating with the special separator words OF or IN, ordered from lowest to highest qualification level. A blank must separate the variable name and the special separator word.
    2. Variable names separated by periods, ordered from highest to lowest qualification level.

The following Display Program Variable (DSPPGMVAR) command displays the variable ARBAL used in the program CUS310. CUS310 is the default program, so it does not have to be specified. The entire value is to be displayed in character format.

DSPPGMVAR  PGMVAR('&ARBAL')

The resulting display looks like this:

                      Display Program Variables
 
Program . . . . . . . . . . . . . . . . :   CUS310
Recursion level . . . . . . . . . . . . :   1
Start position  . . . . . . . . . . . . :   1
Format  . . . . . . . . . . . . . . . . :   *CHAR
Length  . . . . . . . . . . . . . . . . :   *DCL
 
Variable  . . . . . . . . . . . . . . . :   &ARBAL
  Type  . . . . . . . . . . . . . . . . :   PACKED
  Length  . . . . . . . . . . . . . . . :   5 2
 '610.00'
 
 
 
 
 
 
 
 
Press Enter to continue.
 
F3=Exit   F12=Cancel
 

Some HLLs allow variables to be based on a user-specified pointer variable (HLL pointer). If you do not specify an explicit pointer for a based variable, the pointer specified in the HLL declaration (if any) is used. You must specify an explicit basing pointer if one was not specified in the HLL declaration for the based variable. The PGMVAR parameter allows you to specify up to five explicit basing pointers when referring to a based variable. When multiple basing pointers are specified, the first basing pointer specified is used to locate the second basing pointer, the second one is then used to locate the third, and so forth. The last pointer in the list of basing pointers is used to locate the primary variable.

Related information
Add Breakpoint (ADDBKP) command
Display Program Variable (DSPPGMVAR) command