Pivoting but not sure vertical/horizontal

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
nvkuriseti
Premium Member
Premium Member
Posts: 38
Joined: Sat Jan 17, 2004 12:29 am
Location: Hamburg, Germany

Pivoting but not sure vertical/horizontal

Post by nvkuriseti »

Hello All, Good Morning.

Currently I am developing a solution and need your suggestions for this business rule. My Input data is,

INV_ID|TYPE|C_ACC_NO|I_ACC_NO
262894733|INVOICE|<NULL>|I80501
262894733|CUSTOMER|40458|<NULL>
262889640|CUSTOMER|48909|<NULL>
262890100|INVOICE|<NULL>|K7856
262890101|CUSTOMER|34890|<NULL>
262890101|INVOICE|<NULL>|J5674
.
.
.

From above input, my output should be
INV_ID|C_ACC_NO|I_ACC_NO
262894733|40458|I80501
262889640|48909|<NULL>
262890100|<NULL>|K7856
262890101|34890|J5674

From above, my source Input is Hashed file keys are INV_ID, TYPE. My target load file keys are only INV_ID. I did sort before processing data into active stage (Transformer stage) and used five stage variables as mentioned in previous solutions in this website but here the output format is different than the existing solutions in this forum. Please suggest me how to proceed. Thanks for your reply in advance.

-Venkat
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

This looks more like a simple aggregate than a pivot. You have four different unique INV_ID values across six different rows....it appears that you don't care about the value of TYPE..... Unless it is too early and I haven't had enough coffee, it just looks like you need to aggregate and take the maximum value for each of the other strings.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Agreed. Not a pivot but more of an aggregation / looping solution needed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply