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
How to continue to increment a number
Moderators: chulett, rschirm, roy
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.
ps. You really should be using meaningful names for your stage variables.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 36
- Joined: Thu Dec 03, 2009 9:11 pm
- Location: Malaysia
Re: How to continue to increment a number
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
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
Datastage Consultant
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.