Display variables

You can display the value of variables using the Display Module Source display or the EVAL debug command.

To display a variable using the Display Module Source display , place your cursor on the variable that you want to display and press F11 (Display variable). The current value of the variable is shown on the message line at the bottom of the Display Module Source display.

Figure 1. Display a Variable using F11 (Display variable)
                             Display Module Source
 
 Program:   DSPWKDAY       Library:   MYLIB          Module:   DSPWKDAY
      4               DCL        VAR(&MSGTEXT) TYPE(*CHAR) LEN(20)
      5               CALL       PGM(WEEKDAY2) PARM(&DAYOFWK)
      6               IF         COND(&DAYOFWK *EQ 1) THEN(CHGVAR +
      7                            VAR(&WEEKDAY) VALUE('Sunday'))
      8               ELSE       CMD(IF COND(&DAYOFWK *EQ 2) THEN(CHGVAR +
      9                            VAR(&WEEKDAY) VALUE('Monday')))
     10               ELSE       CMD(IF COND(&DAYOFWK *EQ 3) THEN(CHGVAR +
     11                            VAR(&WEEKDAY) VALUE('Tuesday')))
     12               ELSE       CMD(IF COND(&DAYOFWK *EQ 4) THEN(CHGVAR +
     13                            VAR(&WEEKDAY) VALUE('Wednesday')))
     14               ELSE       CMD(IF COND(&DAYOFWK *EQ 5) THEN(CHGVAR +
     15                            VAR(&WEEKDAY) VALUE('Thursday')))
     16               ELSE       CMD(IF COND(&DAYOFWK *EQ 6) THEN(CHGVAR +
     17                            VAR(&WEEKDAY) VALUE('Friday')))
     18               ELSE       CMD(IF COND(&DAYOFWK *EQ 7) THEN(CHGVAR +
                                                                        More...
 Debug . . .   
 

 F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable
 F12=Resume    F17=Watch Variable    F18=Work with watch     F24=More keys
 &DAYOFWK = 3.
You can also use the EVAL debug command to determine the value of a variable. To display the value of a variable using the EVAL debug command, type the following on the debug command line:
EVAL variable-name

Variable-name is the name of the variable that you want to display. The value of the variable is shown on the message line if the EVAL debug command is entered from the Display Module Source display and the value can be shown on a single line. If the value cannot be shown on a single line, it is shown on the Evaluate Expression display.

For example, to display the value of the variable &DAYOFWK; on line 7 of the module object shown in the example above, type:

EVAL &DAYOFWK

The message line of the Display Module Source display shows &DAYOFWK = 3. as in the example above.

The scope of the variables used in the EVAL command is defined by using the QUAL command. However, you do not need to specifically define the scope of the variables contained in a CL module because they are all of global scope.

Related concepts
Debug commands