13 1 4 Specifying Conditions and Expressions

LANSA Technical

13.1.4 Specifying Conditions and Expressions

Many of the RDML commands in the LANSA system require that a condition or an expression be specified.

Generally a condition is a statement that can be evaluated to produce a "true" or "false" answer.

Refer to the online Technical Reference for details of this topic and of Arithmetic and Expression Operators.

For instance "#A *LT 10" is a condition. Either field #A is less than 10 (true) or it isn't (false). A condition may contain the following operators for RDML commands:

     *GT,>

     *LT,<

     *EQ,=

     *NE,^=

     *GE,>=

     *LE,<=

We recommend the use of the first operator for cross-platform use. That is, "#A *LT 10", not "#A < 10"

An expression is a statement that can be evaluated to produce either a numeric or an alphanumeric result. For instance the expression "(#X + 10) / 2" produces a numeric result which is the sum of #X and 10 divided by 2. Note that in this case the result has no "true" or "false" meaning. The result is just a number.

Often an expression is contained within a condition. Consider the condition:

 

                #A  <  ((#B + 10.62) / 3.14)

               |       |                  | |

               |       |                  | |

               |        --- expression ---  |

               |                            |

                --------- condition---------

 

The components of a condition or an expression can be:

  • An alphanumeric literal such as 'NSW', NSW, 'Balmain' or BALMAIN.
  • A numeric literal such as 1, 14.23, -1.141217.
  • Another field name such as #CUSTNO, #INVNUM, etc.
  • A system variable name such as *BLANKS, *ZERO, *DATE or any other system variable defined at your installation.
  • A process parameter such as *UP01, *UP02, etc.

A full RDMLX object allows RDMLX Enhanced Expressions. Enhanced expressions add support for:

  • Methods, intrinsic functions, and properties
  • Additional operators *Not, *IS, *ISNOT, *IsEqual, *IsOfType, *AS, *ANDIF and *ORIF

Note that alphanumeric literals do NOT have to be in quotes when used in a condition or an expression. Quotes are only required when the alphanumeric literal contains lowercase characters. If no quotes are used the alpha literal is converted to uppercase. Thus BALMAIN = balmain = Balmain = balMAIN, however, Balmain does not equal 'Balmain'.

Note also that field names must be preceded by a # (hash) symbol when used in conditions or expressions. This allows LANSA to differentiate between fields and alphanumeric literals. For instance the expression CNTRY = AUST does not indicate which of the components is the field and which is the alphanumeric literal. The correct format is #CNTRY = AUST.

Note also that fields allowing SQL Null may behave differently in conditions and expressions at execution time when they are SQL Null. Refer to Assignment, Conditions, and Expressions with Fields allowing SQL Null for details.

Ý 13.1 RDML Command Parameters