Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Can an RPG Stored Procedure return 2 data structure result sets?
has no ratings.
Published: 05 Mar 2013
Revised: 06 Mar 2013 - 1937 days ago
Last viewed on: 25 Jun 2018 (5227 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Can an RPG Stored Procedure return 2 data structure result sets? Published by: Chris Proctor on 05 Mar 2013 view comments(2)

Good afternoon. I have a situation where I want to return 2 data structures as results sets and I found that someone on a msgboard said you could just by calling the "set result sets array" twice, once for each DS. I tried it and the stored procedure in iNav didn't like it. Maybe I just have something defined wrong. Anyway, here's what my code looks like:

 

// return result sets to stored procedure

execsqlsetresultsetsarray :SAPOrderHdr for :hrow rows;

execsqlsetresultsetsarray :SAPOrderDtl for :drow rows;

 

And this is what I have defined in the stored procedure:

 

CreateProcedure PollForSAPOrders

 

Resultset2

specific PollForSAPOrders

externalname spncisaor

languageRPGLE

parameterstyleSQL

 

Here was the iNav message:

 

SQL State: 0100C
Vendor Code: 466
Message: [SQL0466] 1 result sets are available from procedure POLLFORSAPORDERS in MM610DVL. Cause . . . . . :   Procedure POLLFORSAPORDERS in MM610DVL was called and has returned one or more result sets. Recovery  . . . :   None.

Statement ran successfully, with warnings   (180 ms)

Low-order nibble of the byte at array offset 70 is not valid.  Byte value: 40.

Processing ended because the highlighted statement did not complete successfully

 

Any suggestions would be greatly appreciated!  Cool  

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS