When the cursor has completed its work, usually by encountering no more data, you must CLOSE it.
EXEC SQL CLOSE cursorname END-EXEC.
EXEC SQL CLOSE COBCUR1 END-EXEC.