IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need COBOL function to generate unique id


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
soumyaranjan007

New User


Joined: 30 Aug 2006
Posts: 30
Location: mumbai

PostPosted: Fri Nov 10, 2006 3:52 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 10, 2006 5:06 pm
Reply with quote

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
View user's profile Send private message
soumyaranjan007

New User


Joined: 30 Aug 2006
Posts: 30
Location: mumbai

PostPosted: Fri Nov 10, 2006 5:44 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 10, 2006 6:38 pm
Reply with quote

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
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Thu Nov 16, 2006 2:25 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top