You are on page 1of 7

Transaction Control Transformation Overview

By PenchalaRaju.Yanamala

Transformation type:
Active
Connected

PowerCenter lets you control commit and roll back transactions based on a set of
rows that pass through a Transaction Control transformation. A transaction is the
set of rows bound by commit or roll back rows. You can define a transaction
based on a varying number of input rows. You might want to define transactions
based on a group of rows ordered on a common key, such as employee ID or
order entry date.

In PowerCenter, you define transaction control at the following 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.

Note: You can also use the transformation scope in other transformation
properties to define transactions.

Transaction Control Transformation Properties

Use the Transaction Control transformation to define conditions to commit and


roll back transactions from transactional targets. Transactional targets include
relational, XML, and dynamic MQSeries targets. Define these parameters in a
transaction control expression on the Properties tab. A transaction is the row or
set of rows bound by commit or roll back rows. The number of rows may vary for
each transaction.

When you configure a Transaction Control transformation, you define the


following components:

Transformation tab. You can rename the transformation and add a description
on the Transformation tab.
Ports tab. You can add input/output ports to a Transaction Control
transformation.
Properties tab. You can define the transaction control expression, which flags
transactions for commit, roll back, or no action.
Metadata Extensions tab. You can extend the metadata stored in the
repository by associating information with the Transaction Control
transformation.

Properties Tab

On the Properties tab, you can configure the following properties:

Transaction control expression


Tracing level

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)

The expression contains values that represent actions the Integration Service
performs based on the return value of the condition. 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. To accomplish this, you can
create a mapping with the following transformations:
Sorter transformation. Sort the source data by order entry date.
Expression transformation. Use local variables to determine whether the date
entered is a new date.
The following table describes the ports in the Expression transformation:
Port Name Expression Description
DATE_ENTERED DATE_ENTERED Input/Output port.
Receives and passes the
date entered.
NEW_DATE IIF(DATE_ENTERED=PREVDATE, Variable port.
0,1) Tests current value for
DATE_ENTERED against
the stored value for
DATE_ENTERED in the
variable port, PREV_DATE.
PREV_DATE DATE_ENTERED Variable port.
Receives the value for
DATE_ENTERED after the
Integration Service
evaluates the NEW_DATE
port.
DATE_OUT NEW_DATE Output port.
Passes the flag from
NEW_DATE to the
Transaction Control
transformation.
Note: The Integration Service evaluates ports by dependency. The order in which
ports display in a transformation must match the order of evaluation: input ports,
variable ports, output ports.

Using Transaction Control Transformations in Mappings


Transaction Control transformations are transaction generators. They define and
redefine transaction boundaries in a mapping. They drop any incoming
transaction boundary from an upstream active source or transaction generator,
and they generate new transaction boundaries downstream.

You can also use Multigroup External Procedure transformations configured to


generate transactions to define transaction boundaries.

Transaction Control transformations can be 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
Multigroup External Procedure transformation with the All Input level
transformation scope
Multigroup External Procedure transformation configured to generate
transactions
Transaction Control transformation
A multiple input group transformation, such as a Multigroup External Procedure
transformation, connected to multiple upstream transaction control points

Mappings with Transaction Control transformations that are ineffective for targets
may be valid or invalid. When you save or validate the mapping, the Designer
displays a message indicating which Transaction Control transformations are
ineffective for targets.
Mapping Guidelines and Validation

Use the following rules and guidelines when you create a mapping with a
Transaction Control transformation:

If the mapping includes an XML target, and you choose to append or create a
new document on commit, the input groups must receive data from the same
transaction control point.
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.
If you use a dynamic Lookup transformation and a Transaction Control
transformation in the same mapping, a rolled-back transaction might result in
unsynchronized target data.
A Transaction Control transformation may be effective for one target and
ineffective for another target. If each target is connected to an effective
Transaction Control transformation, the mapping is valid. See Sample
Transaction Control Mappings with Multiple Targets for an example of a valid
mapping with an ineffective Transaction Control transformation.
Either all targets or none of the targets in the mapping should be connected to
an effective Transaction Control transformation. See Sample Transaction
Control Mappings with Multiple Targets for an example of an invalid mapping
where one target has an effective Transaction Control transformation and one
target has an ineffective Transaction Control transformation

Creating a Transaction Control Transformation

Use the following proedure to add a Transaction Control transformation to a


mapping.

To create a Transaction Control transformation:

In the Mapping Designer, click Transformation > Create. Select the Transaction
1.Control transformation.
2.Enter a name for the transformation.
The naming convention for Transaction Control transformations is
TC_TransformationName.
3.Enter a description for the transformation.
This description appears when you view transformation details in the Repository
Manager, making it easier to understand what the transformation does.
4.Click Create.
The Designer creates the Transaction Control transformation.
5.Click Done.
6.Drag the ports into the transformation.
The Designer creates the input/output ports for each port you include.
7.Open the Edit Transformations dialog box, and select the Ports tab.
You can add ports, edit port names, add port descriptions, and enter default
values.
Select the Properties tab. Enter the transaction control expression that defines
8.the commit and roll back behavior.
Select the Metadata Extensions tab. Create or edit metadata extensions for the
9.Transaction Control transformation.
10.Click OK.

You might also like