Multiple choice technology mainframe

Read the following code. 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. How many times will b-para be executed ?

  1. 5

  2. 10

  3. infinite

  4. Never

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The PERFORM statement executes b-para exactly 5 times because ws-n is 5 when the PERFORM begins. The fact that b-para changes ws-n to 10 does not affect the already-determined iteration count. PERFORM evaluates the loop count once at the start, not after each iteration. This is a fixed iteration loop, not a conditional one.