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.
You can preload entry points by creating a library file that contains any programs with entry points. When you call a library file, the run-time system does not load every program in the library file. Instead, the run-time system registers, for future reference, the existence of all programs and entry points contained in the called library file. Later when one of these programs is called, the run-time system notes that it is contained in the library file and loads it at that point.
Entry points are visible only when an assembly has been loaded. There are two solutions for this:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="MicroFocus.COBOL.Application"> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> <section name="Environment" type="System.Configuration.NameValueSectionHandler" /> <sectionGroup name="Interop"> <section name="PreLoad" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> </sectionGroup> <!--The following code declares a section group for run-time configuration --> <sectionGroup name="MicroFocus.COBOL.Runtime"> <section name="Tunables" type="System.Configuration.NameValueSectionHandler" /> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> </configSections> <MicroFocus.COBOL.Application> <Switches></Switches> <Environment></Environment> <Interop> <PreLoad> <add key="b.dll" value="managed" /> </PreLoad> </Interop> </MicroFocus.COBOL.Application> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-om:asm.v1"> <probing privatePath="bin"/> </assemblyBinding> </runtime> </configuration>