Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ENTRY statement

Function

The ENTRY statement is used in a COBOL subprogram of a run unit for specifying the entry point by which the subprogram may be called (as opposed to the standard entry point supplied by the Procedure Division header). Optionally, data-names may be specified, if data is to be transferred from the calling program as a parameter.

Format


ENTRY literal [USING {data-name-1}... ].


Syntax rules

  1. literal must be an alphanumeric literal.

    literal must be a valid program-name, i.e. it must begin with an alphabetic character, must not contain any characters other than letters and digits, and have a maximum length of 7 characters.

  2. The program-name specified by the literal must be unique in the programs which are linked to form a run unit. Also, it must not be the same as the first 7 characters of the program-name entered in the PROGRAM-ID paragraph of the program containing this ENTRY statement.

  3. The USING phrase may be written only if the associated CALL statement in the calling program also contains a USING phrase. The number of operands in the corresponding USING phrases must be identical; otherwise the result will be unpredictable.

  4. Each data-name-1... supplied in the USING phrase of the ENTRY statement must be defined as a data item in the LINKAGE SECTION of the program containing this ENTRY statement; its level number must be either 01 or 77.

  5. The ENTRY statement must not be used in the programs of a nested program.

General rules

  1. The ENTRY statement determines the entry point in the called program. The name of the entry point is specified by the literal. A branch to this entry point is effected by a CALL statement in another program which references this entry point.

  2. The USING phrase has the effect that, at execution time, data-name-1 in the ENTRY statement of the called program and identifier-1 in the USING phrase of the CALL statement in the calling program refer to the same set of data, which is equally available both to the called program and to the calling program. The names need not be the same.

    In the USING phrase of the ENTRY statement in the called program, a data-name may occur only once; in the USING phrase of the CALL statement, however, the same identifier-1 may be specified more than once.

  3. In the called program, the operands of the USING phrase are treated according to the data descriptions given in the LINKAGE SECTION.

  4. An ENTRY statement may be executed only once (upon entry to the program). The remainder of the program may contain no further ENTRY statements.

  5. If a data item is passed in the CALL statement as a BY CONTENT parameter, the value of this data item is transferred to a memory area which has the characteristics specified for identifier-2 in the CALL statement before the CALL statement is executed. The data type and length of each parameter in the BY CONTENT phrase of the CALL statement must be the same as those of the corresponding parameter in the USING phrase in the Procedure Division header.