User Tools

Site Tools


equate_assign_label_.htm
Navigation:  Language Reference > 2 - Program Source Code Format > Compiler Directives >====== EQUATE (assign label) ====== Previous pageReturn to chapter overviewNext page
    label          
label EQUATE( [ constant ]     )
  picture        
  type            

blk2blue.jpg

EQUATE Assigns a label to another label or constant.
label 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.
constant 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)).
picture 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.
type 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.

NewCNet.jpg

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:

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

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

3.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.

Example:

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

ITEMIZE

equate_assign_label_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1