A function invocation runs an EGL-generated
function or a system function. When the invoked function ends, processing
continues either with the statement that follows the invocation or (in complex
cases) with the next process required in an expression or in a list of arguments.

- qualifier
- One of the following symbols:
- The name of the library in which the function resides; or
- The name of the package in which the function resides, optionally followed
by a period and the name of the library in which the function resides.
- this (identifies a function in the current program)
For details on the circumstances in which the qualifier is unnecessary,
see References to parts.
- function name
- Name of the invoked function.
- argument
- One of the following:
- Literal
- Constant
- Variable
- A more complex numeric, text, or datetime expression, potentially including
a function invocation or substring; however, the access modifier for a non-reference
parameter must be IN
You can pass a reference variable or an expression that evaluates
to a reference, as noted in Reference variables and NIL in EGL.
The
effect on a non-reference variable that is passed as an argument to an EGL-generated
function depends on whether the corresponding parameter is modified with IN,
OUT, or INOUT. For details, see Function parameters.
If the invoked function returns a value, you can use the invocation in
these ways:
- As a complete EGL statement (in which case the function does not return
a value and is followed by a semicolon).
- As the source value in an assignment statement.
- As an operand in an expression.
- As an argument in the invocation of a function
A function invoked as in a function invocation can cause the side effect
of a variable changing values when the same variable is used in the function
or even in the function invocation itself. Consider this example, which assumes
that the function Sum is returning the sum of three arguments and that the
function Increment is adding one to a passed argument:
b INT = 1;
x INT = Sum( Increment(b), b, Increment(b) );
If the argument to Increment is related to a parameter
modified with INOUT, the effect of the preceding statements is as follows:
- b = 1
- The first (leftmost) invocation of Increment revises the value of b, which
equals 2 on the return from Increment
- The second argument in the invocation of Sum is 2
- The second (rightmost) invocation of Increment revises the value of b,
which equals 3 on the return from Increment
- After Sum runs, x receives the value 7 because the logic in that function
used the values 2, 2, and 3
If the second argument in the invocation of Sum is related to
a parameter modified with INOUT, evaluation of that argument occurs after
both invocations of Increment. The effect of the preceding code is as follows:
- b = 1
- The first (leftmost) invocation of Increment revises the value of b, which
equals 2 on the return from Increment
- The second (rightmost) invocation of Increment revises the value of b,
which equals 3 on the return from Increment
- The logic in Sum begins to run, and only then is the memory associated
with the second argument referenced; the value in that memory is equal to
3
- After Sum runs, x receives the value 8 because the logic in that function
used the values 2, 3, and 3
The general rule is that side effects can be identified by reference
to the usual order of evaluation of expressions, which is left to right but
can be overridden by parentheses. The use of INOUT is a further complication,
as shown.
When the access modifier of a parameter is IN or OUT, the compatibility
rules are as described in Assignment compatibility. When the access
modifier of a parameter is INOUT or when the parameter is in the onPageLoad
function of a pageHandler, the compatibility rules are as described in Reference
compatibility.
Other rules also apply:
- literals
- If the access modifier is IN or INOUT, you can code a literal as the argument.
The EGL-generated code creates a temporary variable of the parameter type,
initializes that variable with the value, and passes the variable to the function.
- fixed record
- If the argument is a fixed record, the parameter must be a fixed record.
The
following rules apply to fixed records that are not of type basicRecord:
- The type of the argument and parameter must be identical
- The access modifier must be of type INOUT
In relation to fixed records that are of type basicRecord, the
type of the argument and parameter can vary:
- If the access modifier is of type IN, the size of the argument must be
greater than or equal to the size of the parameter.
- If the access modifier is of type OUT or INOUT, the size of the argument
must be less than or equal to the size of the parameter.