Article ID: 196647
Article Last Modified on 3/7/2005
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 5.0a
- Microsoft Visual FoxPro 6.0 Professional Edition
- Microsoft FoxPro 2.5b
- Microsoft FoxPro 2.5a
- Microsoft FoxPro 2.5b
- Microsoft FoxPro 2.6 Standard Edition
- Microsoft FoxPro 2.6a Standard Edition
- Microsoft FoxPro 2.6 for SCO/UNIX
- Microsoft Visual FoxPro 3.0b for Macintosh
- Microsoft FoxPro 2.5b for Macintosh
- Microsoft Visual FoxPro 2.5c for Macintosh
- Microsoft FoxPro 2.6a Professional Edition for Macintosh
- Microsoft FoxPro 2.0
- Microsoft FoxPro 2.5b for MS-DOS
- Microsoft FoxPro 2.5a
- Microsoft FoxPro 2.5b for MS-DOS
- Microsoft FoxPro 2.6 for MS-DOS
- Microsoft FoxPro 2.6a Standard Edition
This article was previously published under Q196647
SYMPTOMS
Programs that have been working properly using the SUBSTR() and SYS(2015) functions suddenly produce a syntax error.
CAUSE
The assignment of an illegal value, or memory variable containing an
illegal value, to a table, alias or array name.
RESOLUTION
The solution to the problem is to make sure that the result of the
SUBSTR()
and
SYS(2015) functions do in fact begin with a letter or an underscore as
required.
On operating systems that are limited to eight character file names, you
can use the following code:
x = "_" + SUBSTR(SYS(2015), 4)
STATUS
This behavior is by design.
MORE INFORMATION
Depending upon the character string length and logic you use to obtain it,
the syntax error may start occurring on computers with a system date of
November 18, 1998.
For example, for computer system dates between 11/17/1998 and 11/10/1999
the leading character of a value assigned to variable 'x' will be a numeric
digit:
x = SUBSTR(SYS(2015), 3, 10)
NOTE: Future date periods may also cause a similar problem.
Steps to Reproduce Behavior
Important: Remember to change your computer system clock to the correct
date and time after completing the following tests.
Set the computer system date to any date between November 18, 1998 and
November 10, 1999, using the Date/Time Properties in Windows Control Panel.
Note that the leading character of the value assigned to the memory
variable is a numeric digit.
Alias Names
In the specific case of November 18th, 1998 run the following code:
? DATE()
x=SYS(2015)
? x
y=SUBSTR(x,3,10)
? y
CREATE CURSOR (y) (field1 c(10))
Note that the leading character of the value assigned to the memory
variable 'y' is a numeric digit, depending upon the computer system date.
Observe that the command to create a cursor with that name produces a
syntax error.
Array Names
x=SUBSTR(SYS(2015), 3, 10)
DIMENSION &x(1,2)
Running the preceding code returns the following error message:
Command contains unrecognized phrase/keyword.
REFERENCES
For additional information about the ALIAS parameter of the USE command, the
SYS(3) or
SYS(2015) functions, please see the following article in the
Microsoft Knowledge Base:
97633 PRB: Alias Problems with Table Name Starting with Number
Microsoft FoxPro Help: search on: "USE command"; "ALIAS argument"; "SYS(3)
Legal File Name"; "SYS(2015) - Unique Procedure Name"
(c) Microsoft Corporation 1998. All Rights Reserved. Contributions by Perry
Newton, Microsoft Corporation.
Keywords: kbxbase kbdatabase kbxplatform kbprb KB196647