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



Hi,

to return a result set from an SQLRPGLE that will be registered as stored
procedure, you simply need to open the cursor (and let it open).
If several result set must be returned, just open several cursors.
(Since release V5R1 you don't need SET RESULT SET anymore!)

Declare Cursor ...
Close Cursor ... (if it was open from a previous call)
Open Cursor ...
End Program

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von DLee@xxxxxxxx
Gesendet: Wednesday, 22. April 2009 20:08
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: RPG400-L Digest, Vol 8, Issue 306

Mike

Thanks for your reply

It is the result set I want to send back, but I don't know how to handle
that.

I need to give you more information I see I sent the email before I
finished providing information. sorry.

Here is what I have in the sqlrpgle pgm so far.

What I want to do is receive a user selected last name (LNAM) and call
this program thru a stored procedure, and return all the records belonging
to insured with the last name of 'BARON' for example, along with some
other info like first name, and the policy number. In some cases this
could return hundreds of records, which probably needs to be limited
somehow.

I'm not clear what I have to do to return a result set. Below is a
general idea of what I have for sql. Also not sure what I have to do in
the stored procedure.

I have done one external procedure before to pass back parms which seems
to work fine.(pat on backLOL).

Any help is appreciated.


C *ENTRY PLIST
C PARM LNAM
C PARM FNAM
C PARM POLM

D INDTL E DS EXTNAME(NAMS11)

C EXSR SQLOPN

C DOW SQLSTT = *ZEROS
C EXSR SQLGET

C*----------------------------------------------------------------
C* DECLARE SQL CURSOR AND SETUP SELECT STATEMENT
C*----------------------------------------------------------------
C SQLOPN BEGSR
C/EXEC SQL
C+ DECLARE IN CURSOR FOR
C+ SELECT *
C+ FROM SPFILES/INSN001 ORDER BY INLNAM, INPOLM
C/END-EXEC
C/EXEC SQL
C+ OPEN IN
C/END-EXEC
C ENDSR

C*----------------------------------------------------------------
C* GET DETAIL RECORDS FROM FILE RENCDST FILE
C*----------------------------------------------------------------
C SQLGET BEGSR
C/EXEC SQL
C+ FETCH IN INTO :INDTL
C/END-EXEC



Darrell Lee
Information Technology
Extension 17127

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.