How to Vertical Pivot

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

How to Vertical Pivot

Post by MrBlack »

Can anyone explain how to do a vertical pivot for the server addition? All my searches are turning up example for the parallel edition. I'm assuming the pivot stage can do horizontal and vertical. I've used it for horizontal pivoting, so I've been testing putting different values in the derivation of the output of the stage.

To help illustrate here' the source format:

Code: Select all

ID_Column,Column_Name,Column_Value
1,First_Name,Joe
1,Last_Name,Smith
1,Color,Blue
2,First_Name,Amy
2,Last_Name,Joe
2,Color,Green
And the destination format:

Code: Select all

ID_Column,"First_Name","Last_Name","Color"
1, Joe, Smith, Blue
2, Amy, Joe, Green
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The server job Pivot stage can only do horizonal pivot. To perform vertical pivot in a server job use Sort, Transformer and Aggregator stages. Use stage variables to construct the output lines, and an Aggregator stage to preserve only the Last of each group.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Reply

Post by ssnegi »

In transformer put constraints for First_Name, Last_Name and Color and output them on three seperate links. Then use Link Collector stage to sort/merge them together into one record per ID_Column group.
Post Reply