Unexpected Results when Evaluating Variables

If you specify OPTION(*NOUNREF) on the command or Control specification keyword, unreferenced variables in your program source are not generated into the RPG module. If you try to evaluate the unreferenced variable in the debugger, the debugger will indicate that the variable does not exist.

If you are surprised at the value of variables while debugging, check if any of the following is true:
  • Your module is optimized. If the module is optimized, the may not show the most current value of a variable. Also if you change a variable using the debugger, the effects of your change may not be reflected in the way the program runs.
  • Some input fields are not being read from the file. Normally, input fields that are not used in the program are not affected by an input operation. If you specify the DEBUG keyword on your control specification with no parameters, or with a parameter of either *INPUT or *YES, all input fields will be read in.