Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Visual FoxPro fails on 11/18/1998
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00158805
Message ID:
00158908
Views:
18
>>This morning (11/18/1998) I came to work to discover that our main VFP 5.0 application was not working in any of our offices.
>>
>>The problem resulted from the fact that we're using SUBSTR(SYS(2015), 3, 10) to create unique names for cursors and temporary tables (Note that this is as reccommended in the VFP documentation under the SYS(3)-Legal File Name topic).
>>
>>On 11/18/1998, the expressesion generates a string beginning with zero. This seems to be the cause of the problem. The solution was simply to preface the expression with a letter (ex: 'T'+SUBSTR(SYS(2015)).
>>
>>If anyone else has experienced the problem today, give this a try!
>
>Richard --
>
>FWIW, you can use SECONDS() instead of SYS(2015) to create unique file names:
>
>LOCAL m.lcFileName, m.lcTempDBF, m.lcTempCDX
>m.lcFileName = 'XX' + STR(100000 + SECONDS(), 6)
>m.lcTempDBF = m.lcFileName + '.DBF'
>m.lcTempCDX = m.lcFileName + '.CDX'
>
><--- Add your code to create the temporary table and index. Then, when you are finished, do this to clean up:
>
>USE IN (m.lcTempDBF)
>DELETE FILE m.lcTempDBF
>DELETE FILE m.lcTempCDX
>
>I have used this approach in quite a few network apps (many concurrent users) with no problems at all. If you have a concern about two users running this code at exactly the same instant (theoretically getting the same value for SECONDS()), then you could substitute 'XX' with something like the user's login code or workstation ID in order to guarantee uniqueness.
>
>Bill

Oops...last couple of lines should read:

USE IN WhateverMyAliasIs
DELETE FILE (m.lcTempDBF)
DELETE FILE (m.lcTempCDX)

Bill
Previous
Reply
Map
View

Click here to load this message in the networking platform