Data transformation -design question

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
dscon9128
Participant
Posts: 25
Joined: Fri Jun 13, 2008 9:11 am

Data transformation -design question

Post by dscon9128 »

Hi ,

I have a requirement to perform the following transformation , but im not sure how i could go about it. Ive been trying to play around with it, but my efforts have led to dead ends :(.

Brand---- code---------- Position
A------ 1 ----------------- X
A------ 1 ----------------- Y
A------ 1 ----------- Z
B------ 2 --------------- U
B--------- 2 ----------------- V

This should convert to

Brand ---- Code--- Position1--- Position2--- Position 3
A ---------- 1 ------- X---------- Y----------- Z
B ------------ 2 ------ U-----------V

Ideally i would like to convert it to :

Brand -----Code -- Position
A ----------- 1----- XYZ
B ------------2----- UV


I dont know which one is easier to do, if at all feasible.

Thanks for your time and help!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Sort your data by Brand and Code. Create a stage variable to detect when Brand:Code changes, create another that stores the concatenated string value of "Position" and output that when the Brand:Code changes.
dscon9128
Participant
Posts: 25
Joined: Fri Jun 13, 2008 9:11 am

Post by dscon9128 »

Thanks for the response. I dont have the previlige of premium membership, but the little that i could see (using stage variables ) tipped me in the right direction :). I stuck a dummy count column in front of brand and code which would take the same value (say 1) ,as long as brand and code didnt change. At the same time,while looping within 1, i concatenated the positions within the transformer. When brand and code changed, i would repeat the same process for the next different value of the dummy count (Say 2).

Thanks again for your time!
Post Reply