The following examples illustrate the invocation of functions that are internal to and external to the invoking block.
In the following example, the assignment statement contains a reference to the Sprod function:
Mainp: procedure;
get list (A, B, C, Y);
1 X = Y**3+Sprod(A,B,C);
2 Sprod: procedure (U,V,W)
returns (bin float(21));
dcl (U,V,W) bin float(53);
if U > V + W then
3 return (0);
else
3 return (U*V*W);
end Sprod;
Mainp: procedure;
dcl Tprod entry (bin float(53),
bin float(53),
bin float(53),
label) external
returns (bin float(21));
get list (A,B,C,Y);
1 X = Y**3+Tprod(A,B,C,Lab1);
Lab1: call Errt;
end Mainp;
1 Tprod: procedure (U,V,W,Z) returns (bin float(21)); dcl (U,V,W) bin float(53); declare Z label; 2 if U > V + W then go to Z; 3 else return (U*V*W); end Tprod;
Notice that Tprod is an external procedure. It has an explicit entry declaration in Mainp, which contains RETURNS.