The statement CALL data-name enables the name of the called subprogram to be specified dynamically at run time and implies dynamic loading. In a CALL statement, an ON EXCEPTION clause specifies the action to take if the subprogram cannot be loaded. Linked programs are not considered able to give an exception, unlike dynamically loaded programs and so the ON EXCEPTION clause implies dynamic loading.
Only the statement CALL literal with no ON EXCEPTION clause, when used in a linked program, does not imply dynamic loading. Instead, a direct reference is used; this is superior to dynamic loading in performance terms.
If a program is invoked in a way that implies dynamic loading, then it is invoked by the COBOL run-time system dynamic loader. The dynamic loader first searches the list of loaded programs, subprograms and support routines before trying to load the program dynamically from disk. If the program is already loaded, by virtue of being linked or previously dynamically loaded without any intervening CANCEL, then the dynamic loader simply passes control to it. If the program is not already loaded, then the dynamic loader searches for a suitable dynamically loadable file. The search order is affected by the environment variable COBPATH. Callable shared objects are also affected by the LIBPATH, SHLIB_PATH or LD_LIBRARY_PATH environment variables.