Use the CLOSE command to close an open cursor that was defined with the DECLARE CURSOR command.
Options
cursorname
Specifies a 1 to 18 character cursor name that has been previously specified by the DECLARE CURSOR command and opened with the OPEN command.
About the CLOSE Command
Cursors are pointers to rows in a table, and are defined using the DECLARE CURSOR command. When you no longer want to use the cursor but want to retain it for later use, use the CLOSE command to close the cursor. When you open the cursor again, it is positioned at the beginning of the set of rows defined by the DECLARE CURSOR command.
Use the LIST CURSOR command to list all of the currently defined cursors and whether the cursor is opened or closed.
When you close a cursor, most of the memory taken by the cursor definition is returned. If the DECLARE CURSOR command used any file handles, they are released.
Example
The following command makes the rows defined by the DECLARE CURSOR command as cursor1 unavailable. To use the information defined by cursor1 again, you need to reopen the cursor with the OPEN command.
CLOSE cursor1