PERFORM THRU

A common practice is to include a THRU clause on every PERFORM statement (other than in-line PERFORMs). Typically the object of the THRU clause is a trivial EXIT paragraph immediately following the paragraph PERFORMed.

In many places this practice has become enshrined as a corporate standard, with varying degrees of enforcement.

With GO TOs or fall-through logic, THRU clauses are all but indispensable. If you must use them, you might as well use them consistently. Otherwise they are useless bug-breeders.

Disadvantages of THRU clauses

  1. It is tedious and time-consuming to type all the THRU clauses and EXIT paragraphs.
  2. The extra lines required for the EXIT paragraphs make the source code longer. The code consumes more disk space and, when you print listings, more paper. In the editor, fewer useful lines fit on the screen.
  3. In the editor: when you do a 'find' on a paragraph number, you find not only references to the paragraph you want, but also references to the corresponding EXIT paragraph (depending on your naming conventions). This problem is not a serious one, but it is a recurring annoyance.
  4. Human beings who read the code will routinely assume that the PERFORMed paragraphs match up in the expected ways with the EXIT paragraphs. If this assumption is false, by accident or design, no one is likely to notice.
  5. Like other forms of fall-through logic, THRU clauses are a standing invitation to problems. If you renumber your paragraphs carelessly, or move them around carelessly, the flow of control suddenly veers off in crazy directions. It can take a long time to find the problem. Those dippy little THRU clauses are so humdrum that we don't pay much attention to them.

Advantages of THRU Clauses

[This space intentionally left blank]
[home]COBOL Home [style forum]COBOL Style Forum