StarQuest Technical Documents

SQDR ir_keylog Table

Last Update: 23 September 2019
Product: StarQuest Data Replicator
Version: SQDR 4.64 or later
Article ID: SQV00DR031


The ir_keylog control table can be used to drive downstream events instead of using
triggers. This reference document describes the format of the ir_keylog table.

See Using SQDR Key Logging Data and Using SQDR Change Data Processing for additional information.

The ir_keylog file is a log of the communication between the SQDR Plus system and the client system (running SQDR) as it relates to the application of changes to the destination table (DDL and DML.) The file is pruned based upon the number of statistics rows (a service level property.) The table refers to other SQDR Control Tables: subscriptions (identifying the source, destination ODBC DSNs, the source and destination tables), groups - identifying the containing "Group" and the statistics table which summarizes baseline (snapshot) results as well as summary incremental counters.

For a given subscription, the ir_keylog table will contain the details of the row to be inserted, deleted, or updated. The before, after key fields illustrate the source ODBC type, the local program data type and destination ODBC types used to effect the transfer, in addition to the string representation of the value(s) used to identify the row. The resulting number of rows affected by the operation is identified in the result_row_count column. If an ODBC error is reported, the "result_error" column contains the text message associated with the error condition. In the event that an unexpected number of rows (usually something other than "1") are affected by the operation, a subscription is "flagged". The "flagged_count" tracks the number of operations since the last baseline that resulted in an unexpected row_count_error.

The table has the following columns, where the associated text describes the source of the information (i.e. "SQDR Plus" denotes data supplied by SQDR Plus system, "SQDR" denotes data supplied by the client, etc.):


SQDR: FK: table.column relationships or attribute meaning


SQDR: FK: refers to statistic.run_id


SQDR: FK: refers to; statistic.group_id; ir_subscription.group_id


SQDR: FK: refers to ir_subscription.subscription_id


SQDR Plus: An enumerator used by SQDR Plus to order transactions


SQDR Plus: An enumerator used to order rows within a transaction


SQDR Plus: Time data was logged on DB2 for i host DBMS (in seconds - host time) (or staged for DB2 for LUW host)


SQDR Plus: Time data was logged on DB2 for i host DBMS (fractional part - in nanoseconds)


SQDR Plus: see below


SQDR Plus: log entry details from the journal  (if enabled in Staging Agent) in an XML-like format. Fields include job & user name,  IBM i journal code, RRN, and sequence number.  See below for examples.


SQDR Plus: member name of the source, when IBM i multi-member support is enabled and a member other than the default (*FIRST) is requested.


SQDR: see below


Destination DBMS: Number of rows affected by action_taken-associated operation as returned by destination


Destination DBMS: Any ODBC error message associated with action_taken on the destination table


SQDR: Current count of number of rows flagged for this subscription


SQDR: for "Delete" and "Update" operations - used by WHERE CLAUSE. See below for details.

"before_key_edited" is obsolete and subject to removal in future versions of SQDR.


SQDR: for some Update operations (partitioned subscriptions and open-window updates). See below for details.

"after_key_edited" is obsolete and subject to removal in future versions of SQDR.


SQDR: An increasing sequence number within the ir_keylog file


SQDR: ir_keylog datetime of insertion (client platform datetime)


SQDR: ir_keylog row insertion timestamp


SQDR Plus: data from the change for updates and inserts. Contains the after-image and may include the delete before image, if available. See below for details.

change_row_type field

Here are the details of the change_row_type field:




Delete row - Horizontal Partition


Delete row


Update row


Insert row


Table reorganized


Snapshot required


Truncate table


Source table altered


Source table dropped


Close window signal

action_taken field

The result of the change_row_type is described in the action_taken column. The codes used for action_taken are a subset of the change_row_type. A special value of 0x00 means the change_row_type was ignored. Some change_row_type only change the state of the subscription and do not result in the changes on the destination table and are NULL.

Here are the details of the action_taken field:




Delete row

M Update row (Strict Apply Rules)


Update row (Allow UPSERT)


Insert row


Truncate table


Snapshot required


Source table Altered


Source table dropped


Close window signal


"Stale" Close window token


change_row_type ignored


Unrecognized change_row_type


Here is an example of the change_row_log_detail field (DB2 for i source):

<detail> <receiver>MYLIB QSQJRN0014</receiver> <user>SQDR91</user> <job>QZRCSRVS
QUSER 511037</job> <type>U 70</type> <sequence>00000000000019012714</sequence> <rrn>0</rrn>
<program>RJRNLAPI</program> </detail>

before_key, after_key and after_image fields

This section describes the structure of the variable content columns for the before_key, after_key, and after_image fields.

Elements are encoded as name="value" pairs. Sequences of pairs are separated with a space character ( x'20').

Special character codepoints use an escape sequence consisting of the ampersand sign followed by one of:

  • xsi:nil="true" - special value for NULL valued column
  • #x (octect binary values, encoded using base 16, hexadecimal characters; these always occur as even number of hexadecimal digits)
  • When these characters occur within the "value", a substitution occurs, as follows:

    &: &amp;
    ': &apos;
    ": &quot;
    <: &lt;
    >: &gt;

  • Character data that is less than 0x20 (or 0x0020 if UNICODE) is encoded as binary values:


date, time and timestamps use an ISO format:

"YYYY-MM-DDTHH:MM:SS.fffffffff" (note the use of "T" as seperator between DD and HH). Precision of the timestamp is dependent upon the column characteristics.



Special considerations:

The after_image data is comprised of two delimited strings, using angle brackets to denote the string beginning and ending:



The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.