|
>Date: Thu, 28 Sep 2000 11:43:46 -0400 >From: Buck Calabro <buck.calabro@aptissoftware.com> > >I'm writing a boilerplate for QDBRTVFD (Retrieve file description API). The >maximum RPG IV string size is 32kb. The FILD0200 request for a particular >file is returning 49kb of data. I've used a multiple occurrence data >structure and a based pointer to move an internal data structure around >(which works), but can I rely on the compiler always storing the occurrences >one after the other (to form one block of contiguous API populated memory?) >Is there a better way? (I hope so!) Should I use C? (sigh) Buck, a multiple occurrence data structure always has contiguous occurrences. It must, in case the data structure is passed as a parm, and for debuggers to work. Oh, by the way, the maximum length of a field and I think also a data structure, is 65535, starting in V4R2. But this is a perfect place to use allocated storage. Call the API once with a tiny receiver to find out how much storage you need, then allocate the storage and call it again. Do your stuff, then deallocate. D basicRcvr ds D 10i 0 D rcvrLen 10i 0 D QDBRV ds based(pQDBRV) D subfields ... C callp QDBRTVFD (basicRcvr : %size(basicRcvr) : ... C alloc(e) rcvrLen pQDBRV C if %error C ... oops ... storage not available ... C endif C callp QDBRTVFD (QDBRV : rcvrLen : ... C do your stuff C dealloc pQDBRV Another way to handle it is to declare your basicRcvr with some "normal" length, and only do the allocation/deallocation if the required length is longer. C callp QDBRTVFD (basicRcvr ... C if rcvrLen > %size(basicRcvr) C alloc(e) ... %error etc ... C callp QDBRTVFD (QDBRV : rcvrLen : ... C eval needToDealloc = *ON C else C eval pQDBRV = %addr(basicRcvr) C endif C do your stuff C if needToDealloc C dealloc pQDBRV C endif Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.