Calling Entry Points in Subprograms

You can execute called programs from a specified entry point, rather than the start of the Procedure Division. You define entry points in programs that you call, using the ENTRY statement. You can then execute a called program starting at an entry point by specifying the entry point in the CALL statement.

When a program containing entry points is loaded into the run-time system, all the entry points in the program are identified to the run-time system and are available to be called by any program that is loaded later.

However, the run-time system cannot locate entry points in programs that are not already loaded. For example, when you execute a CALL statement like this:

CALL "abc" USING ...

the run-time system first looks for a program or entry point called abc in all of the programs that have already been loaded. If the run-time system does not find one, it then looks for a file on disk called abc.ext where .ext is an executable file format. If abc is the name of an entry point in an unloaded program, the run-time system cannot find it.

Therefore, before calling an entry point, either the entry point must be preloaded, or the program containing the entry point must be loaded.