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.
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.
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.