Assignments
An EGL assignment copies data from one area of memory to another and can copy the result of a numeric or text expression into a source field.
The behavior of an EGL assignment statement is different from that of a move statement; for more information, see move
For information about assignment rules, see Assignment compatibility in EGL.
Syntax

- target
- A variable of some sort: a program variable, a record variable, a field within a record, or system variable. You can specify a substring on the left side of an assignment statement if the target substring has a fixed length. The substring area is padded with blanks if the source is shorter than the substring, and the source text is truncated if longer than the substring. For syntax details, see Substrings.
- source
- Another variable, or a character or numeric literal.
Examples
Each of the following EGL statements is an assignment:
z = a + b + c;
myDate = vgVar.currentShortGregorianDate;
myUser = sysVar.userID;
myRecord01 = myRecord02;
myRecord02 = "USER";
Complex assignment operators
The equal sign (=) is a simple
assignment operator. Complex assignment
operators in EGL perform one operation, then assign the result of
that operation to the target operand. For example, the expression
"a += b" is equivalent to the following expression:
a = a + bThe following table shows the complex assignment operators available in EGL.
| Operator | Meaning |
|---|---|
| a += b | a = a + b |
| a –= b | a = a – b |
| a *= b | a = a * b |
| a /= b | a = a / b |
| a **= b | a = a ** b |
| a %= b | a = a % b |
| a |= b | a = a | b |
| a &= b | a = a & b |
| a xor= b | a = a xor b |
| a ::= b | a = a :: b |
| a?:= b | a = a ?: b |