How to recount when the job runs again

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
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

How to recount when the job runs again

Post 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.
mahadev.v
Participant
Posts: 111
Joined: Tue May 06, 2008 5:29 am
Location: Bangalore

Post 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.
"given enough eyeballs, all bugs are shallow" - Eric S. Raymond
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Another approach is to use a database sequence directly, or use the new V8 sequence functionality in Transform stages
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

You can also try sequence generator in V8 of datastage .
Nag
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Post 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?
hcdiss
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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