The OPEN function opens a Connect CDC (SQData) cursor that was previously defined with CREATE RDBMS CURSOR, CREATE VSAM CURSOR, or CREATE IMS CURSOR.
If the function fails, Connect CDC (SQData) sets the job fatal and processing stops.
Important: Although the SQL statement in an RDBMS cursor is prepared by the underlying datastore,
OPEN() follows Connect CDC (SQData) Apply Engine runtime semantics and should not be assumed to behave exactly like a native DB2 for z/OS application cursor statement.Category
Cursor Functions
Syntax
OPEN(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
- Use
OPEN()before callingFETCH()when you want to process a cursor row by row. OPEN()returns an empty string on success and is normally used as an action function rather than as a value in an expression.- The record named in the
USINGclause should match the number and order of the input values supplied before the cursor is opened. - The record named in the
DESCRIBED BYclause should match the number, order, and compatible types of the columns returned by the cursor.
Example
CREATE RDBMS CURSOR AS SQDATA_RDBMS_CURSOR WITH
/+
SELECT ACCOUNT_ID, ACCOUNT_STATUS
FROM SQDATA_LOOKUP_SOURCE
WHERE ACCOUNT_ID = ? AND REGION_CODE = ?
+/
DESCRIBED BY SQDATA_CURSOR_ROW
USING SQDATA_CURSOR_INPUT
;
OPEN(SQDATA_RDBMS_CURSOR)
IF FETCH(SQDATA_RDBMS_CURSOR) = '0'
DO
TARGET_ACCOUNT_ID = SQDATA_CURSOR_ROW.ACCOUNT_ID
END
CLOSE(SQDATA_RDBMS_CURSOR)