View previous topic :: View next topic
|
Author |
Message |
pch1982cn
New User
Joined: 02 Apr 2006 Posts: 10 Location: Dalian.China
|
|
|
|
All,
Look at the code below:
Code: |
DCL FD_ARRAY_LENGTH FIXED BIN(31) INIT(200);
DCL FD_ARRAY_MAX FIXED BIN(31) INIT(0);
DCL 1 FD_ARRAY (FD_ARRAY_LENGTH) CONTROLLED
,5 TERR_TYPE CHAR(18)
FD_ARRAY_LENGTH = 500;
ALLOCATE FD_ARRAY;
DO WHILE(MORE_DATA);
FD_ARRAY_MAX = FD_ARRAY_MAX + 1;
IF FD_ARRAY_MAX > FD_ARRAY_LENGTH THEN
/* ARRAY SIZE IS NOT LARGE ENOUGH */
ELSE
FD_ARRAY.TERR_TYPE(FD_ARRAY_MAX) = '....';
END;
|
In the section of comments. Can I allocate a larger array size? I don't want to have the first 500 values lost. i.e. don't want to FREE first and ALLOCATE again.
Is it possible in PL/1? Thx! |
|
Back to top |
|
|
k_vikram07
New User
Joined: 23 Nov 2005 Posts: 35
|
|
|
|
Yes You can.
index = 501;
ALLOCATE FD_ARRAY(index);
It allocates the 501th element of FD_ARRAY and so on.
-Vik |
|
Back to top |
|
|
pch1982cn
New User
Joined: 02 Apr 2006 Posts: 10 Location: Dalian.China
|
|
|
|
Thanks Vik ..
But this doesn't make sense ..
the first 500 elements are missing then |
|
Back to top |
|
|
lalgv
New User
Joined: 19 Apr 2006 Posts: 2
|
|
|
|
It is not possible to allocate bigger larger array size without free first array. |
|
Back to top |
|
|
|