Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new window

For information on migrating to InterSystems IRISOpens in a new window, see the InterSystems IRIS Migration Guide and Migrating to InterSystems IRIS, both available on the WRC Distributions pageOpens in a new window (login required).


Replaces a symbol with a value at compile time.


EQUATE symbol TO expression [, ...]
EQU symbol TO expression [, ...]

EQUATE symbol LITERALLY str [, ...]
EQU symbol LIT str [, ...]


symbol The placeholder symbol to be replaced, specified as one or more characters. The first character must be a letter or percent sign (%). Subsequent characters may be letters, numbers, percent sign (%), underscore (_), or dollar sign ($). The final character may not be an underscore.
expression The value used to replace all instances of symbol at compile time. Any valid Caché MVBasic expression.
str The string used to replace all instances of symbol at compile time. Specified as a quoted string.


EQUATE replaces every instance of symbol in the program with the specified expression or variable. EQUATE performs this substitution at compile time. Therefore, the value replaced is not affected by program execution. EQUATE can be used to replace executable statements in the program. Variables perform substitutions during program execution and cannot be used to modify the program's executable code.

You can specify multiple symbol TO expression and symbol LITERALLY str clauses in any combination as a comma-separated list. You can insert line breaks as needed following a comma separator.

EQUATE treats a sequence of words separated by –> as a single entity. For example:

EQUATE vin TO car(7)
AutoCheck->vin = vin
Copy code to clipboard

returns AutoCheck->vin = car(7).

The EQUATE keyword can be abbreviated as EQU. The LITERALLY keyword can be abbreviated as LIT.


The following example replaces at compile time every instance of the symbol addlength with the expression BYTELEN(x)+20 or LEN(x)+10, depending on the setting of the Unicode variable:

IF Unicode=1
  THEN EQUATE addlength TO BYTELEN(x)+20
  ELSE EQUATE addlength TO LEN(x)+10 
Copy code to clipboard

The following example replaces at compile time every instance of the symbol letters with the contents of the variable alpha:

EQUATE letters LITERALLY "alpha"
  CASE lang=English
  CASE lang=Greek
Copy code to clipboard

See Also

FeedbackOpens in a new window