Java Transformer in DataStage

Monday, April 21, 2014

Java Transformer in DataStage

Using the Java stage in DataStage we can invoke a java program, This is a very rare scenario used in common ETL world but it’s a very useful stage, This stage can have one input link, One output link and one reject link.

Datastage to invoke a Java application it need a IBM supplied jar file “tr4j.jar”, This can be found in below location if your version of Datastage has Java Pack Installed.

Windows - C:\IBM\InformationServer\Server\DSEngine\java\lib\ tr4j.jar
Linux       - /opt/IBM/InformationServer/Server/DSEngine/java/lib/tr4j.jar

Here we will see a simple sample Java code to display "Hello World" in Datastage, This code is created in Eclipse using this IBM supplied class.(Please note to write a java code you need some java workbench preferably Eclipse and If you are not a Java developer then you will also need some Good amount of help from Java developer to get this java interface complete).

Step 1:- Create Java Code in Eclipse(Below is the sample code to say Hello World).

package helloWorld;

import com.ascentialsoftware.jds.Row;
import com.ascentialsoftware.jds.Stage;

public class HelloWorld extends Stage {

public void initialize() {


public void terminate() {

public int process() {

Row outputRow = createOutputRow();
outputRow.setValueAsString(0, "Hello World");



Step 2:- Create the jar file for above java code and move the same to correct location in Datastage server.

Step 3:- Create the datastage job with Java Transformer as given below.

Step 4:- Edit the Java XFM to add the jar file location and output field definitions, Remember to give the path for "tr4j.jar" also, else the module will not work.

Step 5:- Compile and run the Datastage job, This should execute the java code and will give the result as given below.

I am also attaching the jar file, DataStage job and Java Pack Guide for reference.

Link for JAR File
Link for DSX File
Link for IBM Java Guide

Error 404

The page you were looking for, could not be found. You may have typed the address incorrectly or you may have used an outdated link.

Go to Homepage