Arrays in As400
Arrays in As400
100
200
300
400
UNIQUE
4S 0
4S 0
4S 0
20A
RTA
EAGE EADDR
23 ashok
0001.00
0002.00 Fpf1
it f 32
disk
0003.00 Darray1
s
32a dim(4) fromfile(pf1)
0004.00 Darray2
s
32a dim(4)
0005.00 Dd
s
4s 0
0006.00 C
movea array1
array2
0007.00 C 1
do
4
d
0008.00 C d
dsply
0009.00 C array1(d) dsply
0010.00 C
enddo
0011.00 C
eval
*inlr=*on
0012.00 C
return
output is:-a
DSPLY 1
DSPLY 000120000023ashok
DSPLY 2
DSPLY
DSPLY 3
DSPLY
DSPLY 4
DSPLY
output is :DSPLY 1
DSPLY 00012000002300100
DSPLY 2
DSPLY
00200
DSPLY 3
DSPLY
00300
DSPLY 4
DSPLY
00400
summary :1) for compile time array as we give input from program itself we directly declare array
2)for runtime array and prerun time array we have to specify the database file(pf1 here) using fromfile
keyword
3)in preruntime array prog when we give a 5s 0 then it allocates 5 digits but from left or right will be
known by the command used move,movea rightjustified
so see that instead of ASHOK it took 00000 by default first then inserted 00100,00200,...till 00400
4)if we use movel instead of move then the output will be 0010020000023ashok
see prog once again
output is :DSPLY 1
DSPLY 001000000023ashok
DSPLY 2
DSPLY 00200
DSPLY 3
DSPLY 00300
DSPLY 4