Conditioning Expressions

LANSA Composer

Conditioning Expressions

The conditioning expression used in WHILE, UNTIL, CASE, IF and ELSEIF directives consists of the following parts:

Left Operand

The name of a variable or Built-in variable whose value is tested by the expression.

To specify a variable, precede the variable name with an ampersand (&) – for example &VARIABLE1. 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).

To specify a built-in variable, enter the name, including the asterisk, as shown on the Built-ins tab – do not precede a built-in variable name with ampersand.

Operator

A comparison operator used to compare the value of the left and right operands. It may be one of the following:

*EQ  =  Equal

*NE  <>  Not equal

*GT  >  Greater than

*GE  >=  Greater than or equal

*LT  <  Less than

*LE  <=  Less than or equal

Right Operand

The value that is compared 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 used for the comparison. If you need to embed quote marks in the value, you should double-up the embedded quote marks.

2. The name of a variable or built-in variable that supplies the value used for the comparison. 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 Built-ins 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 is true when the value of the variable named MYNUMBER is greater than 3:

&MYNUMBER *GT 3

This expression is true when the value of the variable named MYSTRING: is ABC:

&MYSTRING *EQ 'ABC'

This expression is true when the value of the second instance of the MYLIST variable list is B:

&MYLIST(2) = 'B'

This expression is true when the value of the MYLETTER variable is not equal to the value of the third instance of the MYLIST variable list:

&MYLETTER <> &MYLIST(3)

This expression is similar but the MYINDEX variable specifies which instance of the MYLIST variable list to use for the comparison:

&MYLETTER <> &MYLIST(&MYINDEX)

This expression is true when the value of the *TRADINGPARTNER built-in variable is ATLAS:

*TRADINGPARTNER = 'ATLAS'