Skip to main content Skip to complementary content

Extracting the change data modified in AS/400 journal mode

About this task

Once you have defined the CDC environment, you can create a Job in Talend Studio using a tAS400CDC component to extract the changes made to the data in the source system.

Procedure

  1. Drop a tAS400CDC component and a tLogRow component from the Palette onto the design workspace, and link the two components using a Row > Main connection.
    Job using the tAS400CDC and tLogRow components.
  2. Double-click the tAS400CDC component to display its Basic settings view.
  3. Select Repository from the Property Type drop-down list and click on [...] to fetch the schema which corresponds to your CDC connection. The fields which follow are automatically filled in with the information required to connect to the CDC database.
  4. Select Repository from the Schema drop-down list and click on [...] to fetch the schema which corresponds to the AS/400 table to be monitored.
  5. In the Table Name field, enter the name of the source table monitored by CDC, CUSTOMERS in this example.
  6. In the Source Library field, enter the name of the source library. By default, this is the same name of the source database.
  7. In the Subscriber field, enter the name of the subscriber who will extract the modified data. By default, the subscriber is named APP1.
  8. In the Events to catch field, select the check box which corresponds to the event(s) to be caught.
    Configuration of tAS400CDC.
  9. From your AS/400 system, execute CHGJRN JRN(<Source_library_name>/<Journal_name>) JRNRCV(*GEN) to detach the old receiver from the journal and create and attach a new receiver to the journal to retrieve the last change.

    The tAS400CDC component by default executes the following RUNCDC command:

    <CDC_library_name>/RUNCDC FILE(<Source_library_name>/<Source_table_name>) LIBOUT(<CDC_library_name>) MODE(*DETACHED) MBROPT(*ADD)

    Alternatively, you can automate the detachment and attachment process by selecting the Customize Command check box and adding the following custom command on the Advanced Settings view of the tAS400CDC component:

    <CDC_library_name>/RUNCDC FILE(<Source_library_name>/<Source_table_name>) LIBOUT(<CDC_library_name>) MODE(*DETACHED) MBROPT(*ADD) DTCHJRN(*YES)
    Note that the default RUNCDC command setup in the tAS400CDC component reads changes of only one table. If you want to read changes on multiple (up to 300) tables at the same time and those tables are all on the same journal, you can use multiple tAS400CDC components in your Job, add an custom command
    <CDC_library_name>/RUNCDC FILE(<Source_library_name>/<Source_table_name1> <Source_library_name>/<Source_table_name2> ... <Source_library_name>/<Source_table_nameN>) LIBOUT(<CDC_library_name>) MODE(*DETACHED) MBROPT(*ADD)
    for the first tAS400CDC component and disable the command for other tAS400CDC components by selecting the Disable Command check box on the Advanced settings view. The first tAS400CDC component will execute the RUNCDC command and extract change data from all source tables, and other tAS400CDC components will simply read data prepared by the first tAS400CDC component. For example, the following command reads changes from two tables EMPLOYEE1 and EMPLOYEE2 on the same journal. You can download a sample Job here: tAS400CDC-multiple-tables.zip.
    TALENDCDC/RUNCDC FILE(TALEND/EMPLOYEE1 TALEND/EMPLOYEE2) LIBOUT(TALENDCDC) MODE(*DETACHED) MBROPT(*ADD)"
    Location of the Customize Command check box.

    Alternatively, you can disable command for all tAS400CDC components and execute the custom command manually on your AS/400 system.

  10. Save the Job and press F6 to run it.
    In the console, you can read the output results which correspond to what is displayed in the View All Changes dialog box.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!