View previous topic :: View next topic
|
Author |
Message |
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
This program is running million times a day and possibilities of running multiple times in a same TIME-STAMP.
So, I don't want to create a file/db-table to fetch the value and worry about these things.
1. Waste of resource (file/db)
2. Waste of process (read & update file/db)
3. Waste of CBU time (since I/O operation)
4. Cause of Deadlock.
A simple RANDOM function with unique seed would do my needful. It would be much faster then getting "next available number".
I'm sure "next available number" method will work on normal program that runs minimum times. Appreciate your suggestions |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
A million executions is not so many . . .
Also, i'll wager that using a file/table will add almost invisible overhead compared to whatever this process does.
Why do you believe the random number would be free?
If the next available number is in a file/table, it may never leave memory and there would be only logical i/o, not physical i/o.
There should be no chance for a deadlock if the code is properly implemented. If the code was written to get the next available as the first part of the code (and commit the change), the chance of a time-out is Greatly reduced if not eliminated.
Sounds like you already decided you want to use random. Keep in mind that this Can cause a duplicate that has to be dealt with. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In the CICS Forum, review the Sticky program DATETIME
ibmmainframes.com/viewtopic.php?t=61935
It's for CICS only (can be modified to be for Batch as well).
The Timestamp granularity is down to the microsecond.
If you combine the Date/Time (date-packed is PL5'0CCYYMMDD' and the time-packed is PL13'0HHMMSSTHMIJU"), together with the Task-Number as a PL4, you have a unique random number. |
|
Back to top |
|
|
|