PRB: #DEFINE with Equal Sign Causes a Syntax Error

ID: Q99603

The information in this article applies to:

SYMPTOMS

In a compiled program, a constant defined with the #DEFINE clause causes a "Syntax Error" message when the constant is used in subsequent code snippets.

CAUSE

The #DEFINE clause was incorrectly coded. An equal sign in the #DEFINE clause results in a "Syntax Error" message when the constant is used in subsequent code. For example, the following code will cause the error:

   #DEFINE salestax = .10
   sale = 123.45
   * The following line produces a syntax error.
   invtotal = sale * (1 + salestax)

RESOLUTION

Remove the equal sign (=) from the #DEFINE clause. Correct syntax for the #DEFINE clause is as follows:

   #DEFINE salestax .10

NOTE: #DEFINE is a preprocessor directive, not a screen generator directive. Therefore, it is not listed in the generator directive section of the "Developer's Guide" for version 2.5.

REFERENCES

"Language Reference," version 2.5, Chapter 3

Additional reference words: FoxDos FoxWin 2.50 define # 2.50a KBCategory: kbprg kbprb KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995