Multiple choice technology mainframe

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 TP WS-N. How many times will B-PARA be executed ?

  1. Bad coding. The loop will not be executed.

  2. 5 times.

  3. 10 times.

  4. 15 times.

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

WS-N starts at 0, gets set to 5, then PERFORM B-PARA WS-N TIMES executes B-PARA exactly 5 times. The fact that B-PARA changes WS-N to 10 doesn't affect the loop count - PERFORM TIMES evaluates the count once at the start.