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?
Answer Posted / 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 |
Post New Answer View All Answers
In COBOL, what is the different between index and subscript?
What is a report item?
What are all the divisions of a COBOL program?
how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)
What is cobol?
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
What is the difference between perform … with test after and perform … with test before?
What is rmode(any) ?
What is comp-1 and comp-2?
How can you get the ksds file records into your cobol program?
How do we get current date from system with century in COBOL?
What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?
IF I mention stop run in CICS what happens?
What is the difference between structured cobol programming and object alternativelyiented cobol programming?
Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning