Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

EQUATE

Description

EQUATE is used to declare a symbol equivalent to a literal, variable or simple expression. It takes the general form:

EQU{ATE} symbol TO expression

where:

  • symbol is the name of the symbol to use;.can be any name that would be valid for a variable, and
  • expression can be a literal, a variable or a simple expression.

Note:

Sensible use of EQUATE symbols can make a program easier to maintain, read, and even more efficient.

Efficiency can be enhanced because the address of an EQUATEd value is computed during compilation and is substituted for each occurrence of the symbol name. Unlike the address of a variable, which must be computed for each access during run time, the address of a symbol is always known. This significantly reduces the processing overhead involved in accessing a particular value.

The snippet of code below illustrates how to enhance readability by referring to say, QTY rather than INV_LINE(4). Simply "EQUATE QTY TO INV_LINE(4)" at an early stage in the program. This can also help with maintenance of the program, particularly in situations where record layouts might change. 

For example, if the quantity field moves to INV_LINE(6), you only have to change one line in the  program. 

 COMMON FLAG
 EQUATE NO_CHARGE TO FLAG
 EQUATE CR TO CHAR (13), TRUE TO 1, FALSE TO 0
 EQUATE PRICE TO INV_LINE(7), TAX TO 0.175
 EQUATE DASHES TO "-------"
 IF NO_CHARGE = TRUE THEN PRICE = 0
 CRT "Tax =":PRICE * TAX:CR:DASHES


Go back to JBASE BASIC.

Was this article helpful?