× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



With such a limitation I do not think an array would work in this instance.  
So I am back to square one :) Oh well it was a nice thought.


On Tue, 29 Mar 2005 16:29:13 +0200, Igor.Beslic wrote
> It's true that this is good way way for saving necessary mem space 
> but still  this array is limited to 20000 elements!! For exapmple 
> replace line C     1             DO        50            index with this
>  C     1             DO        20001         index
> 
> and you'll get a array out of bounds error at line
> C                   MOVE      index         array(index)
> 
> Best regards,
> Igor Be¹liæ, dipl. ing. raè. 
> VOLKSBANK d.d.
> OJ Informatika
> Zelinska 2, 10000 Zagreb
> tel: +385 1 6326422
> 
> MWalter@xxxxxxxxxxxxxxx 
> Sent by: rpg400-l-bounces@xxxxxxxxxxxx
> 29.03.2005 16:15
> Please respond to
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> 
> To
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> cc
> 
> Subject
> Re: Arrays
> 
> Yes, you'll have to base you're array on a pointer. Then increase the
> allocation size. Take a look at the ALLOC, REALLOC, and DEALLOC op codes.
> Here's a quick example:
> 
>   * array definitions
>  Darray            S             10    DIM(20000) BASED(PTR)
>  Dindex            s              7  0
>   * memory allocation data items
>  Dptr              S               *
>  Dnbr_of_elems     S              5  0 INZ(10)
>  Dmem_size         S              7  0 INZ
>  Dx                S             10i 0
>   * allocate the initial memory heap (initial # of elements * the 
> size of the array) C                   EVAL      mem_size = 
> %size(array) * nbr_of_elems C                   ALLOC     mem_size   
>    ptr C                   EVAL      x = %elem(array)  * loop to 
> test C     1             DO        50            index  * does the 
> index exceed the current # of array elements? C                   IF 
>        index > nbr_of_elems  * recalculate the memory heap size by 
> adding 10 to the number of elements  * and multiplying the size of 
> the array by the new number of elements. C                   EVAL    
>   nbr_of_elems = nbr_of_elems + 10 C                   EVAL      
> mem_size = %size(array) * nbr_of_elems * reallocate the memory heap 
> and increase the size C                   REALLOC   mem_size     
>  ptr C                   ENDIF * move data for test C                
>    MOVE      index         array(index) * C                   ENDDO 
> * deallocate the memory utilized C                   DEALLOC         
>         ptr C                   EVAL      *inlr = *on 
> ****************** End of data *******************************************
> Thanks,
> 
> Mark
> 
> Mark D. Walter
> Senior Programmer/Analyst
> CCX, Inc.
> mwalter@xxxxxxxxxx
> http://www.ccxinc.com
> 
>              "Douglas W. 
>              Palme" 
>              <dpalme@blackcats                                       
>    To
> 
>              olutions.com>             "RPG Group" <rpg400-
> l@xxxxxxxxxxxx>
> 
>              Sent by:                                                
>    cc
> 
>              rpg400-l-bounces@ 
>              midrange.com                                          
> Subject
> 
>                                        Arrays
> 
>              03/29/2005 09:08 
>              AM
> 
>              Please respond to 
>               RPG programming 
>               on the AS400 / 
>                   iSeries 
>              <rpg400-l@midrang 
>                   e.com>
> 
> In using VB and C I have the ability to dynamically increase an array's
> size
> from say 50 to 100 without losing the existing data, is this 
> possible in RPG?
> 
> >From all that I have been able to read on arrays in RPG so far I don't 
> see
> 
> it as possible, but I'm hoping there is something available that the 
> books and PDF's don't cover.
> 
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.


--
Open WebMail Project (http://openwebmail.org)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.