Assignment Expressions
The assignment expression used in the ASSIGN directive consists of the following parts:
Left Operand |
The name of a variable or built-in variable that receives the value specified by the right operand. |
Operator |
An assignment operator used to assign a value to the variable specified by the left operand. It may be one of the following: = assigns the value of the right operand to the variable specified by the left operand += adds the numeric value of the right operand to the numeric value of the variable specified by the left operand -= subtracts the numeric value of the right operand from the numeric value of the variable specified by the left operand |
Right Operand |
The value that is assigned to the variable specified by the left operand. The value can be specified in one of two ways: 1. A numeric or alphanumeric literal value. If you enter an alphanumeric literal value you must surround it with quote marks. The quote marks do not become part of the value that is assigned. If you need to embed quote marks in the value, you double-up the embedded quote marks. 2. The name of a variable or built-in variable that supplies the value for the assignment. To specify a variable, precede the variable name with an ampersand (&) – for example &VARIABLE1. To specify a built-in variable, enter the name, including the asterisk, as shown on the tab – do not precede a built-in variable name with ampersand. To specify an indexed variable, specify a variable or numeric literal that specifies the index value in parentheses immediately following the variable name – for example &VARIABLE1(&INDEX1). |
Examples
This expression assigns the numeric value 3 to the variable named MYNUMBER:
&MYNUMBER = 3This expression adds 1 to the numeric value of the variable named MYNUMBER:
&MYNUMBER += 1This expression adds the numeric value of the variable named OTHERNUMBER to the numeric value of the variable named MYNUMBER:
&MYNUMBER += &OTHERNUMBERThis expression assigns the alphanumeric value ABC to the variable named MYSTRING:
&MYSTRING = 'ABC'
These three assignment expressions populate the first three instances of the MYLIST variable list with the first three letters of the alphabet:
&MYLIST(1) = 'A'
&MYLIST(2) = 'B'
&MYLIST(3) = 'C'
This expression assigns the value of the third instance of the MYLIST variable list to the MYLETTER variable:
&MYLETTER = &MYLIST(3)This expression is similar but the MYINDEX variable specifies which instance of the MYLIST variable list to use:
&MYLETTER = &MYLIST(&MYINDEX)This expression assigns trading partner identifier ATLAS to the *TRADINGPARTNER built-in variable:
*TRADINGPARTNER = 'ATLAS'
This expression assigns the identifier of the FTP Inbound Configuration linked to the current trading partner to the variable MYFTPCONFIG:
&MYFTPCONFIG = *TRADINGPARTNER.FTPIN