If you specify the modifier inOut or out (as is possible for a parameter that is not based on a reference type), any changes that are made to the parameter value are available in the invoking function. Those modifiers are described later and in the section Implications of inOut and the related modifiers. For details on how reference types are handled, see Reference variables and NIL in EGL.
A parameter can be passed as an argument to another function. A parameter is not otherwise visible to functions invoked by the function containing the parameter.
A parameter that ends with brackets ([ ]) is a dynamic array, and the other specifications declare aspects of each element of that array.
Library functions do not receive record state.
The inOut modifier is necessary if the parameter is a field and you specify the modifier field, which indicates that the parameter has testable, form-field attributes such as blanks or numeric.
When you specify a limited-length string as a function parameter whose modifier is out, the length limit must be the same in argument and parameter.
If the inOut modifier is in effect, the related argument must be reference-compatible with the parameter, as described in Reference Compatibility in EGL.
You cannot use the in modifier for a field that has the modifier field. Also, you cannot specify the in modifier for a record that is used to access a file or database either in the current function or in a function invoked by the current function.
If the argument is a literal or constant, the argument is treated as if the modifier in were in effect.
You cannot use the out modifier for a parameter that has the modifier field. Also, you cannot specify the out modifier for a record that is used to access a file or database either in the current function or in a function invoked by the current function.
When you specify a limited-length string as a function parameter whose modifier is out, the length limit must be the same in argument and parameter.
In a service, a parameter cannot be of type ANY, BLOB, or CLOB.
If you wish the parameter to accept a number of any primitive type and length, specify NUMBER as the loose type. In this case, the number passed to the parameter must not have any decimal places.
If you wish the parameter to accept a string of a particular primitive type but any length, specify CHAR, DBCHAR, MBCHAR, HEX, or UNICODE as the loose type and make sure that the argument is of the corresponding primitive type.
The definition of the argument determines what occurs when a statement in the function operates on a parameter of a loose type.
Loose types are not available in functions that are declared in libraries or services.
For details on primitive types, see Primitive types.
The field modifier is available only if you specify the inOut modifier or accept the inOut modifier by default.
The field modifier is not available for function parameters in a service or in a library of type nativeLibrary.
If the function is in a service part or in an interface part of type basicInterface, only the second case applies because the build descriptor option itemsNullable is always set to no.
program inoutpgm a int; b int; c int; function main() a = 1; b = 1; c = 1; func1(a,b,c); // a = 1 // b = 3 // c = 3 end function func1(x int in, y int out, z int inout) // a = 1 x = 1 // b = 1 y = 0 // c = 1 z = 1 x = 2; y = 2; z = 2; // a = 1 x = 2 // b = 1 y = 2 // c = 2 z = 2 func2(); func3(x, y, z); // a = 1 x = 2 // b = 1 y = 3 // c = 3 z = 3 end function func2() // a = 1 // b = 1 // c = 2 end function func3(q int in, r int out, s int inout) // a = 1 x = unresolved q = 2 // b = 1 y = unresolved r = 2 // c = 2 z = unresolved s = 2 q = 3; r = 3; s = 3; // a = 1 x = unresolved q = 3 // b = 1 y = unresolved r = 3 // c = 3 z = unresolved s = 3 end
Related concepts
Function part
Library part of type basicLibrary
Library part of type nativeLibrary
Parts
References to parts
References to variables in EGL
Typedef
Related reference
Basic record part in EGL source format
Data initialization
EGL source format
Function part in EGL source format
Indexed record part in EGL source format
INTERVAL
Logical expressions
MQ record part in EGL source format
Naming conventions
Primitive types
Reference compatibility in EGL
Reference variables and NIL in EGL
Relative record part in EGL source format
Serial record part in EGL source format
SQL record part in EGL source format
TIMESTAMP