I have a Java function that invokes a DB2 stored procedure and expects a result set from a cursor. My problem is I want to do some other processing in that stored procedure, so I need to look at each row fetched, which doesn't work very well in a COBOL stored procedure with the cursor declared "FOR RETURN". If I don't declare the cursor this way, it returns a single result. I could build the entire result set in an array in the stored procedure, but it would be formatted wrong for Java to handle as a result set. I have seen similar samples using DB2 temporary tables, but the overhead of using them is prohibitive.
Does anyone know a way to accomplish this? What if I don't want to do any DB2 SQL in the stored procedure at all, I just want Java to think I did? If you have a way to do this that requires more time and effort than just a simple answer here, I can get you some compensation.