Page 1 of 1

Converting cols into rows

Posted: Tue Feb 19, 2008 9:01 am
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

Posted: Tue Feb 19, 2008 9:52 am
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).

Posted: Tue Feb 19, 2008 1:03 pm
by prasson_ibm
Hi crouse
Thank you for your reply ....it is working in sever job..