View previous topic :: View next topic
|
Author |
Message |
rajesh_mbt
New User
Joined: 27 Mar 2006 Posts: 97 Location: India
|
|
|
|
Hi
I have a request to generate a random number whenever the user access a file. I need to create(Generate) a unique number for each time the file is accessed.
I tried to create sequence number to avoid duplicates.... But when more than one user access the same time then it failed.
Can anybody throw some lights on it? |
|
Back to top |
|
|
rajesh_mbt
New User
Joined: 27 Mar 2006 Posts: 97 Location: India
|
|
|
|
rajesh_mbt wrote: |
Hi
I have a request to generate a random number whenever the user access a file. I need to create(Generate) a unique number for each time the file is accessed.
I tried to create sequence number to avoid duplicates.... But when more than one user access the same time then it failed.
Can anybody throw some lights on it? |
Note : The size should be x(08) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Batch? On-Line? Over what timeframe must these numbers be unique? (year, week, day, forever?) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I tried to create sequence number to avoid duplicates.... |
How did you try to create this sequence number? |
|
Back to top |
|
|
rajesh_mbt
New User
Joined: 27 Mar 2006 Posts: 97 Location: India
|
|
|
|
dbzTHEdinosauer wrote: |
Batch? On-Line? Over what timeframe must these numbers be unique? (year, week, day, forever?) |
It's for batch program. The time frame must be unique for a week.... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
rajesh_mbt wrote: |
It's for batch program. The time frame must be unique for a week.... |
Some combination of date and time with the JES job number in the low order position should unique it....
If the X(8) does not need to be displayable, binary representation will allow quite a range..... |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
I know its not as elegant as CICS Guy, but....
Use the date and time, but then take a binary representation of their user id. Mulitply the datetime by the userid to get your unique value.
Why does it have to be a number? Will any calculations be done on this data? If not then just do DATETIMEUSERID. So you get 2007123084512USERID |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
What is the purpose of this unique ID? Where will it be stored?
This is batch, you said file and not DB2, why not use SMF records (15 I think) to perform whatever audit you are performing. |
|
Back to top |
|
|
|