Displaying or Changing the Value of Variables - IBM-ILE

You can display the value of scalar variables, expressions, structures, arrays, or errno and change the value of scalar variables and errno using the eval debug command. The module that is shown on the Display Module Source display must be bound to a program that is in a debug session. The scope of the variables used in the eval debug command is defined by using the qual debug command.The program must be called and stopped at a breakpoint or step location to display or change the value.

  • The eval debug command
  • F11(Display variable)

You can use the Enter key as a toggle switch between displays. You can change variables by using the eval debug command with assignment.

Example

This example shows you how to use the F11 (Display variable) to display a variable.

  1. Type DSPMODSRC and press Enter.The Display Module Source display is shown.
  2. Type display module T1520IC2, and press Enter.
  3. Place the cursor on the variable hold_formatted_cost on line 50 and press F11 (Display variable). A pointer to the array is shown on the message line in the following.
  4. Displaying or Changing the Value of Variables

    Messages with multiple line responses will cause the Evaluate Expression display to be shown. This display will show all response lines. It also shows a history of the debug commands entered and the results from these commands. To return to the Display Module Source display, press the ENTER key. You can use the Enter key as a toggle switch between displays. Single-line responses will be shown on the Display Module Source message line.

    You can also use the eval debug command to determine the value of an expression. For example, if j has a value of 1024, type eval (j * j)/512 on the debug command line. You use the qual debug command to determine the line or statement number within the function that you want the variables scoped to for the eval debug command. The Evaluate Expression display shows ( j * j)/512 = 2048.

Example

This example shows you how to use the eval debug command to assign an expression to a variable.

  1. Type DSPMODSRC and press Enter. The Display Module Source display is shown.
  2. Type display module T1520IC2, and press Enter.
  3. To specify the scope of the eval command you can use a qualify command.For example, qual 48. will qualify the eval command to the scope that line 48 is located at. Line 48 is the number within the function to which you want the variables scoped for the following eval debug command.
  4. 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.

  5. To change an expression in the module shown type: eval x=<expr> where x is the variable name and <expra> is the expression you want to assign to variable x.
  6. For example, ″eval hold_formatted_cost [1] = ’#’″ changes the array element at 1 from $ to # and shows ″hold_formatted_cost[1]= ’#’ = ’#’:″ on the Display Module Source display as shown:

    Display Module Source display as shown


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM-ILE Topics