14.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 RDMLX object allows RDMLX Enhanced Expressions. Enhanced expressions add support for:

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.