Escolar Documentos
Profissional Documentos
Cultura Documentos
|
*** PERFORM STATEMENT ***
|
|
|
| The PERFORM statement is a PROCEDURE DIVISION statement which transfers
|
| control to one or more specified procedures and controls as specified
|
| the number of times the procedures are executed. After execution of
|
| the specified procedures is completed (i.e., for the appropriate number
|
| of times or until some specified condition is met), control is
|
| transferred to the next executable statement following the PERFORM
|
| statement.
|
|
|
| There are 4 types of PERFORM statements:
|
|
|
|
Basic PERFORM
|
|
PERFORM TIMES
|
|
PERFORM UNTIL
|
|
PERFORM VARYING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BASIC PERFORM
In the basic PERFORM statement, the specified procedures are executed
once. Control is then passed to the next executable statement
following the PERFORM statement.
Format 1- Basic PERFORM
----------------------PERFORM procedure-name1 THROUGH/THRU procedure-name2
statement1 END-PERFORM
Procedure-name1 and Procedure-name2 must name a section or paragraph in
the PROCEDURE DIVISION. Procedure-name1 specifies the first (or, if
the optional THROUGH phrase is omitted) the only procedure making up
the out-of-line procedure to be executed.
The THROUGH phrase may be used only when procedure-name1 is specified.
In this case, procedure-name2 specifies the last of the out-of-line
procedures to be executed.
When procedure-name1 is specified, statement1 and the END-PERFORM must
not be specified.
If procedure-name1 is omitted, then statement1 and the END-PERFORM must
be specified.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Statement1 represents the statement or statements that make up the inline procedure to be executed.
When procedure-name1 is specified, control is passed to the first
sentence of procedure-name1. If procedure-name1 is a section, then
control is passed to the first sentence of the first paragraph of
procedure-name1.
If procedure-name2 is omitted, then control returns after the last
sentence of procedure-name1 is executed. If procedure-name1 is a
section, then control returns after the last sentence of the last
paragraph of procedure-name1 is executed.
If procedure-name2 is specified, then control returns after the last
sentence of procedure-name2 is executed. If procedure-name2 is a
section, then control returns after the last sentence of the last
paragraph of procedure-name2 is executed.
When the performed procedures include another PERFORM statement, the
procedures associated with the embedded PERFORM must be totally
included in or totally excluded from the performed procedures of the
first PERFORM statement.
PERFORM TIMES
The procedure or procedures specified in the PERFORM TIMES statement
are executed one or more times as specified by the TIMES phrase.
Control is then passed to the next executable statement following the
PERFORM statement.
Format 2- PERFORM TIMES
----------------------PERFORM procedure-name1 THROUGH/THRU procedure-name2 phrase1
phrase1 statement1 END-PERFORM
where phrase1 is:
identifier1/integer1 TIMES
If procedure-name1 is specified, statement1 and the END-PERFORM must
not be specified.
If procedure-name1 is omitted, then statement1 and the END-PERFORM must
be specified.
The value of identifier1/integer1 dictates the number of times the
procedure or procedures are executed.
If the value of identifier1 is not greater than zero when the PERFORM
statement is executed, control passes to the next executable statement
following the PERFORM statement.
PERFORM UNTIL
The procedure or procedures specified in the PERFORM UNTIL statement
are executed until the condition specified by the UNTIL phrase is true.
Control is then passed to the next executable statement following the
PERFORM statement.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|