In the following example, several variable values are passed to and from a calling program and a sub-program. The numerical values consist of a simple numerical variable and three elements of a numerical array. Also included is an object and an object array with four elements, as well as a string variable with a character length of ten and a string array with fifteen elements and a character length of ten.
$$
$$ Declarations
$$
ENTITY/LN1,PT(4)
NUMBER/NUM(5)
STRING/ABC(10),XYZ(15,10)
.
.
.
CALL/'SUB1',VAL1,NUM(1..3),LN1,PT,ABC,XYZ
.
.
.
HALT
The subprogram SUB1:
PROC/VAL1,NUM,LN1,PT,ABC,XYZ
ENTITY/LN1,PT(4)
NUMBER/NUM(3)
STRING/ABC,XYZ(15)
.
.
.
RETURN
VAL1 is a simple numerical variable and therefore not declared. NUM was declared as an array of three instead of five because a subrange operator was used to pass only three members.
The object variables LN1 and PT were declared the same as they were in the calling program.
The string variables ABC and XYZ were declared with a length of ten in the calling program, however, only the number of elements was declared in the sub-program.