L501: Cursor identified in a FETCH or CLOSE statement is not open.

See the section Error SQLCODES in your IBM Database Messages and Codes manual, message -501, for information.