Skip to Main Content
PROGRAMMING IN COBOL/400: 2nd Edition
book

PROGRAMMING IN COBOL/400: 2nd Edition

by James Cooper, Nancy Stern, Robert A. Stern
January 2002
Intermediate to advanced content levelIntermediate to advanced
736 pages
18h 57m
English
Wiley
Content preview from PROGRAMMING IN COBOL/400: 2nd Edition

Chapter 9. ITERATION: BEYOND THE BASIC PERFORM

CHAPTER OBJECTIVES

Upon completion of this chapter, you should be able to

  • Explain the term "iteration."

  • Describe and demonstrate the various formats of the PERFORM statement for iteration.

THE SIMPLE PERFORM REVIEWED

The simple PERFORM statement executes a specified routine from one or more points in a program. This topic was introduced earlier in the book but is discussed in more detail here. The format of the basic PERFORM statement is

Basic Instruction Format:

THE SIMPLE PERFORM REVIEWED

Examine the 000-MAIN-MODULE module in the following COBOL program excerpt.

THE SIMPLE PERFORM REVIEWED

The PERFORM statement in the 000-MAIN-MODULE will

  1. Branch from 000-MAIN-MODULE and execute all instructions in the 100-INITIALIZATION-RTN module.

  2. Transfer control back to the next instruction in sequence, after the PERFORM.

A simple PERFORM statement is used whenever a series of instructions in a particular paragraph is to be executed from a different location or locations in the program.

Another example of this is the reading of a record from the file that will control the main processing of the program. Most often, the READ operation is specified in more than one location in the program. In the example above, the PERFORM 23 0-READ-EMPLOYEE-RECORD-RTN module is executed from two different locations in the program. In ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Designing and Programming CICS Applications

Designing and Programming CICS Applications

John Horswill, Members of the CICS Development Team at IBM Hursley

Publisher Resources

ISBN: 9780471418467Purchase book