Re: rpgle, pcml & arrays




"Eric Masson" <emss@xxxxxxx> wrote in message
news:fm32a5-qnv1.ln1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I'd like to create rpgle code that would return an unbounded array
(list
of PF records which size isn't known when calling).

From different readings, it seems I'll have to mess with dynamic
memory
allocation (user heap or Alloc/Realloc/Dealloc).

If the program allocates memory on demand to store the array, fills it
and then returns, I suppose memory leaks will happen, no ?

Is there any simple way to proceed except by providing 3 procedures :
- first one returns records (bounded by maximum allocation limits)
- second one returns next records (bounded by maximum allocation
limits)
and will eventually get called until no more records are returned
- third one cleanups memory allocations.

Last but not least, if these procedures are exposed via iSeries Web
Services Server (SI30196), is the context (memory allocation and file
pointers) preserved beetween each call ?

Regards

Éric Masson

--
NC> J'ai perdu tous mes messages reçus, alors, je n'ai plus ton nom.
BB>Curieux chez l'utilisateur d'OE 5 cette manie de perdre les
messages
Mais non, c'est une des principales caracteristiques d'Outlook
Express,
-+-RG in <http://www.le-gnu.net> : La cuisine au bug -+-

SQL provides a way for a stored procedure to return a result set. You
can construct result set from a query or
from an array.

look at the SET RESULT SETS FOR CURSOR statement.

You can use this in a stored procedure written in a HLL using embedded
SQL or in
a store procedure in SQL stored procedure statements.




.



Relevant Pages

  • Re: appending elements to an ALLOCATABLE array
    ... this feature would allow you to expand memory ... It is not a problem of allocation, ... In C this can be done using an array of pointers to dynamically ... Linked lists work very well for applications that address the data ...
    (comp.lang.fortran)
  • Re: Releasing memory (continuation)
    ... heap when it is explicitly deallocated, and may then be used to service ... subsequent allocation requests within that process. ... memory and paging file resources are returned to the O/S. ... > UDTs array would be the fastest). ...
    (microsoft.public.vb.general.discussion)
  • Re: return a string
    ... Declare a static array of char in your ... mallocmemory for the string inside your function ... >> provide a way to use an alternative allocation function. ... Pass an already allocated buffer and its size to your function. ...
    (comp.lang.c)
  • Re: Finding out minimal allocation unit
    ... type List is access all Cell1; ... Items: array (1 .. ... is _exactly_ an allocation size as the Cell2 has the necessary Used ... worse in memory consumption than a list of Cell1, ...
    (comp.lang.ada)
  • Re: How to release heap memory that is marked as free
    ... As I said, fragmentation is a very serious problem, and one of the most serious problems ... my allocator was accused of using massive amounts of memory. ... I'm going to have to re-think the memory allocation that I'm ... process's 'working set'. ...
    (microsoft.public.vc.mfc)