0% found this document useful (0 votes)
49 views21 pages

IBM DataStage 8.5 Beginner's Guide - Lab#09 RouterTransformation

This document describes how to use a filter stage in IBM DataStage to perform router transformations on a flat file. The filter condition directs records where the language field is "US" to an SQL Server target, while sending other records to an Oracle target. The steps shown include connecting the input and output stages, configuring the filter condition, and verifying that records are routed correctly to each database.

Uploaded by

156sm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views21 pages

IBM DataStage 8.5 Beginner's Guide - Lab#09 RouterTransformation

This document describes how to use a filter stage in IBM DataStage to perform router transformations on a flat file. The filter condition directs records where the language field is "US" to an SQL Server target, while sending other records to an Oracle target. The steps shown include connecting the input and output stages, configuring the filter condition, and verifying that records are routed correctly to each database.

Uploaded by

156sm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

IBM DataStage 8.

5 Beginner’s Guide - Lab#09


Router Transformation

Description:
BISP is committed to provide BEST learning material to the
beginners and advance learners. In the same series, we have
prepared a list of beginner’s guide and FAQs for IBM Data Stage.
We have built complete financial Data Model and various data
transformation techniques. Download many such learning
documents, student guide, Lab Guide and Hands-on practice
materials. This document describes in step by step manner how
to apply filter condition. Here we want conditional load data into
Oracle and SQL Server from flat files based on Definition
language field. Data loads into SQL Server if Language is "US"
Otherwise it goes to Oracle. Join our professional training to
learn from Experts.

www.bispsolutions.com www.bisptrainigs.com Page 1


Mapping Sheet
Router Transformation.
Source- Flat File
Target- Oracle, SQL Server

Router Transformation:-
In this documents we use Filter stage for performing Router Transformation, we
take input from flat file and output goes to RDBMS based on definition language,
those user who belongs to US goes to SQL SERVER and other users goes to Oracle.

Source Data Model:

We using this financial data model and we perform operation on Src_Account_officer_c

www.bispsolutions.com www.bisptrainigs.com Page 2


Pl follow the below steps to implement Router Transformation.
Step-1 :- In Windows Click Designer Client of DataStage

www.bispsolutions.com www.bisptrainigs.com Page 3


Step-2 :- New Window opens, then click Jobs ,then click Parallel Job because we are
using parallel jobs.

Step-3 :- First go on File Palette then scroll the cursor and choose Sequential File
and drag it to Parallel pane and rename it. This file is used for input data.

www.bispsolutions.com www.bisptrainigs.com Page 4


Step-4 :- Choose Oracle Enterprise from database Database Palette and drag it to
parallel pane. This is used for loading data into oracle from flat files.

Step-5 :- Choose filter from processing palette and drag it to parallel pane. Filter is
used is for filtering values from flat file and put into target where we want to store
are data.

www.bispsolutions.com www.bisptrainigs.com Page 5


Step-6:- Choose SQL Server Enterprise processing method from Database Palette
and drag it to parallel job, this is used for loading data into Sql server from flat file.
Similarly drag oracle enterprise and connect them. Convert one link into reject link
as shown below because we want to send rejected data into oracle so we convert
stream link into reject link.

Step-7 : Now first before loading data into output,we have to create a table in sql
server or oracle. So, we write a create table command and make sure to give same
column name as you have in flat file. Go to SQL tab than write query and remember
the username and password.

www.bispsolutions.com www.bisptrainigs.com Page 6


Step-8:- Double click on Input file and browse an input file that can be .txt,.csv any
test file.

Step-9:- Go to Format tab and Remove double Quote because we don't need them
then Click on OK.
Note:- If you use date as a input than specify here which type of format you used

www.bispsolutions.com www.bisptrainigs.com Page 7


Step-10:-Go to Columns tab and enter same column names as declared in Input
file and put datatype, length then click on ViewData. This will show your Input Data.

Step-11:- Now click on View Data and Ok. If your data is shown like this that means
you have made successful connection between input file and DataStage otherwise it
will give some error like column mismatch error.

www.bispsolutions.com www.bisptrainigs.com Page 8


Step-12:- After choosing file, select 'True' from First line in column Names
dropdown for removing first line from Input file.

Step-13 :- Make input file and remember column names.

www.bispsolutions.com www.bisptrainigs.com Page 9


Step-14:- Double click on Filter then specify the where condition what we want and
select output link.

Step-15:- Now see here we want to save rejected data that's why we select true
then rejected values goes to oracle enterprise stage.

www.bispsolutions.com www.bisptrainigs.com Page 10


Step-16:- Go to Input tab and then choose Auto. Remember always choose Hash if
you use Key based transformation. When we select hash key then the sorting
options will be visible.

Step-17:- Click on Input and see all columns are available or not

www.bispsolutions.com www.bisptrainigs.com Page 11


Step-18:- Now go to output tab then select all links and drag them into OutLink for
sending data which satisfies filter condition into output links.

Step-19:- Now when we choose rejected link then see we can't put any column
here all rejected data automatically goes on it. and click on OK

www.bispsolutions.com www.bisptrainigs.com Page 12


Step-20:- Now double click on Sql Server enterprise stage then it looks like below
screenshot.Here we have to enter our table name where we want to insert our
data.Multiple options are there for write mode dropdown.If we directly want to load
data then we simple used write method as load otherwise we manually put queries
on it.Also we have to specify username and password and this password should
match with oracle username and password. Below we specify Replace as write Mode
that means if already data is present in table than replace the data with new data.

Step-21:- Click on column tab and see all the columns are showing or not.

www.bispsolutions.com www.bisptrainigs.com Page 13


Step-22:- Now here we have to specify the table name and schema name and
make an ODBC connection. System DSN and all the other entries should be same as
where your table is situated and whatever you specify in System DSN.

Step-23 :- Now double click on Oracle enterprise stage then it looks like it and we
have to enter our table name here in which table we want to insert our data and

www.bispsolutions.com www.bisptrainigs.com Page 14


there multiple options if we directly want to load data then we simple used write
method as load otherwise we manually put queries on it and also we have to specify
username/password on it this password should be matched with oracle
username/password..

Step-24:- There's one more option here once you click on connection tab then
remote server options are popup then we have to specify our server name of oracle.

www.bispsolutions.com www.bisptrainigs.com Page 15


Step-25:- See below,my server name is ORCL and username/password and table
name.Ensure that you put correct information then only you will be able to load the
data into table.

Step-26:- Now there are two ways to load data, directly load or user define
load.We choose user define that's why we choose upsert.

www.bispsolutions.com www.bisptrainigs.com Page 16


Step-27:- See below ,there is insert query and update we want to insert data in
oracle so copied the insert query.

Step-28:- We only want to update our data by insert data in table ,so we copied
the insert query and put in this and because we only want to update so we have
choosen update only method.

www.bispsolutions.com www.bisptrainigs.com Page 17


Step-29:- Now paste the query into update space.

Step-30:- Click on column tab and see all the columns are showing or not.

Step-31:- Now compiling the job and notice which file is rejected file.

www.bispsolutions.com www.bisptrainigs.com Page 18


Step-32:- If this is shown that means your compilation is done otherwise it shows
error.Now click on run button or (CTRL+F5).

Step-33:- Now click on Run tab and notice some options available here. We have
selected No limit of warnings and we can validate before run the job.

www.bispsolutions.com www.bisptrainigs.com Page 19


Step-34:- After click on run wait for a while than it shows GREEN line that means
your transformation is successfully done otherwise if it shows RED Line that means
not Done and BLUE Line means Under Process.

Step-35:- Now Go to SQL Console and connect with the same login credentials as I
mentioned in oracle enterprise stage src_creditcard/password so you can choose

www.bispsolutions.com www.bisptrainigs.com Page 20


your own username and password. Before loading, remember to check structure of
this file is available and then you should be able to load the data. then simple
query:
<SELECT * FROM SRC_ACCOUNT_OFFICER_CD_FILT;>

Step-36:- Now Go to SQL Console and connect with the same login credentials as I
mentioned in Sql server enterprise stage sa/password123 so you can choose your
own username and password. Before loading, remember to check structure of this
file is available and then you should be able to load the data. then simple query:
<SELECT * FROM SRC_ACCOUNT_OFFICER_CD;>

www.bispsolutions.com www.bisptrainigs.com Page 21

You might also like