basic.equate Statement/BASIC Program

basic.equate

Command basic.equate Statement/BASIC Program
Applicable release versions: AP, R83
Category BASIC Program (486)
Description a compiler directive which declares a constant at compile time or a synonym of another variable or array element.

Note: "expressions" in an "equ" are limited to constant expressions, variables, and character strings.

"equate" can also be used to assign meaningful variable names to array elements. Once "equate" has been used to assign a value to a symbol, the variable cannot be used as a variable and cannot be reassigned a value. Equate definitions must be placed before any usage of the equated symbols. Failure to do so may generate compile-time errors.
Syntax equ{ate} symbol to char(constant) {,variable to expression...}
equ{ate} symbol to variable
Options
Example
equ form.feed to char(12)
equ ring.bell to char(7)
equ attribute.mark to char(254)
...
read array from file,id...
amcmax = dcount(array,attribute.mark)
....
if ctr=pagemax then
  print form.feed
  crt ring.bell:
end
...

This example shows how "equ" can make more descriptive cryptic 
references like "char()".

equ customer.name.attribute to 1
equ title to "REF"
equ invoice.number to customer.item(13)
...
print @(15,0):title
print customer.item(customer.name.attribute)
...
read invoice from invoice.file,invoice.number then ...

"equ" designates a synonym for the numeric constant 1, the string 
"REF" and the 13th variable in the dimensioned array 
"customer.item".

equ x to a
a = 3
print x

The symbol "x" is a synonym for the variable "a" and can be 
used interchangeably.
Purpose
Related basic.equ
basic.statements
basic.assignment