Retrieving a column from another table using the %GETCOL function (DB2® for i)

An example of how to retrieve a column from another table using the %GETCOL function and the CDC Replication Engine for Db2® for i.

This example uses the relationship between a primary (EMPLOYEE) and secondary (BRANCH, STATE, and COUNTRY) tables.
EMPLOYEE, BRANCH, STATE, and COUNTRY tables uses in %GETCOL function for Db2 for i
In this example, you will retrieve the column NAME from the STATE table using the STATE column from the EMPLOYEE table. To use this example, perform the following steps:
  1. Add a derived column, STNAME, based on the NAME column, to the STATE table.
  2. Enter the following expression for the STNAME derived column: %GETCOL(NAME, PRODLIB/STATE, , , 1, STATE)