Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(3) does NOT return the legal file name!
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Sys(3) does NOT return the legal file name!
Miscellaneous
Thread ID:
00927743
Message ID:
00927743
Views:
58
Hi everybody,

I'm trying to run one form from my old application. This form is based on the class BaseForm and it is failing on the method BaseForm.Load on the line:
thisform.ltClass=gctemppath+SYS(3)

    CREATE TABLE (thisform.ltclass) FREE (CLASS C(40))
(Code written by my colleague). SYS(3) returns a string with all numbers.

I checked the Help and it says:

SYS(3) - Legal File NameSee Also
FILE( ) | SYS( ) Functions Overview | SYS(2015) - Unique Procedure NameReturns a legal file name that can be used to create temporary files.
SYS(3)
Return Values
Character
Remarks
SYS(3) may return a non-unique name when issued successively on a fast computer. Use SUBSTR(SYS(2015), 3) to create unique, legal eight character file name.
Note Avoid using this string in CREATE TABLE, CREATE CURSOR, SELECT INTO CURSOR, and other similar commands. Using this string generates an error because a valid FoxPro cursor or alias name cannot begin with a number. If you have used SUBSTR(SYS(2015), 3) to create a unique table or cursor name without explicitly preceding the string with an underscore, (_), or alphabetic character, you can fix your code in the following ways:
On a platform that supports long file names
Use SYS(2015) by itself since it always begins with an underscore.
On platforms and networks that support only the DOS 8+3 naming convention
Change your naming expression to explicitly prefix an underscore as in the following example:
"_"+SUBSTR(SYS(2015), 4)



I do not understand, why this code worked for 5 or more years, but today doesn't work in my VFP8 environment?

Should I report this problem to my colleagues? (I do not work there anymore, but I'm working on documentation)
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform