sequence number generation

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
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

sequence number generation

Post by dsa »

Hi All,

I need to generate sequence number in my input file. say if i have 10 records they should have sequence number 1, 2, ,3 .... 10. the file is being run on 5 node configuration system. how can I assign it while file is being split between 5 nodes?
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Create an extra column in your sequential stage and set the option Row Number column in Properties tab to this extra column. This will generate sequential number. But the number starts from zero. You can add one to it in the transformer
You are the creator of your destiny - Swami Vivekananda
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

anbu wrote:Create an extra column in your sequential stage and set the option Row Number column in Properties tab to this extra column. This will generate sequential number. But the number starts from zero. You can add one to it in the transformer
anbu,

But it's running on multiple node so what would happen eventually is records on each node would have sequence number as per that node only... i need to maintain it across the nodes on file level.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Sequential stage runs sequentially and generates sequential row number unless you changed the default setting of Number of readers per Node or Read from Multiple nodes.
You are the creator of your destiny - Swami Vivekananda
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

but I don't have sequential stage. It's just some input I have say dataset where I need to assign sequence number.

Now I can't use sequential stage as I have billions of records so it might be very time consuming if I use so.

Is there any way of keeping track of record counts across nodes?
vinothkumar
Participant
Posts: 342
Joined: Tue Nov 04, 2008 10:38 am
Location: Chennai, India

Post by vinothkumar »

( (@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)
Use the above derivation to get the record count
rohithmuthyala
Participant
Posts: 57
Joined: Wed Oct 21, 2009 4:46 am
Location: India

Post by rohithmuthyala »

In version 8 of Datastage, this can be generated in transformer itself as a surrogate key in the stage properties that too in parallel mode.
Rohith
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

Thanks to all of you!!!!
Post Reply