FALSE

Page Nav

HIDE

Grid

GRID_STYLE

Perform Statement

       1.      Name the different PERFORM statement?  PERFORM PERFORM THRU PERFORM 'n' TIMES PERFORM UNTIL PERFORM VARYING with UNTI...

     1.     Name the different PERFORM statement? 
PERFORM
PERFORM THRU
PERFORM 'n' TIMES
PERFORM UNTIL
PERFORM VARYING with UNTIL Option. 


PERFORM
PERFORM  [Procedure-Name-1
END-PERFORM.

PERFORM THRU
PERFORM  [Procedure-Name-1
     [{Thru} Procedure-Name-2]]
    [Imperative-Statement-1
END-PERFORM.]

PERFORM 'n' TIMES
PERFORM [Procedure-Name-1
    [{Thru} Procedure-Name-2]]
    {Identifier-1/Integer} TIMES
    [Imperative-Statement-1]
END-PERFORM.]

PERFORM UNTIL
PERFORM [Procedure-Name-1
   [{THRU} Procedure-Name-2]]
   [WITH TEST {BEFORE AFTER} UNTIL cond-1]
   [Imperative-Statement-1
END-PERFORM.]
E.g.,
PERFORM COUNT-PARA
             WITH TEST AFTER
             UNTIL WS-COUNT > 10.
     2.     How do you do in-line PERFORM? -
PERFORM ... <UNTIL> ...
<sentences>
 END PERFORM
     3.     When would you use in-line perform?
When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the program), it would be better to put the code in a separate PARA and use PERFORM para-name rather than in-line perform.
     4.     Read the following code and tell how many times will B-PARA be executed ?
01 ws-n pic 9(2) value zero.

a-para
Move 5 to ws-n.
perform b-para ws-n times.

B-PARA.
move 10 to ws-n.

5 times only. it will not take the value 10 that is initialised in
the loop.

No comments