× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: duplicate record Id's in multi user environment
  • From: Buck Calabro <buck.calabro@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 16 Oct 2000 09:51:06 -0400

Jim Franz wrote:

>> time. So the question remains, how to be absolutely sure of no duplicate,
>> yet fast to assign. Last time I did this, it was a combination key from
RPG
>> pgm data structure JOB, JOB NBR, and then timestamp (a single user could
not
>> enter 2 records within the same timestamp). (if you want file keyed in
entry

Eric N. Wilson wrote:

>Well Jim I agree that the likelihood of a user job writing twice in
>one timestamp click is impossible at this moment, perhaps they 
>will be able to in the future.

I have already been bit by this in the past.  If two machines are writing
data to a single distributed database you can indeed have the exact same
User, Job, Job number and timestamp.  Let me tell you - it's rare, but it
hurts when it happens.

Having a server job that delivers IDs is a good solution to a high volume
environment - checkpoint the number every 25 increments or 5 seconds of
elapsed time.  If the system fails, you need to write a "find the last
number used" routine to re-synchronise before first use.  For more typical
performance regimes, simply locking a data area works just fine.

If the "get the next number" routine is encapsulated in a service program,
you can change the underlying "get next" code without affecting the programs
that use the next number.  I would do this even if you decide that the code
will always be as simple as *LOCK IN, ADD, OUT.  It's easy to implement and
reinforces good design habits.

Of course, the very fastest way to do writes without worrying about
duplicates is to use a sequential file...  :-)

Buck Calabro
Aptis; Albany, NY
"We are what we repeatedly do.
 Excellence, then, is not an act, but a habit." --Aristotle


Billing Concepts Corp., a NASDAQ Listed Company, Symbol: BILL
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.