Summary -

In this topic, we described about the below sections -

PERFORM TIMES used to execute statements-block/procedures number of times specified. PERFORM TIMES is both in-line and out-of-line.

Syntax -

PERFORM TIMES Phrase

In-line PERFORM TIMES Out-of-line PERFORM TIMES
PERFORM identifier-1/integer-1 TIMES
Imperative-statement-1
END-PERFORM
PERFORM procedure-name-1
[THROUGH/THRU Procedure-name-2] 
Identifier-1/integer-1 TIMES

The procedures in the TIMES phrase PERFORM statement are executed the number of times specified by the value in identifier-1 or integer-1.

Control then passes to the next executable statement following the PERFORM statement. If procedure-name-1 is specified, imperative-statement-1 and the END-PERFORM phrase must not be specified.

If procedure-name-1 is ignored, imperative-statement-1 and the END-PERFORM phrase must be specified.

procedure-name-1, procedure-name-2 -

Must name a section or paragraph in the procedure division. If one of the procedures is in a declarative procedure and both procedures are specified, the other procedure also must be procedure-names in the same declarative procedure.

If procedure-name-1 is specified, imperative-statement-1 and the END-PERFORM phrase must not be specified. If procedure-name-1 is omitted, imperative-statement-1 and the END-PERFORM phrase must be specified.

imperative-statement-1 -

The statements-block to be executed for an in-line PERFORM.

identifier-1 -

Must name an integer item. identifier-1 can't be a date field. If identifier-1 is zero or a negative number at the time the PERFORM statement is initiated, control passes to the statement following the PERFORM statement.

After the PERFORM statement has been initiated, any change to identifier-1 has no effect in the number of times the procedures are iterated.

integer-1 -

Can be a positive signed integer.


Practical Example - Inline PERFORM TIMES

Code -

Inline Perform Times Code

Jcl -

Inline Perform Times Jcl

Output -

Inline Perform Times Output
Practical Example - Outline PERFROM TIMES

Code -

Outline Perform Times Code

Jcl -

Outline Perform Times Jcl

Output -

Outline Perform Times Output
Practical Example - Outline PEFROM TIMES THROUGH

Code -

Outline Perform Times Through Code

Jcl -

Outline Perform Times Through Jcl

Output -

Outline Perform Times Through Output