ILE COBOL Programmer's Guide

Using Static Procedure Calls and Dynamic Program Calls

The following discussion applies to separately compiled subprograms only, not to nested programs. For information about calls within a nested program structure, see Calling Nested Programs.

The binding process differs, depending on whether your ILE COBOL program uses static procedure calls or dynamic program calls. When a static procedure call is used to call an ILE COBOL subprogram, it must first be compiled into a module object and then bound, by copy or by reference, into the same program object as the calling ILE COBOL program. When a dynamic program call is used to call an ILE COBOL subprogram, the ILE COBOL subprogram must be compiled and bound as a separate program object. For more information on the binding process, see the ILE Concepts book.

Static procedure calls offer performance advantages over dynamic program calls.

When an ILE COBOL subprogram is called using a static procedure call, it is already activated, since it is bound in the same program object as the calling program, and it is performed immediately upon receiving control from the calling ILE COBOL program.

When an ILE COBOL subprogram is called using a dynamic program call, many other tasks may need to be performed before the called ILE COBOL program is actually performed. These tasks include the following:

Thus, a dynamic program call is slower than a static procedure call due to the cost of activation the first time it is performed in an activation group.

Dynamic program calls and static procedure calls also differ in the number of operands that can be passed from the calling ILE COBOL program to the called ILE COBOL program. You can pass up to 255 operands using a dynamic program call. With a static procedure call, you can pass up to 400 operands.

Arguments that are designated as OMITTED or as having associated operational descriptors can only be passed using a static procedure call. These arguments cannot be passed using dynamic program calls.

Performing Static Procedure Calls using CALL literal

You can perform a static procedure call by using the CALL literal statement (where literal is the name of a subprogram). There are three ways to specify that the call is to be a static procedure call. They are listed in order of precedence:

Note:
The IN LIBRARY phrase is incompatible with a static procedure call.
  1. Use the LINKAGE phrase of the CALL statement.
  2. Use the LINKAGE TYPE clause of the SPECIAL-NAMES paragraph.
  3. Use the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands, or the associated PROCESS statement option.

Performing Dynamic Program Calls using CALL literal

You can perform a dynamic program call by using the CALL literal statement (where literal is the name of a subprogram) or the CALL identifier statement. Refer to Using CALL identifier for more information about CALL identifier. There are three ways, using CALL literal, to specify that the call is to be a dynamic program call. They are listed in order of precedence:

  1. Use the LINKAGE phrase of the CALL statement.
  2. Use the LINKAGE TYPE clause of the SPECIAL-NAMES paragraph.
  3. Use the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands, or the associated PROCESS statement option.

A dynamic program call activates the subprogram at run time. Use a dynamic call statement when:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]