Concatenate Rows in Single Column

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
mohdtausifsh
Participant
Posts: 14
Joined: Tue Dec 20, 2005 2:29 am

Concatenate Rows in Single Column

Post by mohdtausifsh »

HI
I have Requirement like this

Input
PID JOBNAME
1 A
1 B
1 C
.
.
. X


My output should be

PID JOBNAME
1 A,B,C.,.,.X

Could you please help me in acheiving in datastage

Thanks in Advance
Mohammed Tausif
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would be a 'vertical pivot' (aka rows to columns) and an exact search here will reveal the options you have.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mohdtausifsh
Participant
Posts: 14
Joined: Tue Dec 20, 2005 2:29 am

Post by mohdtausifsh »

If it is verticle pivot for rows in to column we can acheive it in transformer,but here the rows should be concatenated in to single column.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Still a vertical pivot and to me the easiest way to solve the 'concatenation' part in a Server job is to use a Hashed File. Read and write to it in the same transformer, create a new record for each key on a lookup miss and append values on a lookup hit. Make sure you do not cache the lookup.

A search here would have revealed this.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or just do the appending in a Transformer stage. Follow the Transformer stage with an Aggregator stage that captures the last row 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or that... another technique the search would have turned up. :wink:

One approach requires sorted data, the other does not.
-craig

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