Row/Column File Transpose

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
belaruska
Premium Member
Premium Member
Posts: 12
Joined: Wed Feb 28, 2007 5:00 pm

Row/Column File Transpose

Post by belaruska »

I have a file in the following format:

co1 col2 col3
row1 data11 data12 data12
row2 data21 data22 data23
row3 data31 data32 data33

the data should be modified:

row1 col1 data11
row1 col2 data12
row1 col3 data13
row2 col1 data21
row2 col2 data22

the number of columns is dynamic.

i tried 'make subrecord' stage, but it didn't produce the correct result.

would really appreciate any suggestions.
ThilSe
Participant
Posts: 80
Joined: Thu Jun 09, 2005 7:45 am

Re: Row/Column File Transpose

Post by ThilSe »

belaruska wrote:I have a file in the following format:

co1 col2 col3
row1 data11 data12 data12
row2 data21 data22 data23
row3 data31 data32 data33

the data should be modified:

row1 col1 data11
row1 col2 data12
row1 col3 data13
row2 col1 data21
row2 col2 data22

the number of columns is dynamic.

i tried 'make subrecord' stage, but it didn't produce the correct result.

would really appreciate any suggestions.
Hi,
With a Pivot stage u can get the following output:
row1 data11
row1 data12
row1 data13
row2 data21
row2 data22

I am not sure how to get the column name as part of the output record

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

Post by ray.wurlod »

Generate a column containing the column names (as constants) upstream of the Pivot 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.
belaruska
Premium Member
Premium Member
Posts: 12
Joined: Wed Feb 28, 2007 5:00 pm

Post by belaruska »

ray.wurlod wrote:Generate a column containing the column names (as constants) upstream of the Pivot stage.
Hi Ray,
can you elaborate on how the column names can be matched up with the correct value?
Thanks
belaruska
Premium Member
Premium Member
Posts: 12
Joined: Wed Feb 28, 2007 5:00 pm

Post by belaruska »

ray.wurlod wrote:Generate a column containing the column names (as constants) upstream of the Pivot stage.
Hi Ray,
can you elaborate on how the column names can be matched up with the correct value?
Thanks
belaruska
Premium Member
Premium Member
Posts: 12
Joined: Wed Feb 28, 2007 5:00 pm

Post by belaruska »

Got the solution from this post:

viewtopic.php?t=106291&highlight=
Post Reply