I have an SQL stored procedure that returns a result set. (SQL external proc wraps an SQLRPGLE that does an "exec sql set result set")
I want to get that data in an RPGLE program. I have found the ITJungle article on using sql ALLOCATE CURSOR in SQLRPGLE: https://www.itjungle.com/2010/08/25/fhg082510-story02/
And that works. However, that fetches all the columns from the result set and I do not want all the columns. But I don't see a way of selecting only the columns I want? Is that possible?
I can partially work around this by fetching into a DS that contains only the first x columns, and ensuring new columns are only added to the end, though that does mean I have to deal with an SQL 01503 warning.
(I also found a possible IBMi bug, in that doing a bulk fetch "fetch from csr for x rows into :var", SQLER3 (number of rows returned) is 0 if x is greater than the number of available rows.)
I want to get that data in an RPGLE program. I have found the ITJungle article on using sql ALLOCATE CURSOR in SQLRPGLE: https://www.itjungle.com/2010/08/25/fhg082510-story02/
And that works. However, that fetches all the columns from the result set and I do not want all the columns. But I don't see a way of selecting only the columns I want? Is that possible?
I can partially work around this by fetching into a DS that contains only the first x columns, and ensuring new columns are only added to the end, though that does mean I have to deal with an SQL 01503 warning.
(I also found a possible IBMi bug, in that doing a bulk fetch "fetch from csr for x rows into :var", SQLER3 (number of rows returned) is 0 if x is greater than the number of available rows.)
Comment