Expressions of 4GL

A 4GL expression is a sequence of operands, operators, and parentheses that INFORMIX-4GL can evaluate as a single value.

4GLREF00000201.gif

Statements, functions, form specifications, operators, and expressions can have expressions as arguments, components, or operands. The context where an expression appears, as well as its syntax, determines the data type of its returned value. It is convenient to classify 4GL expressions into the following five categories, based on the data type of what they return:

Boolean a value that is either TRUE or FALSE or NULL

Integer a whole-number value of data type INT or SMALLINT

Number a value of any number data type

Character a character string of data type CHAR or VARCHAR

Time a value of data type DATE, DATETIME, or INTERVAL

If the term 4GL expression is not qualified as one of these five specific data types, then the expression can be any of these data types.

As the diagram suggests, 4GL Boolean expressions are special cases of integer expressions, and integer expressions are a logical subset of number expressions. You can substitute a 4GL Boolean or integer expression where a number expression is valid (unless this results in an attempt to divide by zero).

Named Values as Operands

A 4GL expression can include the name of a variable of any simple data type or the constants TRUE or FALSE. The variable can also be a simple member of a record, or a simple element of an array:

4GLREF00000202.gif

Function Calls as Operands

A 4GL expression can include calls to functions that return exactly one value:

4GLREF00000203.gif

function is the name of a function. The parentheses are required, regardless of whether the function takes any arguments.

The function can be a programmer-defined or built-in function, provided that it returns a single value of a data type that is valid in the expression. (Function calls as arguments can return multiple values.)