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



hhmm. Unless you are using CLI, I didn't think RPG can consume SQL result
sets. I guess my question would be how the Customer array/MDS get
populated? By a pure RPG code or some sort of SQL. It might be easier for
you to simply post some code for other to get a better understanding of your
process.

As far as clearing the array, memset is a bit of an over kill. RPG %subst
would be much easier for the next programmer to digest.
%subst(myDS :1 :mySize) = *blank; //Depending on your code, this might not
work if the array contain numeric variable.




"Bryce Martin" <BMartin@xxxxxxxxxxxx> wrote in message
news:mailman.10701.1288286436.2702.rpg400-l@xxxxxxxxxxxxxxx
The StoredProc simply has the following statement to return the result
set....
Exec SQL
Set result sets array :Customer for :ResultsCount rows;

There isn't anything to close.




Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



"hockchai Lim" <lim.hock-chai@xxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/28/2010 11:37 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
rpg400-l@xxxxxxxxxxxx
cc

Subject
Re: Memory being reused by %alloc on second call to program.






You must be pretty luck. I'm surprise you did not get junk data on the
first run, which makes me wonder if the problem could be caused by other
thing. Could the problem be caused by the StoredProc did not close and
reopen the sql statement on the second call?




"Bryce Martin" <BMartin@xxxxxxxxxxxx> wrote in message
news:mailman.10648.1288273092.2702.rpg400-l@xxxxxxxxxxxxxxx
I have written my first external stored procedure and it uses dynamic
memory allocation to create a couple of 2D arrays. The problem that I'm
seeing is this...

ProgramA using CLI calls StoredProc. StoredProc
%alloc/%realloc/%dealloc
and uses a regular static array for returning a result set.

ProgramA is two screens. First screen has fields to search by. If I
enter criteria and hit enter ProgramA then calls StoredProc. ProgramA
then processes the ResultSet and puts it into a subfile for viewing. If
I
F12 back to the first screen and change my search criteria to something
that shouldn't return results it still does but refined by whatever I
just
searched by. If I F3 out of ProgramA then all the memory used by the
StoredProc is released even if I don't do a RCLACTGRP of ProgramA's
activation group. If I search a second time after doing the full exit
by
the criteria that should not return results then it works and returns no
results. (no results could also be a search that is too generic to have
good results, this is handled by the StoredProc).

In the StoredProc I am doing the following Destroy call, the
DestroyArray() procedure just take a pointer to an array memory address
and does a dealloc(n) pWholeArray;

pArrayElem = *null;
DestroyArray(pWholeArray);
pWholeArray = *null;

I nulled the pointers for good measure but that didn't do anything.

It looks like the second call is doing an %alloc and starting at the
same
memory address as the previous call had done. So when I %alloc a block
the memory already contains the data from the previous call. How do I
handle this?

Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
--- This message (including any attachments) is intended only for the
use
of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and
exempt from disclosure under applicable law. If you are not the intended

recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited.
If
you have received this communication in error, please notify us and
destroy this message immediately. ---


--
This is the RPG programming on the IBM i / System i (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 message (including any attachments) is intended only for the use
of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential, and
exempt from disclosure under applicable law. If you are not the intended
recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this communication in error, please notify us and
destroy this message immediately. ---



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.