The COBOL system recognizes various forms of file for a program and assumes all files for a given program have filenames that share the same basename. This basename is taken to be the program name. The COBOL system uses the program name to identify a program and the dynamic loader also uses it to locate a program. Each program has a main entry point identified with the program name.
The main entry point into a program is the default point where execution of the program starts. This is the first non-declarative statement after the Procedure Division header. The COBOL language lets you specify a program-name in the PROGRAM-ID paragraph. If specified, the program-name represents the name of the main entry point.
The ENTRY statement (see your Language Reference for details) allows additional entry points to be named which represent alternative places for the program to start.
The program is identified by the program name, but once a program is loaded, by linking or dynamic loading, the names of the entry points become available for use by the CALL statement. The CANCEL statement must only reference a program name and when executed causes the program to be unloaded, unless the program is linked into the system executable file. Also see the topic -l run-time switch.
We suggest that, for your convenience, if the PROGRAM-ID paragraph is specified, you make the program-name and the basename of a program source file the same.
Multiple programs can be combined to form a single callable shared object, system executable or shared library. Here the main entry point is the basename of the first program on the command line unless the cob -e flag is specified.
On file systems that support long filenames, filenames for programs that are to be dynamically loadable must be unique in the first 30 characters. This is because filenames longer than the entry point name limit are truncated to that limit when linked or dynamically loaded. Therefore, you are recommended to keep program source filenames below 30 characters long.