|
On Wed, 2005-12-07 at 17:07 -0500, Buck wrote: > The solutions posted so far exhibit a subtle timing issue. It is very > possible to have two jobs run the MAX(EID) and come up with the same > value (or do a SETGT and read the same last record.) > > In order to be bulletproof, one needs to lock that maximum value so that > no one else can get it. Commitment control can help here, as can the > use of a data area. > --buck Hmm, I replied to this last night, but I don't see where it came through. If this is a dupe, I apologize. Actually, it's not much of a problem that two processes can get the same ID since they write it to the database, which has a unique key. All that needs be done is to take care of a duplicate key error by getting another eid. dow 1 = 1; eid = next_eid() write(e) WMERLG; if %status <> DUPE_KEY; leave; endif; enddo; Thanks. Regards, Rich
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.