I want to pass cursor and data structure to a procedure, the procedure then populates the structure with the next row from the sql cursor. Is this possible? A template of what I am trying to achive is below.
*****************************************************
*
* Fetch the next row from a cursor
*
* @param cursor - the name of the cursor
* @param structure - the data structure to hold the fields
*****************************************************
pfetchNextRow B
DfetchNextRow PI N
d cursor 32767A varying const
d structure DS ???????
/free
exec sql
fetch next from :cursor into :structure
;
if (sqlstate = SQL_SUCCESS);
return *on;
else;
exec sql
close :cursor;
return *off;
endif;
/end-free
pfetchNextRow E
How sould I pass the cursor, and how would I define the data structure parameter?