PERFORM statement

The PERFORM statement transfers control explicitly to one or more procedures and implicitly returns control to the next executable statement after execution of the specified procedures is completed. Start of changeThe PERFORM statement is also used to control execution of one or more imperative statements that are within the scope of that PERFORM statement.End of change

Format 1: Basic PERFORM statement

Read syntax diagramSkip visual syntax diagramPERFORMprocedure-name-1THROUGHTHRUprocedure-name-2imperative-statement-1END-PERFORM
procedure-name-1 , procedure-name-2
Must name a section or paragraph in the procedure division.

When both procedure-name-1 and procedure-name-2 are specified, if either is a procedure-name in a declarative procedure, both must be procedure-names in the same declarative procedure.

If procedure-name-1 is specified, imperative-statement-1 and the END-PERFORM phrase must not be specified.

If procedure-name-1 is omitted, imperative-statement-1 and the END-PERFORM phrase must be specified.

imperative-statement-1
The statements to be executed for an in-line PERFORM

Inline and out-of-line PERFORM statements

The PERFORM statement is an inline PERFORM statement, when procedure-name-1 is omitted.

The PERFORM statement is an out-of-line PERFORM statement, when procedure-name-1 is specified.

An inline PERFORM must be delimited by the END-PERFORM phrase.

The inline and out-of-line formats cannot be combined. For example, if procedure-name-1 is specified, imperative statements and the END-PERFORM phrase must not be specified.

You can use the EXIT PERFORM statement to exit from an inline PERFORM without using a GO TO statement or a PERFORM ... THROUGH statement. For details, see Format 5 (inline-perform).

You can use the INLINE directive to decide whether a procedure referenced by PERFORM statements is eligible for inlining. For details, see INLINE.

END-PERFORM

Delimits the scope of the in-line PERFORM statement. Execution of an in-line PERFORM is completed after the last statement contained within it has been executed.