Mimic KeyMgtGetNextValueConcurrent routine
Moderators: chulett, rschirm, roy
Mimic KeyMgtGetNextValueConcurrent routine
I would like to get opinion from Gurus on mimicing Key management routines.
We have a sequence table which is very similar to the one that Ascential DataStage Key management routines use to manage the key values.
The structure of our sequence table is
SEQ_NAME
INITIAL_VALUE
CURRENT_VALUE
INCREMENT_VALUE
MAX_VALUE
We want to access 4 or 5 sequence names from the above sequence table in one server job. So we would like to mimic the key management routines which accepts a sequence name and it reads the current value and increments it to increment value, updates the sequence table and returns the incremented value.
Is this something doable using Ascential BASIC language? If anyone has done similar stuff, I would appreciate if they can share their code and give pointers.
Thanks for your time,
-Anil
We have a sequence table which is very similar to the one that Ascential DataStage Key management routines use to manage the key values.
The structure of our sequence table is
SEQ_NAME
INITIAL_VALUE
CURRENT_VALUE
INCREMENT_VALUE
MAX_VALUE
We want to access 4 or 5 sequence names from the above sequence table in one server job. So we would like to mimic the key management routines which accepts a sequence name and it reads the current value and increments it to increment value, updates the sequence table and returns the incremented value.
Is this something doable using Ascential BASIC language? If anyone has done similar stuff, I would appreciate if they can share their code and give pointers.
Thanks for your time,
-Anil
Thanks Kim for your time. We are using a DB2 database.
I need to be able to read, increment and update the current value in the sequence table and return incremented value.
I don't have any experience with BASIC. Could you point me to any guides on connecting to db and executing SQL statements in BASIC?
Thanks,
-Anil
I need to be able to read, increment and update the current value in the sequence table and return incremented value.
I don't have any experience with BASIC. Could you point me to any guides on connecting to db and executing SQL statements in BASIC?
Thanks,
-Anil
If you have no experience with BASIC, the last thing you want to tackle is using it to 'connect to db and executing SQL statements'.
Why not just make a copy of the routine in question and see about modifying it to suit your needs? It already does most of what you want...
![Wink :wink:](./images/smilies/icon_wink.gif)
Why not just make a copy of the routine in question and see about modifying it to suit your needs? It already does most of what you want...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The ultimate reference is BCI Reference Guide. This mimics the ODBC API. You will need a licensed ODBC driver to connect from DataStage routine.
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.
I do not know DB2 but in Oracle you can create functions. ODBC and plugins treat these like columns. In Oracle I do not think you can do an update or insert but if you could then a function could work like Nextval. This can be used in a user defined insert where the key is replaced by the Oracle sequence Seq.Nexval. There are a lot of posts about Oracle sequences. A function with an update statement could duplicate this functionality.
Mamu Kim
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom