Page 1 of 1

sequence number generation

Posted: Wed Oct 13, 2010 10:13 am
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?

Posted: Wed Oct 13, 2010 10:30 am
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

Posted: Wed Oct 13, 2010 10:33 am
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.

Posted: Wed Oct 13, 2010 10:59 am
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.

Posted: Wed Oct 13, 2010 11:03 am
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?

Posted: Wed Oct 13, 2010 11:11 am
by vinothkumar
( (@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)
Use the above derivation to get the record count

Posted: Wed Oct 13, 2010 11:19 am
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.

Posted: Wed Oct 13, 2010 11:44 pm
by dsa
Thanks to all of you!!!!