How to pass structured records as individual fields
You can set an EGL property so that a structured record is sent to a called program and received there in any of multiple ways: as a structured record, or as if the record were a set of individual fields that correspond to the leaf elements in that record, or as a sequential set of records and fields. The usage is especially appropriate when EGL-coded logic is interacting with EGL-coded logic that was migrated from code written in the Natural programming language.
The behavior relies on your setting the callingConvention property on both the call statement and the called program. The property value is either CallingConventionKind.Expanded or the short form, Expanded.
Record MyCompletePart type BasicRecord
10 myInt INT;
10 myInt02 INT;
10 myChars CHAR(5);
end
Record MySubPart type BasicRecord
10 myInt02 INT;
10 myChars CHAR(5);
endmyCompleteRecord MyCompletePart;
mySubRecord MySubPart;
myIntVar INT;
myInt02Var INT;
myCharsVar CHAR(5);
call MyProgram( myCompleteRecord ) { callingConvention=Expanded };
call MyProgram( myIntVar, mySubRecord ) { callingConvention=Expanded };
call MyProgram( myIntVar, myInt02Var, myCharsVar) { callingConvention=Expanded }; MyProgram are valid
and equivalent:Program MyProgram type BasicProgram ( myCompleteRecord MyCompletePart )
{ callingConvention=Expanded }
end
Program MyProgram type BasicProgram ( myIntVar INT, mySubRecord MySubPart )
{ callingConvention=Expanded }
end
Program MyProgram type BasicProgram ( myIntVar INT, myInt02Var INT, myCharsVar CHAR(5))
{ callingConvention=Expanded }
end
Any of the three call-statement argument lists is valid for any of the three called-program parameter lists.
Record X type BasicRecord
10 myChar CHAR(4)[2];
20 mySubChar01 char(2);
20 mySubChar02 char(2);
end
When you use Expanded, each leaf (mySubChar01 or mySubChar02)
is passed in a contiguous block of memory even though the fields in
that leaf are not stored contiguously. The data must be copied, and
the extra processing takes time. For details on how multidimensional
structure field arrays are stored, see “Arrays.”
- A leaf is an array.
- A parent or other ancestor of that array is itself an array that has more than one child.
If you are passing a structure field array explicitly, see “How to pass structure field arrays.”