IBM AS/400 Frozen Dessert Maker User Manual


 
Changing the Value of Fields
Use the %VARS debug built-in function when the variable name conflicts with any
of the debug command names. For example, EVAL %VAR(EVAL) can be used to
evaluate a variable named EVAL, whereas EVAL EVAL would be a syntax error.
Changing the Value of Fields
You can change the value of fields by using the EVAL command with an assign-
ment operator (=).
The scope of the fields used in the EVAL command is defined by using the QUAL
command. However, you do not need to specifically define the scope of the fields
contained in an ILE RPG module because they are all of global scope.
To change the value of the field, type:
EVAL field-name = value
on the debug command line.
field-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
field-name
. For 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.
Use the EVAL debug command to assign numeric, alphabetic, and alphanumeric
data to fields. You can also use the %SUBSTR built-in function in the assignment
expression.
When you assign values to a character field, the following rules apply:
If the length of the source expression is less than the length of the target
expression, then the data is left justified in the target expression and the
remaining positions are filled with blanks.
If the length of the source expression is greater than the length of the target
expression, then the data is left justified in the target expression and truncated
to the length of the target expression.
Note: Graphic fields can be assigned any of the following:
Another graphic field
A graphic literal of the form G'oK1K2i'
A hexadecimal literal of the form X'hex digits'
| UCS-2 fields must be changed using hexadecimal constants. For example, since
| %UCS2('AB') = U'00410042', then to set a UCS-2 field to the UCS-2 form of 'AB' in
| the debugger, you would use EVAL ucs2 = X'00410042'.
| Variable-length fields can be assigned using, for example, EVAL varfldname =
| 'abc'. This sets the data part of the field to 'abc' and the length part to 3. To set the
| length part without changing the data, determine the hexadecimal value of the
| length (for example 11 is X'000B'), and use EVAL %SUBSTR(varfldname 1 2) =
| X'000B'.
208 ILE RPG for AS/400 Programmer's Guide