How to continue to increment a number

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
ScottDun
Participant
Posts: 61
Joined: Thu Dec 10, 2015 9:51 am

How to continue to increment a number

Post by ScottDun »

I currently created a job that creates a number for every entry into a table. The number will start at 5000 and will increment per provider. So if a file has 10 providers, it will be 5000-5009. If I run this same file again (or if there is a new file) I want it to start at 5010. How do I go about this?


http://imgur.com/a/jDfii
SCOTTDun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Non-specific answer - persist it. That or run SQL against the table to get the current max value + 1 and pass it into the job as a parameterized starting value.

ps. You really should be using meaningful names for your stage variables.
-craig

"You can never have too many knives" -- Logan Nine Fingers
naveenkumar.ssn
Participant
Posts: 36
Joined: Thu Dec 03, 2009 9:11 pm
Location: Malaysia

Re: How to continue to increment a number

Post by naveenkumar.ssn »

Hi

If you have a database , then you can place a column as count and load the highest record count in the table and then read the column with max count +1 ..or if you dont have a database create a file and the load the max count value in it along with a dummy join column(name it as 1) .use a join stage and then read the seq. file as reference.

Both will work !!

Regards
Naveen
Naveen Kumar
Datastage Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The database itself probably supports a structure called a SEQUENCE that you can invoke to generate the numbers, usually via a property called something like NEXTVAL.
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