PERFORM ACCUMULATE-TOTALS
VARYING A FROM 1 BY 2 UNTIL A >2
AFTER B FROM1 BY 1 UNTIL B>2
AFTER C FROM 2 BY -1 UNTIL C<2
How many times the paragraph ACCUMULATE-TOTALS would be
exicuted?
Answers were Sorted based on User's Feedback
Answer / shakilaashwin
PERFORM ACCUMULATE-TOTALS
VARYING A FROM 1 BY 2 UNTIL A >2
AFTER B FROM 1 BY 1 UNTIL B>2
AFTER C FROM 2 BY -1 UNTIL C<2.
ACCUMULATE-TOTALS.
ADD 1 TO ACCUMULATE-CNT.
DISPLAY 'A - ' , A.
DISPLAY 'B - ' , B.
DISPLAY 'C - ' , C.
Ans is 2 - The loop will be executed until all the condition
(A > 2, B > 2, C < 2) becomes True.
Execution : 1 Condition is
A - 1 True
B - 1 True
C - 2 False
Execution : 2
A - 1 False
B - 2 True
C - 2 False
When going for 3rd execution - No condition Will be True
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / shan
looping happens for following values of
A, B, C
1, 1, 2 = 1st
1, 2, 2 = 2nd
2, 1, 2 = 3rd
2, 2, 2 = 4th
So totally four times this will get executed
Is This Answer Correct ? | 2 Yes | 3 No |
Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.
Size of a column has been changed in DB2 table (Suppose it was of 5 characters and later changed to 4 characters) and forgot to change the DCLGEN in COBOL program, what will happen during the execution of code? If the program Abends then what will be the error? If it doesn't abend then hpw the error can be catched?
what are the steps to sort in a cobol program?
What is the difference between next sentence and continue in cobol programing language?
how many bytes does s9(15) occupy in comp1 comp2 and comp3 ?
what is record label is empty or standard in file description of data division?
What should be the sorting order for SEARCH ALL?
if we have a 10 steps how to override the 4th step in jcl?
How do you do in-line PERFORM?
Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???
What will happen if we move SPACES to numeric field and ZEROES to alphabetic field?
Write a program to enter and display the names of students in a class using the occurs clause.