grouping data with DS

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
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

grouping data with DS

Post by Luk »

Hi!

I don't know if I entitled this post correctly but I haven't got better idea :)

I have following situation:

colA, colB
1 xxx
1 yyy
1 zzz
2 xxx
2 zzz
3 xxx

and I want to get sth like this

1) xxx,yyy,zzz
2) xxx,zzz
3) xxx

Is it possible to use one of DS stages to do this (maybe transformer) or is the only way, to solve this isue, to use SQL procedure on source database ??
LUK
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can do this in DS by sorting the source and concatenating the desc on identical keys followed by writing into an hash file with the key as your source key.
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Re: grouping data with DS

Post by battaliou »

Stage variables are useful here to concact data together. You can set stagevar2 as your source ID and stagevar1 as stagevar2 and compare the differences (stagevar1 created before stagevar2)

I'd send the data to an aggregator and with the 'last' option selected rather than landing to a hash file, this keeps the data memory resident so you get a performance gain.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

Sainath.Srinivasan wrote:You can do this in DS by sorting the source and concatenating the desc on identical keys followed by writing into an hash file with the key as your source key.
in what way you want to do concatenation?? using stagevariables as battaliou said?? nothing else (exept of stagevar) is coming into my mind!
LUK
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Yes. Using stage variables. But writing into an hash file instead of using an agg stage.
Post Reply