Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird problem encountered using SYS(2023)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00774214
Message ID:
00774335
Views:
11
>I've used SYS(2023) for quite some time as a place to create temporary files. Suddenly on only five of our workstations, the alias values of such an open temp file in the system temp path changes the stored path in memory at runtime.
>
>In other words, I have a procedure that creates and opens 6 temp files in the same directory with unique file names. Only on the 4th file, does the SELECT command fail and only on 5 of our 20 workstations and only since yesterday. Nothing that I know of has changed on these workstations in the last several weeks.
>
>Below is the code. Note that before this code runs, the exact same code creates and opens 3 other temp files the same way.
>
>What seems to be happening is the short verses long directory names. Somehow the short directory names are changing to point to another structure with-in the persons windows 2000 profile between the 3rd and 4th SYS(2023) call?

Offhand, you're changing the work area, creating files while old ones may be open/still exist etc. Does the refactored code below work any better?
IF USED('UACQuery')
*!*	   SELECT UACQuery
*!*	   USE
   USE IN UACQuery	&& does not change current work area
ENDIF
	
*-- Close the FILEUAC table before CREATEing it:	
IF USED(THISFORM.FILEUAC)
*!*		SELECT (THISFORM.FILEUAC)
*!*		USE
	USE IN (THISFORM.FILEUAC)
ENDIF

*-- Create a variable to hold the temp file name so you're less vulnerable
*-- to changes in SYS(2023). More readable too:
LOCAL lcTempFileName
lcTempFileName = AddBS(Sys(2023))+THISFORM.FILEUAC

SELECT 0

*-- Don't use DESC as a column name, it's a reserved word:
*!*	CREATE TABLE (AddBS(Sys(2023))+THISFORM.FILEUAC) FREE	( UAC C(03), LOB C(03), CO C(03), ACTION C(10), DESC C(80) )
CREATE TABLE (lcTempFileName) FREE	( UAC C(03), LOB C(03), CO C(03), ACTION C(10), CDESC C(80) )

USE (lcTempFileName) IN 0 ALIAS UACQuery EXCLUSIVE
SELECT UACQuery  &&  <==== Fails here

*-- Any reason you don't use a structural index? e.g.
*!*	INDEX ON UAC TAG UAC
*!*	SET ORDER TO UAC IN UACQuery

INDEX ON UAC TO (lcTempFileName)
SET INDEX TO (lcTempFileName)
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform