Changing the Data format - Columns to 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
samratisking
Participant
Posts: 37
Joined: Tue Jan 29, 2008 6:03 am
Location: Guntur
Contact:

Changing the Data format - Columns to Rows

Post by samratisking »

Hi,

I have data like the following:

Col1 ColA ColB ColC ColA1 ColB1 ColC1
--------------------------------------------------------------

123 abc def ghi jkl mno pqr
456 stu vwx yza bcd efg hij



My requirement is that I need the data in the following format:


Col1 ColA ColB ColC
------------------------------
123 abc def ghi
123 jkl mno pqr
456 stu vwx yza
456 bcd efg hij


Could anyone please let me know which stage i need to use and a bit of insight into the logic..

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

Post by ray.wurlod »

Transformer stage with two outputs followed by a Funnel stage. The key goes to both output links. The first three columns go to the first output link, the other three columns go to the second output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
samratisking
Participant
Posts: 37
Joined: Tue Jan 29, 2008 6:03 am
Location: Guntur
Contact:

Post by samratisking »

ray.wurlod wrote:Transformer stage with two outputs followed by a Funnel stage. The key goes to both output links. The first three columns go to the first output link, the other three columns go to the second output ...
Hi Ray,

That's a cool way of doing it. Instead, you think I can use a Copy stage and Funnel stage to funnel the data into single output..? Is there any particular need to use the Transformer here?

Thanks.
Samratisking
ravireddy25
Participant
Posts: 59
Joined: Wed Dec 31, 2008 5:49 am

Post by ravireddy25 »

Hi,
No Need Transformer stage ,you can use copy stage ,have two output links and rename the 2nd link column names to first link column names before funneling.
Ravi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Excellent.

(My server job background came through for a bit, there.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
samratisking
Participant
Posts: 37
Joined: Tue Jan 29, 2008 6:03 am
Location: Guntur
Contact:

Post by samratisking »

ravireddy25 wrote:Hi,
No Need Transformer stage ,you can use copy stage ,have two output links and rename the 2nd link column names to first link column names before funneling.
Cool.. That's exactly.. what i had in mind. I mean, the Funnelling wont work if I dint. Thanks..
Samratisking
samratisking
Participant
Posts: 37
Joined: Tue Jan 29, 2008 6:03 am
Location: Guntur
Contact:

Post by samratisking »

ray.wurlod wrote:Excellent.

(My server job background came through for a bit, there.) ...
It's the same with me. It's just the necessity that I have to decrease the complexity of the job. I am from server jobs background too. Thanks Ray.
Samratisking
samratisking
Participant
Posts: 37
Joined: Tue Jan 29, 2008 6:03 am
Location: Guntur
Contact:

Post by samratisking »

Hi,

Can we do all these operations using a pivot stage??
Samratisking
way246
Participant
Posts: 7
Joined: Wed Sep 01, 2010 9:06 am
Location: Europe

Post by way246 »

samratisking wrote:Hi,

Can we do all these operations using a pivot stage??
Yes, it's possible
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Only if you combine the triplets of columns into single columns (then back again into separate columns after pivoting if needed).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply