The CLOSE function closes an open Connect CDC (SQData) cursor and releases the resources associated with the current query.
If the function fails, Connect CDC (SQData) sets the job fatal and processing stops.
Tip:
CLOSE() is the explicit companion to OPEN() and FETCH() when you manage cursor processing yourself. FOREACH() performs its own open and close processing automatically for cursor iteration.Category
Cursor Functions
Syntax
CLOSE(cursor_name)Parameters and descriptions
| Parameter | Description |
|---|---|
cursor_name
|
Name of a cursor created with CREATE RDBMS CURSOR, CREATE VSAM CURSOR, or CREATE IMS CURSOR. |
Usage
- Call
CLOSE()after you finish processing rows withFETCH(). -
CLOSE()returns an empty string on success and is normally used as an action function rather than as a value in an expression. - Closing the cursor makes the current query inactive and completes the explicit cursor lifecycle started by
OPEN().
Example
OPEN(SQDATA_RDBMS_CURSOR)
IF FETCH(SQDATA_RDBMS_CURSOR) = '0'
DO
TARGET_ACCOUNT_ID = SQDATA_CURSOR_ROW.ACCOUNT_ID
END
CLOSE(SQDATA_RDBMS_CURSOR)