ENTRY

Purpose

Defines an alternate entry point to a procedure.

Syntax

name:ENTRY[(parameter,…)][RETURNS(returns-descriptor)][EXTERNAL|INTERNAL];

Parameters

name
Identifies the entry point.
parameter
Represents any parameters required by the procedure at this entry point.

Description

The scope of name is external if the ENTRY statement is contained in an external procedure. The scope of name is internal if the ENTRY statement is contained in an internal procedure.

The RETURNS option is required for entry points that are invoked by function references and provides the data type attributes of the function value returned. The RETURNS option is invalid for entry points procedures that are invoked by CALL statements.

The COBOL NOMAP [map-list] option

The FORTRAN NOMAPIN [map-list] option

The TASK NOMAPOUT [map-list] option

The NOEXECOPS option

The OPTION(BYTEADDR) option can be used to ensure the passing of byte addresses, even for items allocated on a bit boundary. When this option is not specified, Open PL/I passes bit addresses for unaligned bit strings. When this option is specified, Open PL/I passes just the address of the first byte of unaligned bit strings.

Only one of EXTERNAL or INTERNAL may be specified and only on top-level procedures, that is, those that are not contained within the scope of any other procedure. If EXTERNAL is given, the procedure will be external to the current file being compiled and can be called by other separately compiled procedures. This is the default. If INTERNAL is given, the procedure can be called only by other procedures within the current compilation. Its name is not made available outside this file.

For more information, see the sections Entry Data in the chapter Data Types and ENTRY in the chapter Declarations and Attributes.

Example

FILE_MANAGER: PROCEDURE;
DECLARE 1 FILE_IOCB BASED (IOCB_PTR),
      .
      .
      .
OPEN: ENTRY (IOCB_PTR, FILE_PTR, OPEN_MODE);
      .
      .
      .
RETURN;
CLOSE: ENTRY(IOCB_PTR);
      .
      .
      .
RETURN;
READ_RECORD: ENTRY (IOCB_PTR, BUFFER_PTR, READ_COUNT);
.
.
.
END;

FILE_MANAGER is a single procedure that has been designed to process three kinds of calls:

  • A call to open a file.
  • A call to read a record from the file.
  • A call to close the file.

A separate entry has been created for each kind of call, each with its own parameters.

Restrictions

ENTRY statements are not allowed in BEGIN blocks, ON-units, or DO groups, except for simple DOs.