|
define the array as based. Here is an 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 Thanks, Mark Mark Walter Sr. Programmer/Analyst Hanover Wire Cloth a div of CCX, Inc. mwalter@hanoverwire.com http://www.hanoverwire.com 717.637.3795 Ext.3040
As an Amazon Associate we earn from qualifying purchases.
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.