Error
SQLCODE -501
Cursor not open
Explanation
FETCH or CLOSE attempted on a cursor that is not open.
Solution
Verify cursor is opened before FETCH. Check program flow for OPEN statement.
Example
FETCH cursor-name before OPEN cursor-name