how to generate sequence numbers

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
vijaya
Participant
Posts: 15
Joined: Mon Jul 24, 2006 2:51 am

how to generate sequence numbers

Post by vijaya »

I needed to generate sequnce number like

a-1
a-2
b-1
b-2

how can we do in datastage
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Use stage variable in a transform stage

Variable: "ACount", derivation "IF In.Column="A" THEN ACount + 1 ELSE ACount
Variable: "BCount", derivation "IF In.Column="B" THEN BCount + 1 ELSE BCount

That gives you a numeric value for subsequent occurrences of a string and you can do the rest from that.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make sure that the data are appropriately partitioned, so that all values in each group occur in the same partition. Otherwise you will get broken sequences.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply