Create straight replication script - connect_cdc_sqdata - Latest

Connect CDC (SQData) Change Data Capture

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (SQData)
Version
Latest
Language
English
Product name
Connect CDC (SQData)
Title
Connect CDC (SQData) Change Data Capture
Copyright
2024
First publish date
2000
ft:lastEdition
2024-09-05
ft:lastPublication
2024-09-05T15:00:09.754973

A Simple Replication script requires DESCRIPTIONS for each Source and Target DATASTORE as well as either a straight mapping procedure for each table or use of the REPLICATE Command as shown in the sample script below. In the example Descriptions are in-line rather than through external files. In the sample script, a CDCzLog type Publisher uses TCP/IP to publish and transport data to the target Apply Engine. The Main Select section contains only references to the Source and Target Datastore aliases and the REPLICATE Command. Individual mapping procedures are not required in this case.

The sample script, UDBTOUDB, is listed below.

Note: The same table descriptions are used for both Source and Target environments, how the Schema, which may have been present in the descriptions is overridden and how a single function, REPLICATE performs all the work. For more information, see REPLICATE command.
If you choose to exercise this script, which is based on IBM's Db2 IVP tables, it will be necessary to create two copies of the DEPT and EMP tables as referenced in the script on the target system. Once that is complete, the script can be parsed and exercised.
-------------------------------------------------------------
        -- UDB REPLICATION SCRIPT FOR ENGINE: UDBTOUDB
        -------------------------------------------------------------
        -- SUBSTITUTION VARS USED IN THIS SCRIPT:
        -- %(ENGINE) - ENGINE / REPORT NAME
        -- %(HOST) - HOST OF Capture
        -- %(PORT) - TCP/IP PORT of SQDAEMON
        -- %(PUBN) - Capture/Publisher alias in sqdagents.cfg
        -- %(DATABASE) - DB2 Database Name
        -------------------------------------------------------------
        -- CHANGE LOG:
        -- 2018/01/01: INITIAL RELEASE
        -------------------------------------------------------------
        JOBNAME %(ENGINE);
        RDBMS NATIVEDB2 %(SSID);
        OPTIONS CDCOP('I','U','D');
        -------------------------------------------------------------
        -- DATA DEFINITION SECTION
        -------------------------------------------------------------
        ---------------------------
        -- Source Data Descriptions
        ---------------------------
        BEGIN GROUP SOURCE_DDL;
        DESCRIPTION DB2SQL ./UDBDDL(EMP) AS S_EMP;
        DESCRIPTION DB2SQL ./UDBDDL(DEPT) AS S_DEPT;
        END GROUP;
        ---------------------------
        -- Target Data Descriptions
        ---------------------------
        -- None required for Straight Replication
        ---------------------------
        -- Source Datastore(s)
        ---------------------------
        DATASTORE cdc://%(HOST):%(PORT)/%(PUBN)/%(ENGINE)
        OF UTSCDC
        AS CDCIN
        RECONNECT
        DESCRIBED BY GROUP SOURCE_DDL
        ;
        ---------------------------
        -- Target Datastore(s)
        ---------------------------
        DATASTORE RDBMS 
        OF RELATIONAL
        AS TARGET
        FORCE QUALIFIER TGT
        DESCRIBED BY GROUP SOURCE_DDL
        FOR CHANGE 
        ;
        ---------------------------
        -- Variables
        ---------------------------
        -- None required for Straight Replication
        ---------------------------
        -- Procedure Section
        ---------------------------
        -- None required for Straight Replication
        -------------------------------------------------
        -- Main Section - Script Execution Entry Point
        -------------------------------------------------
        PROCESS INTO TARGET
        SELECT 
        {
        -- OUTMSG(0,STRING(' TABLE=',CDC_TBNAME(CDCIN)
        -- ,' CHGOP=',CDCOP(CDCIN)
        -- ,' TIME=' ,CDCTSTMP(CDCIN)))
        -- Source and Target Datastores must have the same table names
        REPLICATE(TARGET)
        }
        FROM CDCIN;