Midrange News for the IBM i Community

Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Can RPG and SQL be in the same stored procedure?
has no ratings.
Published: 13 Mar 2013
Revised: 19 Mar 2013 - 1923 days ago
Last viewed on: 24 Jun 2018 (3746 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 RPG and SQL be in the same stored procedure? Published by: Chris Proctor on 13 Mar 2013 view comments(4)

Good morning. I'm curious if I can do the following.

Create a stored procedure that calls an RPG program, which builds 2 files (header and detail). Then, execute a couple of SQL statements to retrieve the data from the 2 files as the results sets.

Kinda' like this:



CreateProcedure PollForSAPOrders



specific PollForSAPOrders

externalname spncisaor




declare hdrfile cursor for select.......................

declare dtlfile cursor for select.......................



Any suggestions would be appreciated. The reason I'm wanting to do it this way is so that the RPG program could return a batch# that would be used to select the rows from the files, because multiple jobs could call this at the exact same time.

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