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

Jerry Banker wrote:

Unless it takes a time increment (could be a full second on some systems) between writes you could have a problem with the ID.
A simple test would be:

FOR X = 1 TO 10
CRT TIME()
NEXT X
END

You wouldn't want to use SLEEP to slow things down because the smallest increment it uses is a second and with 64K writes it would take a day and a half to process.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to