An application can close a cursor before fetching all its rows by sending a cursor-close command and handling the results. See “Step 5: Close the cursor” for more details.
Closing a cursor is preferred over calling ct_cancel to discard unwanted cursor rows for the following reasons:
Calling ct_cancel(CS_CANCEL_ALL) or ct_cancel(CS_CANCEL_ATTN) can cause a connection’s cursors to go into an undefined state.
Calling ct_cancel(CS_CANCEL_CURRENT) can waste network bandwidth. This call causes Client-Library to fetch the remaining rows over the network and discard them.