|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
14 Digit unique identifier |
« View previous topic :: View next topic » |
Author |
Message
|
markneil |
Posted: Fri Nov 19, 2004 8:41 am Post subject: 14 Digit unique identifier |
|
|
Apprentice
Joined: 09 Sep 2003 Posts: 26
|
Can somebody tell me ecactly how UUIDASCHAR or UUIDASBLOB generates it's unique identifier? I need a unique (within a few years) ID but have only 14 characters to put it in. If I take the rightmost 14 chars of UUIDASCHAR how unique will it be?!
OR can somebody give me a tip as to how else I could achieve this, possibly using a (DB2) database? I have flows in 4 execution groups that will use this ID however so I have to be careful of contention...
Thanks
Mark |
|
Back to top |
|
 |
fazz |
Posted: Fri Nov 19, 2004 9:39 am Post subject: |
|
|
 Centurion
Joined: 20 Feb 2004 Posts: 144 Location: England
|
Could you not just use a timestamp i.e. YYYYMMDDHHMNSS, this would be 14 in length and will never be repeated.........unless someone invents time travel  |
|
Back to top |
|
 |
kirani |
Posted: Fri Nov 19, 2004 9:56 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
But, it will be a duplicate if 2 message flows create the ID at the same time? I don't know whether this will work for Mark? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Testo |
Posted: Sat Nov 20, 2004 8:59 am Post subject: GENERATE_UNIQUE() FROM DB2 |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
We have a similar situation and our solution is based on the DB2 "GENERATE_UNIQUE()" function that returns a bit data character string 13 bytes long (CHAR(13) FOR BIT DATA) that is unique compared to any other execution of the same function. Refer to DB2 documentation for more info about this function.
In practice we have defined a VIEW in our database in this manner:
Code: |
CREATE VIEW "user"."UNIQUES" ("UNIQUE_ID") AS
VALUES ( GENERATE_UNIQUE() )
|
and when we need a unique ID within a flow, we perform the following:
Code: |
SET Environment.Variables.rs[] = PASSTHRU('SELECT UNIQUE_ID FROM UNIQUES');
SET tempVar = Environment.Variables.rs[1].UNIQUE_ID;
|
where tempVar can be defined as a CHAR or BLOB variable: the former is 29 characters long (e.g. x'<26 semibytes>') as any hex value inserted in a char variable, the latter is 13 bytes long.
This solution works fine if your broker is on Windows or UNIX; on zOS on the contrary, there is an open PMR with IBM Labs because the interaction between eSQL code and a DB2 column defined as "CHAR(13) FOR BIT DATA" has some problems.
Hope this helps,
Cheers,
Andrea Tedone
IBM IT Specialist |
|
Back to top |
|
 |
markneil |
Posted: Mon Nov 22, 2004 1:16 am Post subject: |
|
|
Apprentice
Joined: 09 Sep 2003 Posts: 26
|
Thanks Andrea, that sounds like just what we need. I'll give it a try...
(Kirani was right about the time stamp - we would get duplicates due to >1 parallel execution groups.)
Thanks all,
Mark |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|