I have a DB2 file that I will append records to. The key is incrementally increased by +1 for every record written. I don't know what the last key value is when I start adding.
My plan was to do a count on the DB2 table, retrieve the last key value and pass it on to the transformer stage incrementing the key by 1. What I am not sure of is, how can I store the last record in a variable from the DB2 read.
Is there an easier way
Thanks.
Variables
Moderators: chulett, rschirm, roy
A much more robust and acceptable method would be to declare and use a DB2 sequence to do this. You call a DB2 stage as a reference lookup to get the next value from the sequence (and increment the counter). This will work no matter how parallel your job gets since DB2 controls the concurrency and locking of this entry.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you must do it in a parallel job, prefer to use a Surrogate Key Generator stage. The initial value can be picked up be a previous (server?) job and passed into the main job as a job parameter value.
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.
Pass variables from where? From outside of the job as a parameter?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: