ENTRY Statement

The ENTRY statement is used to establish an alternate entry point in the program.

General Format

ENTRY entry-name [ USING {parameter} ... ]

Syntax Rules

  1. entry-name is a non-numeric literal. The maximum number of characters is 30.
  2. parameter is a data item defined with a level-number of 01 or 77 and it must appear in the Linkage Section.
  3. Each parameter cannot appear more than once in the USING phrase.
  4. An ENTRY statement can begin in Area A. The compiler will not recognize this as an error. This provides compatibility with other compilers that support the ENTRY statement.

General Rules

  1. entry-name must be unique within the program. No duplicates are allowed.
  2. The maximum number of parameters that may be passed to an ENTRY point is 255.
  3. If the USING phrase is used, then each parameter must be declared in the Linkage Section.
  4. The constraints on the parameters are the same as those for the Procedure Division USING items. See Procedure Division Format for more information.
  5. There is a limit of 255 level 01 Linkage data items per program.
  6. An ENTRY point can be called just like any other program; however, the program containing the ENTRY point must be loaded and present in memory at the time of the CALL. Once loaded, COBOL objects may be called by any of their ENTRY point names. See Calling Subprograms for more information.
  7. The CALL succeeds if the specified program-name finds an exact entry-name match. By default, the matching logic is case sensitive and distinguishes between hyphens and underscores. The matching logic can be configured to be case insensitive and to not distinguish between hyphens and underscores with the LITERAL_ENTRY configuration variable described in Appendix H.
  8. When a program is called by one of its ENTRY point names, the execution begins immediately after the ENTRY statement. The ENTRY point parameters are initialized in the same way as the Procedure Division parameters.
    Note: Care should be taken not to enter a COBOL program in the middle of a control flow statement like a loop or a conditional statement. Doing so will result in undefined behavior.
  9. Execution of the program passes through entry points with no effect.
  10. There is a limit of 65536 ENTRY points per program, including the main entry point at the beginning of the Procedure Division.