EQUATE (assign label)

Top  Previous  Next


|     label           |  

label EQUATE( | [ constant ]     | )

|   picture         |  

|   type             |  


Assigns a label to another label or constant.


The label of any statement preceding the EQUATE statement. This is used to declare an alternate statement label. This may not be the label of a PROCEDURE or ROUTINE statement.


A numeric or string constant. This is used to declare a shorthand label for a constant value. It also makes a constant easy to locate and change. This may be omitted only in an ITEMIZE structure. A constant expression may also be used (like 1+2, or BOR(1111b,0001b)).


A picture token. This is used to declare a shorthand label for a picture token. However, the screen and report formatter in the Clarion Editor will not recognize the equated label as a valid picture.


A data type. This is usually used to declare a single method of declaring a variable as one of several data types, depending upon compiler settings (like a C++ typedef for a simple data type).

The EQUATE directive assigns a label to another label or constant. It does not use any run-time memory. The label of an EQUATE directive cannot be the same as its parameter.

In the Clarion# language, local (procedure scope) equates are not supported, if they are also declared globally, or in another MEMBER module. Equates are not connected to the namespaces but only to the PROGRAM or MEMBER files. The current processing of the equates is as follows:


Equates in the PROGRAM module are global in scope and visible to all MEMBERs (independent of namespaces).


Equates in the MEMBER file are local only to this file.


If the project contains no PROGRAM file, the first MEMBER file becomes a "virtual PROGRAM" file, and all equates from this file are visible to all other MEMBERs.


Init     EQUATE(SetUpProg)       !Set alias label

Off       EQUATE(0)               !Off means zero

On       EQUATE(1)               !On means one

PI       EQUATE(3.1415927)       !The value of PI

EnterMsg  EQUATE('Press Ctrl-Enter to SAVE')

SocSecPic EQUATE(@P###-##-####P)  !Soc-sec number picture


See Also:

Reserved Words