Setting the value of a variable

From m204wiki
Jump to navigation Jump to search

You may set or update the value of certain types of variables with the Janus and TN3270 Debuggers. The following types of variable values may be modified:

  • String %variables
  • Unicode %variables
  • Float %variables
  • Fixed %variables
  • Longstrings  (255 character limit)
  • Global variables
  • Screen and Image items
  • Boolean enumeration variables (only True and False [case not important] are valid values)

Currently, only scalar variables may be set; array elements may not be set. In addition, most object variables may not be set.

To set the value of a variable with the Debugger:

  1. Add the variable to the Watch Window.
  2. In the Watch Window, right click the variable.
If this type of variable can be set, and it is settable at this point in the execution of the program, the Change Value context menu option is enabled.
3. Select Change Value.
A Set %var dialog box like the following displays, where %var is replaced by the variable you are modifying, and the variable's current value is displayed:
setvarWin3
4. Specify the new variable value, and click Set or press the Enter key.
The Watch Window is refreshed with the new value, Variable Set displays in the Status bar, and the new value becomes the current value of the variable in the program at the current point of program execution.

The setM204Data command is equivalent to right clicking a Watch Window item and selecting Change Value.

Note: Setting a new value in the Debugger follows the rules of User Language assignment. For example, specifying a text value for a float variable results in setting the variable to zero.

See Also:

Watching program data items
Displaying temporarily the value of a program data item