I have read through the IBM manual "Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for iSeries" for information related to returning a result set(s) from a stored procedure into an RPG program. The manual states that a Global Temporary table must be used for this as it cannot access the result set once control has returned back to the RPG.
My question is this: If I declare the global temporary table in the stored procedure on the fly, how do I access its contents in the RPG?
It seems to me that I would used embedded SQL in the RPG and access the GTT data through a cursor, but how would the cursor definition look in the RPG? Wouldn't the compiler complain that it doesn't have the definition of the global temp table.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!