Skip to content
COBOL

PERFORM

The COBOL statement that runs a paragraph and returns, and the way loops are written.

Also written PERFORM UNTIL, PERFORM VARYING

PERFORM is how COBOL structures execution. In its simplest form it runs a named paragraph and comes back to the statement after it, which is the language's equivalent of calling a routine.

It is also the loop construct. PERFORM UNTIL repeats a paragraph until a condition becomes true, which is how nearly every batch program processes a file: keep reading and handling records until the end is reached. PERFORM VARYING adds a counter that steps through values, used for working through tables. PERFORM a number of TIMES repeats a fixed count.

A related form, PERFORM THRU, runs a range of paragraphs in sequence. It appears often in older code and is a common source of confusion, because inserting a paragraph in the middle of a range silently changes what runs.

Inline PERFORM, where the statements sit directly inside the PERFORM rather than in a separate paragraph, is available in modern COBOL and produces code much closer to what a reader coming from another language expects.

Browse all 115 terms

Learn this properly.

Use PERFORM for real in Mainframe101, in your browser, with Zed beside you. Join the waitlist.

Early access and updates. No spam, unsubscribe any time.