ENTRY statement

The ENTRY statement establishes an alternate entry point into a COBOL called subprogram.

The ENTRY statement cannot be used in:

  • Programs that specify a return value using the PROCEDURE DIVISION RETURNING phrase. For details, see the discussion of the RETURNING phrase under The PROCEDURE DIVISION header.
  • Nested program. See Nested programs for a description of nested programs.
  • Dynamic call or procedure-pointer call under AMODE 64. The programs must be compiled with LP(32) (the default) and run under AMODE(31) if there are ENTRY statements entered using dynamic call or via procedure pointer.

When a CALL statement that specifies the alternate entry point is executed in a calling program, control is transferred to the next executable statement following the ENTRY statement.

Format

Read syntax diagramSkip visual syntax diagram ENTRY literal-1 USINGBYREFERENCEBYVALUEidentifier-1.
literal-1
Must be an alphanumeric literal that conform to the rules for the formation of a program-name in an outermost program (see PROGRAM-ID paragraph).

Must not match the program-ID or any other ENTRY literal in this program.

Must not be a figurative constant.

Execution of the called program begins at the first executable statement following the ENTRY statement whose literal corresponds to the literal or identifier specified in the CALL statement.

The entry point name on the ENTRY statement can be affected by the PGMNAME compiler option. For details, see PGMNAME in the Enterprise COBOL Programming Guide.

USING phrase

For a discussion of the USING phrase, see The PROCEDURE DIVISION header.