How to concatenate values from similar keys

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
gagan8877
Premium Member
Premium Member
Posts: 77
Joined: Mon Jun 19, 2006 1:30 pm

How to concatenate values from similar keys

Post by gagan8877 »

Hi

I have a sequential file that contains the following values:
"Col1", "Col2"
"1","a"
"1","b"
"1","c"
"2","d"
"3","e"
"4","f"
"4","g"

I need to combine the values with similar key values (column 1). So the output should be:

"1","abc"
"2","d"
"3","e"
"4","fg"

Please guide me how to do this?

Thanks
Gary
"A journey of a thousand miles, begins with one step"
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Search the forum for examples of vertical pivot. It can easily be done by the classic approach of doing key comparisons between present and previous key and storing the values in stage variables.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply