Pivot Stage

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
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Pivot Stage

Post by patonp »

In a sample set of data, the format of my input file appears as follows:

CUST ID, HOME_PHONE, BUS_PHONE, ALT_PHONE

I'd like to normalize the data so that the output appears as follows:

CUST_ID, PHONE_NUM, PHONE_TYPE

The PHONE_TYPE column would reflect whether the value in PHONE_NUM was sourced from the HOME, BUS or ALT column.

Is this possible using the Pivot stage?

Thanks!
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can. But it is difficult to trace the source of phone.

It may be useful to have 3 links from a transformer with each representing one phone type and funneling them together.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Simple enough to manually add the 'phone_type' columns (x3) to the data before the pivot and then drop any pivoted rows where the number was null post-pivot.
-craig

"You can never have too many knives" -- Logan Nine Fingers
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

Thanks Craig - works great!
Post Reply