Reference compatibility in EGL

Reference-compatibility rules apply to reference and non-reference variables, as described in the next sections.

For reference variables

In relation to reference variables, the following statements apply:
  • In an assignment statement, you can assign a reference variable only to a reference variable that is based on the same part
  • In a function invocation, you can pass a reference variable only to a parameter that is based on the same part
  • You can return a reference variable from a function, but the return field (which may be a value in another function invocation) must be based on the same part

A part that is defined in one EGL package is not the same as a part defined in another package, even if the part names are identical.

For an overview of reference variables, see Reference variables and NIL in EGL.

For non-reference variables

A set of reference-compatibility rules are in effect when EGL transfers a non-reference value between an argument and the related parameter, but only in the following situation:
  • The parameter in the receiving function has the modifier INOUT; or
  • The parameter is in the onPageLoad function of a PageHandler.

In relation to a fixed record or structure field, the length of the argument must be greater than or equal to the length of the parameter. This rule prevents the receiving code from accessing memory that is not valid.

Also, when the argument is referring to a primitive type or an array of DataItems, the following statements apply:
  • The primitive characteristics (if any) must be identical. For example, an argument of type CHAR(6) is not compatible with a parameter of type CHAR(7). When you pass literals, however, EGL truncates and pads values, as described in Assignment compatibility in EGL.
  • An argument that is nullable is compatible with a nullable or non-nullable parameter. An argument that is not nullable is compatible only with a non-nullable parameter.

Related concepts
PageHandler

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.