How to generate unique numbers only for duplicates

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
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

How to generate unique numbers only for duplicates

Post by synsog »

Hi All,

I have a scenario like below.

Col1 Col2 Col3 Col4 Col5 Col6(seqno)
A Ram 1000 Ch Vi 1
B Krish 2000 BA SA 1
C MUR 3000 LA BU 1
C MUR 3000 LA BU 2
C MUR 3000 LA BU 3
C MUR 3000 LA BU 4
D ABR 1500 FA KL 1
E FBG 2000 BL RO 1



I am getting source data (Col1, Col2, Col3, Col4, Col5) and I have to generate the numbers for duplicate records like mentioned in Col6. For other than duplicates it's always 1.


As per I know we can generate 0 for duplicates using sort stage but how to generate the unique numbers to duplicate records please let me know.


Would appreciate your help.

Thanks,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use stage variables to increment the counter when there's a duplicate or to reset the counter when a new group starts.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

Hey Synsog,
You might like this approach for your requirement.
http://dsxchange.com/viewtopic.php?p=41 ... d14#416088


Thanks,
Raja R P
Post Reply