Converting cols into rows

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Converting cols into rows

Post by prasson_ibm »

3 cols in the input file:-
depth name
1 A
2 B
3 C1
3 C2
3 C3
2 B1
3 c4
3 c5
1 A1
2 B3
3 C6
3 c7

My condition is that:-
IF depth=1 then its Distributor
IF depth=2 then Its FES
IF depth=3 then Its RETAILER
now output should come like this:-
o/p col:-
distributor FES RETAILER
A B C1
A B C2
A B C3
A B1 C4
A B1 C5
A1 B3 C6
A1 B3 C7


Anyone please help me in solving this issue.....?

there is huge amount of data in the input file and input is simple flat file and o/p is db2
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

It'd be easier, and processing time similar, if done in Server.

Because...
Looks like you'll need to process the file sequentially (no partitioning) since every row is dependent on the previous row. There appears to be no data that you can do hash partitioning on, so PX won't buy you much and you'll have to explicitly tell PX to not run in parallel.

Write a row on every "3 row" with data from each previous 1 and 2 rows.
Store the needed columns from rows 1 and 2 in stage variables, then move them to the output link's columns when ready to write (when you're on the 3 row).
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi crouse
Thank you for your reply ....it is working in sever job..
Post Reply