View previous topic :: View next topic
|
Author |
Message |
soumyaranjan007
New User
Joined: 30 Aug 2006 Posts: 30 Location: mumbai
|
|
|
|
My requirements are as below,
1. we want to generate one unique no like Trans Id in DB2 table without help of any DB2 table.
Is there any Cobol Function like GENERATE_UNIQUEID in DB2. So that we can able to generate unique id in COBOL variable. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Unique to what? Have you thought out your question?
If you want a unique value for a column in a DB2 table, you need to know what values are already in the DB2 column. |
|
Back to top |
|
|
soumyaranjan007
New User
Joined: 30 Aug 2006 Posts: 30 Location: mumbai
|
|
|
|
Actually my business requirement is like:-
I am working in credit card domain. Every day we are getting transaction file as pert of our daily process. But i am getting trisection batch file without having unique transection id, so we have to generate a unique transaction id for each of transaction.
i am thinking that if we could generate unique id by help of COBOL function or db2 system table , that will good.
Regards
Somu |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what is wrong with a timestamp?
transactio-ids are normally generated to encode the source, subject, type, etc... A transid is used for an audit trail. suggest you google for some info on the subject. |
|
Back to top |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
While creating the db2 table you can use one field as unique identifier by declaring the field as GENERATED ALWAYS AS IDENTITY
EG:
Code: |
CREATE TABLE EMP(ID INTEGERATED ALWAYS AS IDENTITY PRIMARY KEY,NAME VARCHAR(20),DEP VARCHAR(20)); |
|
|
Back to top |
|
|
|