× 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.



At least at v5r3, IIRC, the ceiling for the size for any array, field size in 
bytes multiplied by the DIM() value, is still 16 megabytes, apparently, because 
it wouldn't let me go higher.

Chris' example is good for how pointers work, but using pointer arithmetic, you 
can move a working pointer around to anywhere within the allocated size you 
want. The user space, or teraspace, or whatever kind of object it is, is 
already defined and allocated in the caller program, so you don't have to 
allocate it. (With some exceptions I'm sure...) 

For example, define data structures

//======================================
D First20   DS   20   based( p_First20 ) 
D Format1   DS   12   based( p_Format )
...
D Format8   DS   12   based( p_Format )

Entry list:
D RPGpgm    PR           EXTPGM('RPGPGM')
D  Ptr_From_Caller    *

D RPGpgm    PI
D  Ptr_From_Caller    *

P_FIRST20 = P_PtrFromCaller; 

// Process the header 20 bytes here...

P_Format = P_FIRST20 + %size( FIRST20 ) ;

Dou Done ;
Select ;
When  FormatName = 'Format1' ;
   P_Format = P_FIRST20 + %size( FIRST20 );
   // Process the first format here...
   p_Format = P_Format + %size( Format1 ) ;  // Move pointer to next data...

When  FormatName = 'Format2' ;
...etc...
EndSL ;
// Now add the length of the data just processed:
If P_Format - P_First20 > Hdr_Size_Passed;  // -IF- you have fixed lengths...
   Done = *on ;
Endif ;
ENDDO ;
//======================================

If you all you got was how many records, and it's fixed size, you can check 
that as a size against the loop. 

If the whole thing is just null-terminated, &/or the structures of data have 
variable lengths, that's a different scenario but doable.

--Alan


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.