>snip...
>Most programmers end up using something on this order. I have a different situaton where I have independent installations that may want to merge their data. I use SYS(3) to generate keys. One draw back is the number is nonsense and sometimes you would like to know the order records were added for audit purposes. Do you know of other draw backs to using sys(3)?
The return value of Sys(3) was prone to changes thru different versions of Fox and OSes used. In mFoxPlus, under Dos 3.x, up to FoxPro 1.0x, it returned eight characters, unless used on a Novell 2.x network, where it returned a dollar sign and seven digits; on Foxplus/Xenix it also returned something slightly different. Then, on FoxPro 1.0x it returned these digits transformed into letters, and there seemed to be sixteen of them (A to P, A probably representing a hex zero), and it suddenly reverted to decimal digits.
The other problem may be resolution of the clock it uses - I'm not sure it will generate unique keys. I tried this:
dime x(10)
for i=1 to 10
x(i)=sys(3)
endf
for i=1 to 10
?x(i)
endf
It succeeded in repeating a value, and I have had both UT Nav and VFP open at the same time, on a 133MHz K5. You can imagine what it may do on quicker machines. Sys(3) is suitable for a random filename - filenames are not created in consecutive milliseconds. For keys, no.