You are on page 1of 9

Requirement1 Mapping Specification:

Input Columns:
EmpNo,Ename,Job,Mgr,Hire_Date,Sal,Comm,Deptno

Note :Read Hire_Date as Timestamp at Source


Transformer1:Create one stage variable ie Hir_Dat
Hir_Dat=TimestampToDate(Colname.Hire_Date)
Assign This stage variable to Hire_Date column now output of this field is Date
Transformer2:Create five stage variables
S1--.>MonthFromCurrentDate
S2-->MonthFromHiredate
S3-->YearFromCurrentDate
S4-->YearFromHireDate
WD-->WeekDay

Exp_In_Years=YearFromDate(CurrentDate())-
YearFromDate(linkname.Hire_Date)
S1=MonthFromDate(CurrentDate())
S2=MonthFromDate(linkname.Hire_Date)
S3=YearFromDate(CurrentDate())
S4=YearFromDate(linkname.HireDate)

Exp_In_Months=If S1>S2 Then((S3-S4)*12)+(S1-S2) Else If S1<S2 Then((S1+S2)-


S2)+S3-1-S4)*12 Else (S3-S4)*12

Exp_In_Weeks= (Exp_In_Months*30)/7
Exp_In_Days=DateSinceFromDate(CurrentDate(),linkname.Hire_Date)
WD=WeekDayFromDate(linkname.Hire_Date,'SUN')
Week_Of_Join=
If WD=0 Then 'SUN' Else
If WD=0 Then 'MON' Else
If WD=0 Then 'TUE' Else
If WD=0 Then 'WED' Else
If WD=0 Then 'THU' Else
If WD=0 Then 'FRI' Else 'SAT'

Month_Of_Join=
If MONTH=1 Then 'JAN' Else
If MONTH=2 Then 'FEB' Else
If MONTH=3 Then 'MAR' Else
If MONTH=4 Then 'APR' Else
If MONTH=5 Then 'MAY' Else
If MONTH=6 Then 'JUN' Else
If MONTH=7 Then 'JUL' Else
If MONTH=8 Then 'AUG' Else
If MONTH=9 Then 'SEP' Else
If MONTH=10 Then 'OCT' Else
If MONTH=11 Then 'NOV' Else 'DEC'

Quarter_Of_Join=
If MONTH>=1 And MONTH<=3 Then '1ST' Else
If MONTH>3 And MONTH<=6 Then '2ND' Else
If MONTH>6 And MONTH<=9 Then '3RD' Else '4TH'

YearDay(1-365)=YearDayFromDate(linkname.Hire_Date)

YearWeek(0-52)=YearWeekFromDate(linkname.Hire_Date)

Job Design
Requirement2 Mapping Specification:

Scenario2:
Calculate the tax for each employee who belongs to Deptno=30,if Salary>5000 then
tax as SAL*0.17 Else calculate tax as SAL*0.13

Solution:
Source:EMP[ORACLE]
Filter condition: where DEPTNO=30
Transformer:Define new column “TAX” then do the derivation
TAX=If DSLink5.SAL > 5000 Then DSLink5.SAL *0.17 Else DSLink5.SAL *0.13
Target:Text File

Scenario3:
Calculate the Total SALARY of each employee based on SAL and COMM
Note: The COMM column may have Nulls
Source:EMP[ORACLE]
Transformer:Define new column “TOTSAL” then do the derivation
If IsNull(DSLink4.COMM) Then DSLink4.SAL Else (DSLink4.SAL +
DSLink4.COMM)
Target:Text File

SCENARIO4:
Calculate TAX,HRA,ANNSAL based on TOTSAL,the TOTSAL calculated based
on SAL&COMM,TOTSAL=SAL+COMM,COMM column may have Nulls
If TOTSAL>8000 then calculate the TAX as TOTSAL*0.25 else calculate the tax as
TOTSAL*1.25,
Calculate HRA as follows TOTSAL*0.8
Calculate ANNULSAL as follows TOTSAL*12
Solution:
Source:EMP[ORACLE]
Transformer:Define 4 new columns and 1 stage variable

STAGEVARIABLE=TOTSAL
TOTSAL= If IsNull(DSLink4.COMM) Then DSLink4.SAL Else (DSLink4.SAL +
DSLink4.COMM)
COLUMNS:
TOTALSAL=TOTSAL(assign stage variable)
TAX= If TOTSAL >8000 Then TOTSAL*0.25 Else (TOTSAL*0.15)
HRA= TOTSAL*0.18
ANNSAL= TOTSAL*12
TARGET:Textfile

SCENARIO5:
Calculate GROSS SAL for each employee based on TOTSAL,HRA,TAX
GROSS_SAL=TOTSAL+HRA-TAX
TOTSAL=SAL+COMM
Note :COMM column may have Nulls
HRA=SAL*0.18
TAX=SAL*0.17

Solution:

Source:EMP(oracle)
Transformation:Transformer
Define 3 stage variables and define 4 new columns
STAGE VARIABLES
HRA= DSLink4.SAL*0.18
TAX= DSLink4.SAL*0.17
TOTSAL= If IsNull(DSLink4.COMM) Then DSLink4.SAL Else (DSLink4.SAL +
DSLink4.COMM)
NEW COLUMNS:
TOTSAL=TOTSAL(assign stage variable)
TAX=TAX(assign stage variable)
HRA=HRA(assign stage variable)
GROSSSAL=TOTSAL(sv)+HRA(sv)-TAX(sv)
TARGET:Text File

SCENARIO6:
Create a job that can load employee whose name start with ‘S’ or ‘J’
Solution:
Source:EMP(oracle)
Transformations
1.Transformer
2.Filter

In transformer define one new stage variable TEMP


TEMP=EMPNAME[1,1] now in temp it has 1st char of each row will stored
In filter transformation put condition WHERE TEMP=’J’ or TEMP=’S’

SCENARIO7:
Create a Job that can Load Alter native records in a target

Solution:EMP(ORACLE)
Transformations:TRANSFORMER1,TRANSFORMER2,FILTER
Transformer1: Define new column SEQNO
Create stage variable=SEQNO
SEQNO=SEQNO+1
SEQNO conatin values 1,2,3,4,5,6,7,8,9,10,11,12,13,14
Define New column=OUTPUT_SEQNO
OUTPUT_SEQNO=SEQNO(Assign Stage variable)
Transformer2:
Create New column TEMP
TEMP= Mod(DSLink6.OUTPUT_SEQNO,2)
Now TEMP contains values 1,0,1,0,1,0,1,0,1,0,1,0,1,0

FILTER:where TEMP=0
Now every Alter native record will be loaded

SCENARIO8:
Create a job that can Load 5th record and 8th record
Solution:EMP(ORACLE)
Transformations:TRANSFORMER1,FILTER
Transformer1: Define new column SEQNO
Create stage variable=SEQNO
SEQNO=SEQNO+1
SEQNO conatin values 1,2,3,4,5,6,7,8,9,10,11,12,13,14
FILTER :Where SEQNO=5 or SEQNO=8
SCENARIO9:
Transform the values of CUSTOMER GENDER values 1,0,2 to F,M,UNK
Source Data:
CUSTID CUSTNAME GENDER
7369 SUBHA 1
7499 SURESH 0
7499 JAMES MEENA 2

Targetdata:
CUSTID CUSTNAME GENDER
7369 SUBHA F
7499 SURESH M
7499 JAMES MEENA UNK

Solution:
Source:Text file
Transformtion: Transformer
In Transformer do the derivation for GENDER column
GENDER= If DSLink4.GENDER =1 Then "F" Else If DSLink4.GENDER=0 Then
"M" Else "UNK"
Target:Text File

SCENARIO10:
Concatenate CUST_FNAME,CUST_LNAME
Sourcedata:
CUSTID,CUST_FNAME,CUST_LNAME,CITY
7001,BILL,CLINTON,HYD
7002,NARA,LOKESH,BANG
7003,SONIA,GANDHI,DELHI
7004,RAVI,KISHORE,PUNE

Target:
CUSTID,CUSTNAME,CITY
7001,BILL CLINTON,HYD
7002,NARA LOKESH,BANG
7003,SONIA GANDHI,DELHI
7004,RAVI KISHORE,PUNE
Solution:
Source:Text file
Transformation:Transformer
Define New column ie CUSTNAME in transformer and do the derivation
CUSTNAME=DSLink4.CUST_FNAME:" ": DSLink4.CUST_LNAME
Target:Textfile
SCENARIO11:
Sourcedata:
CUSTID,CUSTNAME,EMAIL
7369,BHASKAR,BHASKAR@GMAIL.COM
7466,KIRAN,KIRAN@GMAIL.COM
7578,RAJU,RAJU@GMAIL.COM

Output:
CUSTID,CUSTNAME,EMAIL,USERNAME
7369,BHASKAR,BHASKAR123@GMAIL.C,BHASKAR123
7578,RAJU,RAJU143@GMAIL.COM,RAJU143
7466,KIRAN,KIRAN78@GMAIL.COM,KIRAN78

Solution:
Source:Textfile
Transformation: Transformer
Define new Column ie USERNAME
Do the derivation
USERNAME=DSLink4.EMAIL[1,Index(DSLink4.EMAIL,'@',1)-1]
Target:Textfle

SCENARIO12:
Source Data:
CUSTID,CUSTPHONE
7369,9948047684
7466,9603145670
7479,9912395605
7654,8600097140

Target:
CUSTID,CUSTPHONE
7369,(994)-80-476-84
7466,(960)-31-456-70
7479,(991)-23-956-05
7654,(860)-00-971-40

Solution:
Source:Textfile
Transformation: Transformer
Do the derivation for CUSTPHONE
CUSTPHONE=”(“:DSLink4.CUSTPHONE[1,3]:”)”:”-“:
DSLink4.CUSTPHONE[4,2]:”-“: DSLink4.CUSTPHONE[6,3]:”-“:
DSLink4.CUSTPHONE[9,2]
Target:Textfle

SCENARIO13:
There are 3 target table with T1,T2,T3 ENAME Start with “S” pass to “T1”
ENAME start with “J” pass to “T2” And others pass to “T3”

SCENARIO14:
There are two targets with name “T1”,”T2” EMPNO Even pass to “T1”& EMPNO
Odd pass to “T2”

SCENARIO15:
Verify the Nulls on the following source columns
EMPNO,ENAME,JOB,SAL,COMM,DEPTNO A record with out Null value pass to
“T1” If any one of the column is having Null then pass to “T2”

Solution:
Source:EMP(Oracle)
Transformation:Transformer

Intransformer T1 constrain define the logic below


T1= IsNotNull(DSLink3.EMPNO) AND IsNotNull(DSLink3.ENAME) AND
IsNotNull(DSLink3.JOB) AND IsNotNull(DSLink3.SAL) AND
IsNotNull(DSLink3.COMM) AND IsNotNull(DSLink3.DEPTNO)

T2= IsNull(DSLink3.EMPNO) OR IsNull(DSLink3.ENAME) OR


IsNull(DSLink3.JOB) OR IsNull(DSLink3.SAL) OR IsNull(DSLink3.COMM) OR
IsNull(DSLink3.DEPTNO)
Target:T1,T2

SCENARIO16:
There are two targets with name T1,T2 ,2ND Record pass to target “T1”,8 record
pass to target “T2”

Solution:
Source:EMP(Oracle)
Transformer: Define new column SEQNO
Create stage variable=SEQNO
SEQNO=SEQNO+1
Define New column=OUTPUT_SEQNO
And Assign SEQNO to OUTPUT_SEQNO
Now OUTPUT_SEQNO contains values 1,2,3,4,5,6,7,8,9,10,11,12,13,14

Filter Transformaion apply condition


Where OUTPUT_SEQNO=2 Pass to “T1”
Where OUTPUT_SEQNO=8 Pass to “T2”
Target:Text file(sequential file)

SENRIO17:
INPUT:
--------------
EMPID SAL
100 1000
200 2000
300 3000

OUTPUT:
-----------
EMPID SAL SAL_SUM
100 1000 6000
200 2000 6000
300 3000 6000

You might also like