IBM AS/400 Frozen Dessert Maker User Manual


 
Stepping Through the Program Object
Displaying the Contents of an Array
Specifying an array name with EVAL will display the full array. To display one
element of an array, specify the index of the element you wish to display in paren-
theses.
To display a range of elements use the following range notation:
EVAL field-name (n...m)
The variable
field-name
is the name of the array, the variable
n
is a number repres-
enting the start of the range, and the variable
m
is a number representing the end
of the range.
Figure 98 shows the use of EVAL with the array in DBGEX.
> EVAL Arry 3S 2 DIM(2) INZ(1.23)
ARRY(1) = 1.23 ** Display full array **
ARRY(2) = 1.23
> EVAL Arry(2) ** Display second element **
ARRY(2) = 1.23
> EVAL Arry(1..2) ** Display range of elements **
ARRY(1) = 1.23
ARRY(2) = 1.23
Figure 98. Sample EVAL commands for an Array
Displaying the Contents of a Table
Using EVAL on a table will result in a display of the current table element. You can
display the whole table using the range notation. For example, to display a
3-element table, type:
EVAL TableA(1..3)
You can change the current element using the %INDEX built-in function. To deter-
mine the value of the table index, enter the following command:
EVAL _QRNU_TABI_name
where
name
represents the table name in question.
Figure 99 on page 203 shows the use of EVAL with the table in DBGEX.
202 ILE RPG for AS/400 Programmer's Guide