The CREATE IMS CURSOR statement defines a Connect CDC (SQData) cursor over an existing IMS datastore. You can then process the cursor with OPEN, FETCH, CLOSE, or FOREACH.
IMS cursors are commonly used to navigate IMS hierarchical structures, look up reference data from IMS segments, or retrieve related IMS data as part of primary CDC processing.
Category
Cursor statements
Syntax
CREATE IMS CURSOR AS <cursor_name>
ON <datastore_name>
DESCRIBED BY <description_name> [, <description_name> ...]
;
CREATE IMS CURSOR AS <cursor_name>
ON <datastore_name>
DESCRIBED BY GROUP <group_name> [, <group_name> ...]
;Parameters and descriptions
| Parameter | Description |
|---|---|
cursor_name
|
Name assigned to the Connect CDC (SQData) cursor. |
datastore_name
|
Name of an existing IMS datastore queried by the cursor. |
description_name
|
One or more IMS record descriptions associated with the cursor. |
group_name
|
One or more IMS description groups associated with the cursor. |
Usage
Use ON to identify the IMS datastore associated with the cursor.
In practice, an IMS cursor relies on three related constructs:
- An IMS datastore and its associated segment descriptions or description groups.
- One or more descriptions or groups named by
DESCRIBED BYto define which IMS segments the cursor can access. - Execution through
OPEN(),FETCH(),CLOSE(), orFOREACH().
This topic documents only the CREATE IMS CURSOR statement itself. The IMS datastore named by ON, along with the descriptions or groups referenced by DESCRIBED BY, must already be defined elsewhere in the Connect CDC (SQData) script.
Use DESCRIBED BY to associate one or more IMS descriptions with the cursor, or use DESCRIBED BY GROUP to associate one or more description groups.
For best results, the descriptions or groups named in DESCRIBED BY should cover all IMS segments you intend to access through the cursor.
The alias defined by AS may appear before or after the cursor options.
Example
CREATE IMS CURSOR AS SQDATA_IMS_CURSOR
ON SQDATA_IMS_SOURCE
DESCRIBED BY SQDATA_IMS_SEGMENT_A, SQDATA_IMS_SEGMENT_B
;