Sunday, August 14, 2011

Transaction Control Transformation

  1. Transaction Control Transformation


 

We can control commit and roll back transactions based on a set of rows that pass through using Transaction Control transformation.

A transaction is the set of rows bound by commit or roll back rows.


 

Use the Transaction Control transformation to define conditions to commit and roll back transactions from transactional targets.


 

In PowerCenter, you define transaction control at two levels:


 

Within a mapping: within a mapping, you use the Transaction Control transformation to define a transaction. You define transactions using an expression in a Transaction Control transformation. Based on the return value of the expression, you can choose to commit, roll back, or continue without any transaction changes.


 

Within a session: When you configure a session, you configure it for user-defined commit. You can choose to commit or roll back a transaction if the Integration Service fails to transform or write any row to the target.


 

When you run the session, the Integration Service evaluates the expression for each row that enters the transformation. When it evaluates a commit row, it commits all rows in the transaction to the target or targets. When the Integration Service evaluates a roll back row, it rolls back all rows in the transaction from the target or targets.


 

If the mapping has a flat file target you can generate an output file each time the Integration Service starts a new transaction. You can dynamically name each target flat file.


 

Properties


 

Transaction control condition


 

Enter the transaction control expression in the Transaction Control Condition field. The transaction control expression uses the IIF function to test each row against the condition. Use the following syntax for the expression:


 

IIF (condition, value1, value2)


 

IIF (NEW_DATE = 1, TC_COMMIT_BEFORE, TC_CONTINUE_TRANSACTION)


 

The Integration Service evaluates the condition on a row-by-row basis. The return value determines whether the Integration Service commits, rolls back, or makes no transaction changes to the row. When the Integration Service issues a commit or roll back based on the return value of the expression, it begins a new transaction.


 


 

Use the following built-in variables in the Expression Editor when you create a transaction control expression:


 

TC_CONTINUE_TRANSACTION: The Integration Service does not perform any transaction change for this row. This is the default value of the expression.


 

TC_COMMIT_BEFORE: The Integration Service commits the transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.


 

TC_COMMIT_AFTER: The Integration Service writes the current row to the target, commits the transaction, and begins a new transaction. The current row is in the committed transaction.


 

TC_ROLLBACK_BEFORE: The Integration Service rolls back the current transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.


 

TC_ROLLBACK_AFTER: The Integration Service writes the current row to the target, rolls back the transaction, and begins a new transaction. The current row is in the rolled back transaction.


 


 

If the transaction control expression evaluates to a value other than commit, roll back, or continue, the Integration Service fails the session.


 

Example

You want to use transaction control to write order information based on the order entry date. You want to ensure that all orders entered on any given date are committed to the target in the same transaction.


 

You can also use Custom transformations configured to generate transactions to define transaction boundaries.


 

Transaction Control transformations can be either effective or ineffective for the downstream transformations and targets in the mapping. The Transaction Control transformation becomes ineffective for downstream transformations or targets if you put a transformation that drops incoming transaction boundaries after it. This includes any of the following active sources or transformations:


 

Aggregator transformation with the All Input level transformation scope

Joiner transformation with the All Input level transformation scope

Rank transformation with the All Input level transformation scope

Sorter transformation with the All Input level transformation scope

Custom transformation with the All Input level transformation scope

Custom transformation configured to generate transactions

Transaction Control transformation


 


 


 


 

Notes


 

--> Transaction Control transformations connected to any target other than relational, XML, or dynamic MQSeries targets are ineffective for those targets.


 

--> You must connect each target instance to a Transaction Control transformation.


 

-->You can connect multiple targets to a single Transaction Control transformation.


 

--> You can connect only one effective Transaction Control transformation to a target.


 

--> You cannot place a Transaction Control transformation in a pipeline branch that starts with a Sequence Generator transformation.

0 comments:

Post a Comment

newer post older post Home