ILE C/C++ Programmer's Guide


Changing the Value of a Scalar Variable

Change the value of scalar variables using the EVAL debug command with an assignment operator (=). The program must be called and stopped at a breakpoint or step location to change the value. To change the value of a variable, enter:

EVAL variable-name = value

where variable-name is the name of the variable that you want to change and value is an identifier, literal, or constant value that you want to assign to variable variable-name.

Example:

EVAL COUNTER=3

changes the value of COUNTER to 3 and shows

COUNTER=3 = 3

on the message line of the Display Module Source display.

When you assign values to a character variable, the following rules apply:

The scope of the variables used in the EVAL debug command is defined by using the QUAL debug command. To change a variable at line 48, enter QUAL 48. Line 48 is the number within a function to which you want the variables scoped for the EVAL debug command.

Note:
You do not always have to use the QUAL debug command before the EVAL debug command. An automatic QUAL is done when a breakpoint is encountered or a step is done. This establishes the default for the scoping rules to be the current stop location.

The example below shows the results of changing the array element at 1 from $ to #.

Figure 73. Using EVAL to Change a Variable


     EVAL hold_formatted_cost [1] = '#'
        hold_formatted_cost[1]= '#' = '#':
 
     //Code evaluated before statement 51 where a breakpoint is set
     47      if (j<0) return(0);
     48      if (hold_formatted_cost[i] == '$')
     49      {
     50        formatted_cost[j] = hold_formatted_cost[i];
     51        break;
     52      }
     53      if (i<16 && !((i-2)%3))
     54      {
     55        formatted_cost[j] = ',';
     56        --j;
     57      }
     58      formatted_cost[j] = hold_formatted_cost[i];
     59      --j;
     60    }
     61


[ Top of Page | Previous Page | Next Page | Table of Contents ]