Previous Next

Expression
A combination of one or more terms and operators that evaluate to a single value of a specific data type.
Syntax 
 
[ unary-operator ] [ ( ] { term | term binary-operator term } [ ) ]
unary-operator
Any ABL unary operator that can precede the specified term, including the:
*
*
*
(
Begins a group of one or more terms and operators that are evaluated together before any terms or operators to the left of the ‘(’. If specified, the group must be terminated with a ‘)’.
term
Any one of the following ABL elements that represents or returns a value with a data type that is compatible with the expression data type, including:
*
*
*
*
*
*
*
*
*
*
An Expression (recursive)
Note that each term of the expression can itself be formed from an expression, resulting in multiple possible combinations of basic terms and operators, with or without grouping parentheses. Note that each of these elements, except for a more complex Expression, represents a basic term of the expression.
binary-operator
Any ABL binary operator that can separate two term elements, each of which must have a data type that is compatible with an expression that can result when applying the specified binary-operator to the specified term elements, including the:
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
)
Terminates a group of one or more terms and operators that are evaluated together before any terms or operators to the right of the ‘)’. If specified, the group must begin with a ‘(’.
For information on the precedence of operator evaluation, see Table 37.
Example 
The procedure, r-expression.p, evaluates an expression to identify the value of an element in an ABL single-dimensional array (iArray) that is specified using two-dimensional coordinates (iDim1 and iDim2):
 
DEFINE VARIABLE iDim1       AS INTEGER   NO-UNDO.
DEFINE VARIABLE iDim2       AS INTEGER   NO-UNDO.
DEFINE VARIABLE iDim1Extent AS INTEGER   NO-UNDO INITIAL 3.
DEFINE VARIABLE iDim2Extent AS INTEGER   NO-UNDO INITIAL 5.
DEFINE VARIABLE iArray      AS CHARACTER NO-UNDO EXTENT 15 
  INITIAL ["A","B","C","D","E",  /* iDim1 = 1 */
           "F","G","H","I","J",  /* iDim1 = 2 */
           "K","L","M","N","O"]. /* iDim1 = 3 */
 
DO iDim1 = 1 TO iDim1Extent:
  DO iDim2 = 1 TO iDim2Extent:
    MESSAGE "iArray[" iDim1 "," iDim2 "]" " = "
      iArray[ iDim2 + (iDim1 - 1) * iDim2Extent ] VIEW-AS ALERT-BOX.
  END.
END.
This procedure contains several expressions in the DO statements as well as in the MESSAGE statement. The expression that evaluates the index on the term, iArray, using a two-dimensional coordinate is shown in bold. This expression first evaluates the subtraction (-) operation in parentheses, then, in order by operator precedence, evaluates the multiplication (*) operation followed by the addition operation (+).
Notes 
*
 
Note that before the ABL Virtual Machine (AVM) applies the operators to an expression, it evaluates all the basic terms (variables, properties, methods, functions, etc.) of the expression individually from left to right.
*
*
An expression of the appropriate data type can appear as a variable option of any ABL statement that takes an expression, except where specified. Expressions commonly appear in the Assignment (=) statement, ASSIGN statement, and as arguments to INPUT parameters of procedures, functions, and methods (Parameter passing syntax). Expressions cannot appear where a variable syntax option accepts only a quoted string, a user-defined name (such as a procedure or variable name), or a compile-time constant. Other restrictions might also apply.
*
*
See also 
Assignment (=) statement, ASSIGN statement, CATCH statement, COPY-LOB statement, Data types, ERROR-STATUS system handle, Parameter passing syntax

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.