cobol PERFORM statement

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

The PERFORM statement transfers control to one or more procedures and returns control implicitly when the sequence completes. PERFORM can also be used for inline loops withing the scope of the PERFORM.

The VARYING phrase allows for nesting with one or more AFTER clauses, and the conditional test can be BEFORE (default) or AFTER each loop.

The THRU clause of a procedural perform assumes sequential top down control flow from procedure-1 through the end of procedure-2. THRU is a contentious issue, and many programmers prefer PERFORM by SECTION rather than using THRU paragraphs. Some shops may mandate PERFORM THRU with an explicit exit point paragraph, others may ban the use of THRU finding it more difficult to debug.

Procedural perform:

PERFORM procedure syntax diagram

Inline perform:

Inline PERFORM syntax diagram

Where varying-phrase is:

varying-phrase



Got any cobol Question?