| |
 |
|
| |
COBOL TUTORIAL
FOR BCA STUDENTS OF M G UNIVERSITY |
|
| |
|
|
| |
 |
|
| |
|
| |
|
| |
|
| |
 |
|
| |
The
format of PERFORM with TIMES statement is as follows:
|
|
| |
 |
|
| |
The range is repetitively executed for the number
of times specified through the identifier or the integer
and after that the control goes to the next statement
following the PERFORM statement.
Example:
|
|
| |
|
|
| |
In this case the specified CALCULATE-PARA
will be repeatedly executed 5 times.
|
|
| |
|
| |
In
this case the specified range of all paragraphs from
BEGIN-PARA to END-PARA
will be repeatedly executed n times. Note that the
value of n should be available before this statement
gets executed.
|
|
| |
|
|
| |
 |
|
| |
|
| |
 |
|
| |
The
format is as follows:
|
|
| |
 |
|
| |
Like the TIMES option, the range is executed repetitively
until the specified condition becomes true. It is
expected that the condition should be false in the
beginning and as a result of the repeated execution
of the range, the condition would become true at some
stage. However, the PERFORM statement may not be terminated
as soon as the condition becomes true. The range must
be executed completely before the termination.
Example:
|
|
| |
|
| |
Here READ-PARA will be executed whenever
I <= 5 . When the condition fails it executes READ-PARA
and if the condition turns out to be true it skips
READ-PARA.
|
|
| |
|
| |
It is similar to the previous example. All the paragraphs
from BEGIN-PARA to END-PARA will be executed till
the specified condition is satisfied.
|
|
| |
|
|
| |
 |
|
| |
|
|
| |
 |
|
| |
|
|