We have moved to www.dataGenX.net, Keep Learning with us.

Sunday, May 18, 2014

DataStage Scenario - Design7- job1

DataStage Scenario Problem -->  DataStage Scenario - Problem7

Solution Design :

a) Job Design :  Below is the design which can achieve the output as we needed. Here, we are reading seq file as a input, then data is passing through a Transformer and Peek stage to achieve the output.


b) Transformer Stage Properties
Stage will run SEQUENTIALLY.
The logic here is - give a seq no of each 3 rows so that we can do vertical pivot on that. For that we will use 3 stage variable which derivation is as :
svCntr+1 = svCntr
svIncmt = svPivot
If mod(svCntr,3)=0Then svIncmt+1 Else svPivot = svIncmt

and use below column derivation :
In_xfm.col = col
svPivot = PivotCol

First stage variable (svCntr) is increment by 1 for each input row starting from 1. Second stage variable svPivot is assigned to PivotCol. The third stage variable is counting the input rows, when it is equal to multiple of 3, it increment the svIncmt by 1. By this we will get the output like..
Col PivotCol
a 1
b 1
c 1
d 2
e 2
f 2
g 3


b) Pivot Stage Properties
Stage will run SEQUENTIALLY. 
Now, we have to use Vertical Pivoting on Col. Group by "PivotCol" , Put Array Size to 3.


Now, Map the column to output file and compile the job.


No comments :

Post a Comment