EQU instruction
- Assign single absolute values to symbols.
- Assign the values of previously defined symbols or expressions to new symbols, thus letting you use different mnemonics for different purposes.
- Compute expressions whose values are unknown at coding time or difficult to calculate. The value of the expressions is then assigned to a symbol.
- Assign length and type attributes to symbols, either implicitly or explicitly.
- Assign program type and assembler type values to symbols.
EQU also assigns attributes. It takes the value, relocation, and length attributes of the operand and assigns them to the name field symbol, and sets the integer and scale attributes to zero. The type attributes of an absolute expression is always 'U', and its length attribute is always 1 (unless the second and third operands are specified.
When there is a symbol naming a complex relocatable expression,
or a complex relocatable expression is eventually reduced
to
an absolute or simply relocatable expression, the first symbol is
used for attribute assignment.
- symbol
- Is one of the following:
- An ordinary symbol
- A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol
- value
- Represents a value and attributes that the assembler assigns to
the symbol in the name field. value can
have any value allowed for an assembly expression: absolute (including
negative), relocatable, or complexly relocatable. The assembler carries
this value as a signed 4 byte (32 bit) number; all 4 bytes are printed
in the program listings opposite the symbol. Implicitly, the relocation
and length attributes are also assigned for certain types of expressions.
Any symbols used in value need not be previously defined. However, if any symbol is not previously defined, the value of value is not assigned to the symbol in the name field until assembly time and therefore cannot be used during conditional assembly (see Using conditional assembly values).
If value is a complexly relocatable expression, the whole expression, rather than its value, is assigned to the symbol. During the evaluation of any expression that includes a complexly relocatable symbol, that symbol is replaced by its own defining expression. Consider the following example, in whichA1
andA2
are defined in one control section, andB1
andB2
in another:X EQU A1+B1 Y EQU X-A2-B2
The first EQU statement assigns a complexly relocatable expression
(A1+B1)
toX
. During the evaluation of the expression in the second EQU statement,X
is replaced by its defining relocatable expression(A1+B1)
. The assembler evaluates the resulting expression(A1+B1-A2-B2)
and assigns an absolute value toY
, because the relocatable terms in the expression are paired. The expression must not contain literals. - length attribute value
- Represents a value that the assembler assigns as a length attribute
value to the symbol in the name field. It is optional, but, if
specified, must be an absolute value in the range 0 to 65,535. This
value overrides the normal length attribute value implicitly assigned
from value. For example:
The symbol ACC has the same location value as A, but length attribute 1.A DS CL121 Define a print line buffer ACC Equ A,1 Define first character, length 1
All symbols appearing in length attribute value must have been previously defined, and all expressions in length attribute value must be evaluatable when the EQU statement is processed. For example, the second operand in the statements defining the symbol X cannot be evaluated when the last statement has been processed, because the value of the symbol X is unknown until the symbol A has been defined.Z DS XL(L'A) Z DS XL(A) Y DS XL7 Y DS XL7 X EQU Z,*-Z X EQU Z,*-Z A DS XL5 A EQU 5
If length attribute value is omitted, the assembler assigns a length attribute value to the symbol in the name field according to the length attribute value of the leftmost (or only) term of value, as follows:- If the leftmost term of value is a location counter reference (*), a self-defining term, or a symbol length attribute value reference, the length attribute is 1. This also applies if the leftmost term is a symbol that is equated to any of these values.
- If the leftmost term of value is a symbol that is used in the name field of a DC or DS instruction, the length attribute value is equal to the implicit or explicit length of the first (or only) constant specified in the DC or DS operand field.
- If the leftmost term is a symbol that is used in the name field of a machine instruction, the length attribute value is equal to the length of the assembled instruction.
- Symbols that name assembler instructions, except the DC, DS, CCW, CCW0, and CCW1 instructions, have a length attribute value of 1. Symbols that name a CCW, CCW0, or CCW1 instruction have a length attribute value of 8.
- The length attribute value described in cases 2, 3, and 4 above is the assembly-time value of the attribute.
For more information about the length attribute value, see Symbol length attribute reference.
For example:X DS CL80 X has length attribute 80 Y EQU X,40 Y has length attribute 40
- type attribute value
- Represents a value that the assembler assigns as a type attribute
value to the symbol in the name field. It is optional, but, if
specified, it must be an absolute value in the range 0 to 255.
All symbols appearing in type attribute value must have been previously defined, and all expressions in type attribute value must be evaluatable when the EQU statement is processed.
If type attribute value is omitted, the assembler assigns a type attribute value of U to the symbol, which means the symbol in the name field has an undefined (or unknown or unassigned) type attribute. See the general discussion about data attributes in Data attributes, and Type attribute (T').
For example:A DS D A has type attribute D B EQU A,,C'X' B has type attribute X
- program type value
- Represents
a value (any absolute expression) that the assembler assigns as a program
type value to the symbol in the name field. It
is optional. It can be specified as a decimal, character, hex, or
binary self-defining term and is stored as a 4 byte (32 bit) number;
all 4 bytes are printed in the program listings opposite the symbol.
The value is not used in any way by the assembler, and can be queried
by using the SYSATTRP built-in function.
All symbols appearing in program type value must have been previously defined, and all expressions in program type value must be evaluatable when the EQU statement is processed.
If program type value is omitted, the assembler assigns a null to the program type, and querying the value using the SYSATTRP built-in function returns a null value.
- assembler type value
- Represents
2 to 4 characters that the assembler assigns as an assembler type
value to the symbol in the name field.
It is optional. It is stored as a 4 byte string; all 4 bytes are
printed in the program listings opposite the symbol. The value is
used by the assembler when type-checking has been activated, and can
be queried by using the SYSATTRA built-in function. Valid values for this operand are:
AR Register - Access CR Register - Control CR32 Register - Control 32 bit CR64 Register - Control 64 bit FPR Register - Floating-Point GR Register - General GR32 Register - General 32 bit GR64 Register - General 64 bit VR Register - Vector
If assembler type value is omitted, the assembler assigns a null value to the assembler type, and querying the value using the SYSATTRA built-in function returns a null value.
The EQU instruction can be used anywhere in a source module after the ICTL instruction. Note, however, that the EQU instruction initiates an unnamed control section (private code) if it is specified before the first control section.