REPLICATE - connect_cdc_sqdata - Latest

Connect CDC (SQData) Apply engine

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) Apply engine
Copyright
2024
First publish date
2000
Last edition
2024-07-30
Last publish date
2024-07-30T20:19:56.898694

This command expands on AUTOMAP by automatically performing the APPLY (write) to the Target datastore. REPLICATE can significantly reduce the size and complexity of the Engine script and also provides much higher performance with less CPU and other overhead as compared to explicit field/column mapping.

  • Like Automap, Replicate eliminates the need to map individual fields and columns when the Source and Target datastores are identical or nearly identical with some limitations:
    • Source and Target datastore types must be compatible including Relational > Relational (same or combinations of DB2, Oracle, SQL Server), IMS > IMS, VSAM > VSAM
    • Field or column names do not have to be identical but the sequence of field or columns must match
    • Field or column types must be "compatible"
  • Replicate allows manual mapping of individual fields/columns when required, simply by mapping them manually prior to the Replicate command statement.
  • Replicate eliminates the need for Target DESCRIPTIONS:
    • When the Source and Target Datastores are the same Type (DB2 > DB2, Oracle > Oracle, etc). Target "schema" can be changed using DATASTORE FORCE QUALIFIER parameter
    • When the Target is an AVRO or JSON formatted datastore, typically Kafka or HDFS (Hadoop).
    • For JSON or AVRO formatted datastores, it also generates and populates the Target header metadata columns without the need for Target DESCRIPTIONS.
  • Replicate allows specification of a Target DESCRIPTION containing "customized" field/column names as long as they are listed in the same sequence as the Source DESCRIPTION.
    • Precisely recommends using the same field/column names and style as the Source DESCRIPTION.
    • The Apply Engine will automatically change the style to lower snake_case when generating AVRO formatted datastores.
  • Replicate requires the specification of key fields or columns for Relational, IMS and VSAM Targets:
    • Target Datastore Catalog or in the case of IMS the DBD.
    • DATASTORE KEY IS parameter
    • DESCRIPTION KEY IS parameter
Syntax
REPLICATE (<target_datastore> [, <source_description> | <target_description>])

Only the target_datastore is required if the Source and Target table and column names are identical. Table (prefix, schema, owner) defaults to qualifier in Source DESCRIPTION unless FORCE QUALIFIER parameter is specified.

Keyword and Parameter Descriptions
Keyword Description
<target_datastore> Specifies the alias of the Datastore which will be the Target of the replication.
<source_description> | <target_description>

Specifies the alias of the description to be used for the Target Datastore.

Example 1

Replicate changes to the EMP and DEPT tables in a DB2 database to identically named tables in an Oracle database.
BEGIN GROUP HR_DB2
DESCRIPTION DB2SQL DD:DB2DDL(EMP)  AS I_EMP;
DESCRIPTION DB2SQL DD:DB2DDL(DEPT) AS I_DEPT;
END GROUP;      

BEGIN GROUP HR_ORA
DESCRIPTION ORASQL DD:ORADDL(EMP)  AS T_EMP;
DESCRIPTION ORASQL DD:ORADDL(DEPT) AS T_DEPT;
END GROUP;          

DATASTORE RDBMS
         OF RELATIONAL
         AS HR_DB
         DESCRIBED BY GROUP HR_ORA;
...
REPLICATE (HR_DB)

Example 2

Replicate changes to the EMP and DEPT tables in a DB2 database to the USER and ORG tables in an Oracle database. Because the table names are different, a case statement is required to identify the Source table before the REPLICATE command can be used. While this does require a line of instructions for each table to be replicated, it still eliminates the need for column level mapping.
BEGIN GROUP DB2_SOURCE
DESCRIPTION DB2SQL ./DB2DDL(EMP)  AS I_EMP;
DESCRIPTION DB2SQL ./DB2DDL(DEPT) AS I_DEPT;
END GROUP;      

BEGIN GROUP ORA_TARGET
DESCRIPTION ORASQL ./ORADDL(USER) AS T_USER;
DESCRIPTION ORASQL ./ORADDL(ORG)  AS T_ORG;
END GROUP;          

DATASTORE RDBMS
         OF RELATIONAL
         AS TARGET
         DESCRIBED BY GROUP ORA_TARGET;
...

CASE DB2TBLNAME(CDCIN)
    WHEN 'EMP' REPLICATE (TARGET, T_USER)
    WHEN 'DEPT' REPLICATE (TARGET, T_ORG)

Example 3

Replicate changes to the EMP and DEPT tables in a DB2 database to Kafka using the JSON datastore type. Using REPLICATE, both AVRO and JSON formatted Target datastore types, typically Kafka or HDFS (Hadoop), can be dynamically generated from Source datastore descriptions regardless of type and do not require Target datastore descriptions. In this example, the JSON formatted topic content will be generated from the source DB2 DDL. All numeric source data is converted to integer or decimal numbers and all non-numeric source columns will be converted to UTF-8 text strings. In this simple example the same Kafka topic will be used for both source tables. See the Kafka Datastore example for more details and the complete Engine script from which the following is excepted.
BEGIN GROUP SOURCE
DESCRIPTION DB2SQL ./DB2DDL(EMP)  AS I_EMP;
DESCRIPTION DB2SQL ./DB2DDL(DEPT) AS I_DEPT;
END GROUP;      

DATASTORE kafka:///*.topic
         OF JSON
         AS TARGET
         DESCRIBED BY GROUP SOURCE;
REPLICATE (TARGET)