Chapter 9. Iteration: Beyond the Basic PERFORM
OBJECTIVES
To familiarize you with
The simple
PERFORM
.How
PERFORM
statements are used for iteration.The various options available with the
PERFORM
statement.
THE SIMPLE PERFORM REVIEWED
The Basic Formats
In this section, we will review the simple PERFORM statement, which is used for executing a specified routine from one or more points in a program. This topic was introduced in Chapter 4 but will be discussed in more detail here. Later on in this chapter, we will review how other options of the PERFORM
are used for iteration or looping. There are two formats of the basic PERFORM
:
1. PERFORM Paragraph-Name
The format for this version of the basic PERFORM is:
Format
PERFORM [paragraph-name-1]
The PERFORM paragraph-name statement will:
Execute all instructions in the named paragraph.
Transfer control to the next instruction in sequence, after the
PERFORM
paragraph-name.
If you look at a reference manual you will find that this format for a PERFORM
uses the word "procedure-name" rather than paragraph-name. Because all paragraph-names are also procedure-names, we will use the terms interchangeably for now. In Chapter 14, we will consider procedure-names in more detail.
A simple PERFORM
paragraph-name statement is used whenever a series of instructions in a particular paragraph is to be executed from different points in the program. An example of this is ...
Get COBOL for the 21st Century now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.