Entry invocation or entry value

There are times when it might not be apparent whether an entry value itself will be used or the value returned by the entry invocation will be used. This topic helps you understand which happens when.

The following table explains the conditions under which an entry reference is invoked or not invoked.

If the entry reference . . . It is . . .
Is a built-in function Invoked
Has an argument list, even if null Invoked
Is referenced in a CALL statement Invoked
Has no argument list and is not referenced in a CALL statement Not Invoked

Example 1

In this example, A is invoked, B(C) passes C as an entry value, and D( C() ) invokes C.

  dcl ( A, B, C returns (fixed bin), D) entry;

  call A;                       /* A is invoked                        */
  call B(C);                    /* C is passed as an entry value       */
  call D( C() );                /* C is invoked                        */

Example 2

In this example, the first assignment is not valid because it represents an attempt to assign an entry constant to an integer. The second assignment is valid.

  dcl A fixed bin,
      B entry returns ( fixed bin );

  A = B;
  A = B();