It can actually be done without the loop.  Simply increment a unique
sequential number for every record written so that the key has at
least a time and the sequential number.  If multiple records come
through in the same second, they'll have a different sequential number
and will still be unique.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Key Ally
Sent: Wednesday, July 20, 2005 10:30 AM
To: [email protected]
Subject: Re: [U2] DATABASE write problem

Jerry,
     I alwys like this sort of a protection against overwriting:

     100    BASE.ID = 'ZZZ' : '.' : DATE() : '.' : TIME() : '.'
     101    DONE = FALSE
     102    TIEBREAKER = 1
     103    LOOP
     104       READU DUMMY FROM  BASE.FILE, BASE.ID  : TIEBREAKER
LOCKED
     105          TIEBREAKER += 1
     106       END THEN
     107          TIEBREAKER += 1
     108          RELEASE BASE.FILE, BASE.ID : TIEBREAKER
     109       END ELSE DONE = TRUE
     110     UNTIL DONE DO
     111     REPEAT
     112     *
     113     WRITE BASE.REC ON BASE.FILE, BASE.ID : TIEBREAKER

      You always get a unique ID and it cost very little time.

       - Chuck "Loopy" Barouch
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to