Rows to Columns

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
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Rows to Columns

Post by devidotcom »

Hi All,

I have a scenario to handle. Please suggest approach to design the job.

Input:
Column1 Column 2 Column3
4321 X1 3
4321 X2 4
4321 X3 6

Output Required:
Column1 Column2 Column3 Column4
4321 3 4 6

The source is dynamic where the column2 and column3 can have new values for Column1 indicating the columns output must increase accordingly.


Thanks,
Devi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is a horizontal pivot. Use a Pivot stage or a Pivot Enterprise stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post by devidotcom »

Well.. guess its vertical pivot.

Please elobrate how to use pivot stage in this case..
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

devidotcom wrote:Well.. guess its vertical pivot.

Please elobrate how to use pivot stage in this case..
Vertical Pivot is available only in 8.5
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post by devidotcom »

We are using 8.0 how do i implement this here.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My bad. 4am start today, it's now 8:30pm. Yes, it's a vertical pivot. Search DSXchange to find out how to do it. It's been explained many times.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ds@tcs
Participant
Posts: 24
Joined: Thu Mar 17, 2011 6:26 am
Location: chennai
Contact:

Re: Rows to Columns

Post by ds@tcs »

use sort stage , there generate change code with cluster or key change , will get 1 for first rows and 0 for duplicates, then use Transfromer stage , there in stage varaible write condition like if change_code=1 then link to new col else concatinate to previous col

hope this helps trywith this
Devi
Regards
Sankar
Post Reply