The PROCESS INTO Command is used only once in the Apply Engine script and defines what is referred to as the Main Section of the script. It essentially initiates a processing loop beginning with the first record of the source datastore that continues until the last record from the source datastore has been processed.
It identifies the target datastore(s) that will be acted upon by the script and is used in conjunction with the FOR <action> parameter specified in the DATASTORE command for the target datastore which explicitly states how the data will be applied to the target. As described in the DATASTORE Command the default Actions are CHANGE and INSERT.
PROCESS INTO <target_datastore> [, <target_datastore>]
SELECT [UNION];
Keyword | Description |
---|---|
<target_datastore> |
Specifies the name(s) of one or more target datastores to which changed data records will be applied. |
SELECT |
The sub-command that identifies the records/rows to be read from a source datastore. |
[UNION] | Optional sub-command UNION can be used to chain or concatenate multiple SELECT sub commands together. This allows for multi-step processing against. See the UNION command for more details on its syntax and usage. |
Examples for each DATASTORE FOR <action>
CHANGE Action:
Apply changed IMS data from a IBM MQ queue into the relational table TGT_TABLE. The source records are to be applied to the target table based on the change operation of the source transaction (i.e. insert, update, delete).
-- Specify the source/target data structures
DESCRIPTION COBOL file_name AS SRC_DESCR;
DESCRIPTION COBOL file_name AS TGT_DESCR;
-- Specify the source datastore
DATASTORE MQS:///CDC_QUEUE_IN
OF IMSCDC
AS CDCIN
DESCRIBED BY SRC_DESCR;
-- Specify the target datastore with a key and change op reference
DATASTORE TGT_TABLE
OF RELATIONAL
AS TBL_OUT
DESCRIBED BY TGT_DESCR
KEY IS COLA
OPERATION IS V_CHGOP
FOR CHANGE;
-- Specify Variables
DECLARE V_CHGOP 1 ' ';
-- Specify the Processing
PROCESS INTO TBL_OUT
SELECT
{
V_CHGOP = CDCOP(CDCIN)
TBL_OUT.COLA = FIELD1
TBL_OUT.COLB = FIELD2
}
FROM CDCIN;
INSERT Action 1:
-- Specify the source/target data structures
DESCRIPTION COBOL file_name AS SRC_DESCR;
DESCRIPTION COBOL file_name AS TGT_DESCR;
-- Specify the source datastore --
DATASTORE AUTO_DETAIL
OF RELATIONAL
AS TBL_IN
DESCRIBED BY SRC_DESCR;
-- Specify the target datastore with INSERT op reference --
DATASTORE AUTO_MASTER
OF RELATIONAL
AS TBL_OUT
DESCRIBED BY TGT_DESCR
FOR INSERT;
-- Specify the Processing
PROCESS INTO AUTO_MASTER
SELECT
{
SALES_INFO.MAKE = AUTO_DETAIL.AUTO_MAKE
SALES_INFO.OWNER = AUTO_DETAIL.AUTO_OWNER
}
FROM AUTO_DETAIL;
INSERT Action 2:
-- Specify the source/target data structures
DESCRIPTION COBOL file_name AS SRC_DESCR;
DESCRIPTION COBOL file_name AS TGT_DESCR;
-- Specify the source datastore
DATASTORE AUTO_DETAIL
OF RELATIONAL
AS AUTO_DETAIL
DESCRIBED BY SRC_DESCR;
-- Specify the target datastore with INSERT op reference
DATASTORE SALES_INFO
OF RELATIONAL
AS SALES_INFO
DESCRIBED BY TGT_DESCR
FOR INSERT;
-- Specify the Processing
INSERT INTO SALES_INFO
SELECT
{
SALES_INFO.MAKE = AUTO_DETAIL.AUTO_MAKE
SALES_INFO.OWNER = AUTO_DETAIL.AUTO_OWNER
}
FROM AUTO_DETAIL;