**************************************************************** * Program RESULTSETS * * Stored procedure, return multiple result sets * * For use with Net.Data macro to demonstrate multiple * result set capability of Net.Data. * * Use the following command to compile this program: * * CRTSQLRPGI OBJ(lib/RESULTSETS) SRCFILE(lib/QRPGLESRC) * * In the SQL environment, use the following command to * catalog the stored procedure: * * create procedure resultsets * (input p1 char(4), * input p2 decimal(3,0), * input p3 char(4)) * external name lib_name/resultsets * language rpgle general **************************************************************** C**************************************************************** C* Parameters passed to stored procedure: C* C* pmcust - customer ID C* pmdistrict - district ID C* pmwarehs - warehouse ID C**************************************************************** C* C *entry plist C parm pmcust 4 C parm pmdistrict 3 0 C parm pmwarehs 4 C**************************************************************** C* Execute SELECT statement for customer file (cursor C1) C**************************************************************** C/exec sql C+ C+ declare C1 cursor for C+ C+ select * from csdb/cstmr C+ C+ where CID = :pmcust and C+ CDID = :pmdistrict and C+ CWID = :pmwarehs C+ C+ for fetch only C+ C/end-exec C/exec sql C+ C+ open C1 C+ C/end-exec C**************************************************************** C* Execute SELECT statement for item file (cursor C2) C**************************************************************** C/exec sql C+ C+ declare C2 cursor for C+ C+ select * from csdb/orders C+ C+ where OCID = :pmcust and C+ ODID = :pmdistrict and C+ OWID = :pmwarehs C+ C+ order by oid C+ C+ for fetch only C+ C/end-exec C/exec sql C+ C+ open C2 C+ C/end-exec C**************************************************************** C* Set result sets to return cursor C1 and C2 C**************************************************************** C* C/exec sql C+ C+ set result sets cursor C1, cursor C2 C+ C/end-exec C eval *inlr = *on C return