Performance considerations of static and dynamic calls

Because a statically called program is link-edited into the same program object as the calling program, a static call is faster than a dynamic call. A static call is the preferred method if your application does not require the services of the dynamic call.

Note: Static calls between programs compiled with the same or similar COBOL versions perform better than those compiled with mixed COBOL versions. For example, static calls between COBOL V6 programs are faster than static calls between COBOL V6 and V4 programs. In mixed cases such as COBOL V6 and V4 programs, dynamic calls perform better than static calls because of the extra processing needed to maintain backward compatibility.
For the purpose of this discussion, the following COBOL versions are considered similar:
  • COBOL V4.2 and prior releases
  • COBOL V5.1 and later releases
Statically called programs cannot be deleted using CANCEL, so static calls might take more main storage. If storage is a concern, think about using dynamic calls. Storage usage of calls depends on whether:
  • The subprogram is called only a few times. Regardless of whether it is called, a statically called program is loaded into storage; a dynamically called program is loaded only when it is called.
  • You subsequently delete the dynamically called subprogram with a CANCEL statement.

    You cannot delete a statically called program, but you can delete a dynamically called program. Using a dynamic call and then a CANCEL statement to delete the dynamically called program after it is no longer needed in the application (and not after each call to it) might require less storage than using a static call.