IBM AS/400 manual Displaying the Contents of an Array, Displaying the Contents of a Table

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 226
Image 226
Displaying the Contents of an Array

Stepping Through the Program Object

Displaying the Contents of an Array

Specifying an array name with EVAL will display the full array. To disp element of an array, specify the index of the element you wish to theses.

To display a range of elements use the following range notation:

EVAL field-name (n...m)

The

variablefield-name is

the

name

of the array,n isthea variablenumber repres-

enting the start of

the

range,

andm

isthea

variablenumberrepresenting 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 e display the whole table using the range notation. For example, to displ

3-element table, type:

EVAL TableA(1..3)

You

can

change

the

current

element

using the %INDEX built-in function. To

mine

the

value

of the table

index,

enter

the

following command:

EVAL _QRNU_TABI_name

 

 

 

 

 

 

 

 

 

wherename

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

Page 226
Image 226
IBM AS/400 Displaying the Contents of an Array, Displaying the Contents of a Table, Stepping Through the Program Object