Resturcture Stages

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
als110
Participant
Posts: 43
Joined: Fri Nov 05, 2004 11:21 am
Location: United States

Resturcture Stages

Post by als110 »

I have the following data coming in and I want it to be restructured into the second list of data. I have figured out how to do it with a transform outputted to x amount of links then funneled back together. I want to aviod this becuase in my actual job I have to do this with around 20 fields. Below is my input and what i want it translated to. Does anyone know if I can do this with a restructe stage and with which one.

Input
Key Cd1 cd2 Cd3
1 A B C
2 A B C
3 A B C


New output
KEY Code
1 A
1 B
1 C
2 A
2 B
2 C
3 A
3 B
3 C

Thank You
Aaron Smith
NewPXUser
Participant
Posts: 17
Joined: Fri Feb 11, 2005 6:06 am

Post by NewPXUser »

Maybe what you need is

awk '{ for (i = 2; i<= NF; i++) { print $1 $i } }' <filename>
rgandra
Premium Member
Premium Member
Posts: 49
Joined: Mon Aug 02, 2004 9:31 am
Contact:

Re: Resturcture Stages

Post by rgandra »

Use Pivot Stage.
Output Column Derivation
Key Key

Code Cd1, Cd2, Cd3
Post Reply