Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Can allocate a larger array size??

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
pch1982cn

New User


Joined: 02 Apr 2006
Posts: 10
Location: Dalian.China

PostPosted: Mon Apr 24, 2006 12:58 pm    Post subject: Can allocate a larger array size??
Reply with quote

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
View user's profile Send private message
References
k_vikram07

New User


Joined: 23 Nov 2005
Posts: 34

PostPosted: Fri Jun 09, 2006 6:00 pm    Post subject:
Reply with quote

Yes You can.

index = 501;
ALLOCATE FD_ARRAY(index);

It allocates the 501th element of FD_ARRAY and so on.

-Vik
Back to top
View user's profile Send private message
pch1982cn

New User


Joined: 02 Apr 2006
Posts: 10
Location: Dalian.China

PostPosted: Mon Jun 12, 2006 7:49 am    Post subject:
Reply with quote

Thanks Vik ..

But this doesn't make sense ..

the first 500 elements are missing then icon_sad.gif
Back to top
View user's profile Send private message
lalgv

New User


Joined: 19 Apr 2006
Posts: 2

PostPosted: Mon Jun 12, 2006 12:50 pm    Post subject: Re: Can allocate a larger array size??
Reply with quote

It is not possible to allocate bigger larger array size without free first array.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1