Using a Relative Record Number to Identify a Record (IBM Db2 for i)

For transaction-based replications (mirroring and synchronization), it is critical to be able to uniquely identify records in the source and target databases, before performing UPDATE and DELETE operations during replication. Database applications typically make use of primary keys to uniquely identify records.

Syniti Data Replication can use primary keys that have been previously set in the source and target databases to identify records during replication. It is also possible to create primary keys within the Syniti DR environment for use only during replications with Syniti DR. If, however, you are replicating from IBM Db2 for i (iSeries/AS400) and you do not have a primary key set on the source table, you can use the RRN (relative record number--a hidden column that uniquely identifies the record)  to identify records during replication.

To use the RRN to identify each record:

  1. In the target table, create an additional column of type DECIMAL(15).

  2. If you have not yet created the replication, when you get to the Set Mapping Info screen of the Replication wizard or Multiple Replications wizard, choose to map the newly created column to an expression.
    If you have created the replication, in the Replication Properties dialog, open the Fields Mapping dialog and choose to map the newly created column to an expression.

  3. In the Expression Generator, expand the tree to display the Values node.

  4. Expand the Values node to display Log Field values.

  5. Select the RecordID value.
    The RecordID value represents the Db2 for i (iSeries/AS400) Relative Record Number.

  6. Click OK in the Expression Generator.

You have now set the value of the column that you created above to the RRN.

Any time you reorganize a source table (to compress deleted rows, etc.), you need to perform a full refresh of all the target tables mapped using the RRN.

Related Topics
Define Primary Key Dialog
Primary Key Settings for Mirroring and Synchronization