COBOL Perform

statement syntax and Perform in COBOL language references are provided.

>COBOL PERFORM Statement - IBM Enterprise COBOL for z/OS
The COBOL 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.

The COBOL PERFORM statement transfers control explicitly to one or more procedures, and implicitly returns control to the statement after the current PERFORM statement when execution of the specified procedure or procedures is complete.

>COBOL Study Material for PERFORM Statement
The simple form of the PERFORM in COBOL acts very similar to GO TO statement, except that after execution of paragraph control will return back to the next statement.

>Course Notes for COBOL PERFORM
The PERFORM verb will execute the specified paragraph and then control will return to the statement following the PERFORM. There are no restrictions as to the physical placement of a paragraph compared to the COBOL PERFORM statement that executes it.

>Example Programs for COBOL PERFORM
An example program demonstrating how the first format of the COBOL PERFORM verb may be used to change the flow of control through a program. Demonstrates the second format of the PERFORM statement. The PERFORM TIMES may be used to execute a block of code x number of times. Demonstrates how the PERFORM UNTIL (third format) may be used to process a stream of values where the length of the stream cannot be determined in advance. Demonstrates how the PERFORM VARYING and the PERFORM VARYING..AFTER (fourth format) may be used for counting iteration. Also introduces the WITH TEST BEFORE and WITH TEST AFTER phrases.

The COBOL PERFORM statement has four formats: Format 1 (Basic COBOL PERFORM), Format 2 (PERFORM with TIMES), Format 3 (PERFORM UNTIL), and Format 4 (PERFORM VARYING).

>PERFORM in COBOL - Micro Focus Visual COBOL
The PERFORM in COBOL statement is used to transfer control explicitly to one or more procedures and to return control implicitly whenever execution of the specified procedure is complete. The PERFORM statement is used to control execution of one or more imperative statements which are in the scope of that PERFORM in COBOL statement.

>PERFORM in COBOL Standards
Even though COBOL allows the PERFORM command to be used on paragraphs as well as sections, its use should be limited to sections only. If necessary make the offending paragraph into a self-contained section, or an in-line PERFORM (if it is small enough). This guideline then avoids the possibility that someone may split the paragraph in two, thereby causing the PERFORM to terminate at the new paragraph name.

The COBOL PERFORM UNTIL syntax provides iteration support, allowing a section of code to be executed multiple times.

The COBOL PERFORM VARYING phrase increases or decreases the value of one or more identifiers or index-names, according to certain rules.


This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

View e-Privacy Directive Documents

You have declined cookies. This decision can be reversed.

You have allowed cookies to be placed on your computer. This decision can be reversed.


Member Login