Page 1 of 1

How to recount when the job runs again

Posted: Mon May 25, 2009 11:36 pm
by hcdiss
Hello,

What i am trying to do is -->

1> There is a set of input of 1000 customers.
2> I have to generate serial number - 1- 1000 against all these customers.Hence i used Column Generator stage. I define Count - Bigint and set Start numbering from 1,Increment by 1.
3>Now when i run the job first time i get a count from 1 -1000.
4> This works fine and i get the desired output.

My requirement is -->
1> when i will run the job second time the count should not start from 1001 -onwards and end on 2000 .I am not able to get this work.Similarly when i run the job 3rd time count has to begin with 2001.

I have something in mind like using tranformer and storing the last count.I tried but this was getting difficult.
Second is parameterizing.But no ideas how to parameterise? How to store last count etc?

Please share with me if anyone has suggestions to help out this scenario.

Posted: Mon May 25, 2009 11:44 pm
by mahadev.v
Writing the last generated number into a sequential file and passing this a job parameter in the next run could help. Or a Surrogate key generate stage might be useful.

Posted: Tue May 26, 2009 3:23 am
by ArndW
Another approach is to use a database sequence directly, or use the new V8 sequence functionality in Transform stages

Posted: Tue May 26, 2009 5:58 am
by nagarjuna
You can also try sequence generator in V8 of datastage .

Posted: Tue May 26, 2009 11:10 pm
by hcdiss
I am using DS PX 8.1

But i dont see a Sequence Generator.

There is Column Generator,Surrogate key,Row generator.

Any Inputs?

Posted: Wed May 27, 2009 12:11 am
by ray.wurlod
There is also a Surrogate Key Generator, which is what I believe nagarjuna meant. But a Column Generator would do as well; either way you will need to initialize the sequence. And beware of parallel processing.