Previous Topic Next topic Print topic


Search Conventions Used for Calling Programs

Restriction: This information is not applicable to managed code.

When a program is called, the run-time system checks to see if the program has already been loaded or logically canceled. If the program is already available in memory, the run-time system passes control to it.

If the program is not available, the run-time system searches for it in the following sequence:
  1. Directories set in the COBPATH environment variable.
  2. If COBPATH is not set, current directory or PATH (.dll only).
  3. Application directory.
  4. Directory containing the calling program (unless the calling program is a .dll).

This search sequence only applies to called program files. It does not apply to other types of file, such as COBOL copybooks; use the COBCPY environment variable to locate copybooks.

At each stage of the search sequence, if the called program is named explicitly (name and extension specified), the specific file is searched for. If the called program is named implicitly, (base name only, no extension specified) the run-time system looks for executable files in the order:

  1. filename.dll
  2. filename.gnt
  3. filename.int
  4. filename.lbr
  5. filename

If the search reaches the last directory without finding an executable file, the run-time system issues a "program not found" error message.

In the case of a library file (.lbr), the run-time system opens it, and searches it for an executable name filename.ext where .ext is one of the other executable file types listed above (except .dll files).

Note: If the dollar sign ($) is the first character of a program name, and that program is dynamically linked, or dynamically loadable, the first element of the program name is checked for filename mapping. The first element of the program name consists of all the characters before the first backslash character (\). For example, if the source program contains the statement:
 CALL "$MYLIB\A"
the subprogram A is loaded from the path as defined by the MYLIB environment variable when the program is run.
Previous Topic Next topic Print topic