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


Please Help Members By Posting Answers For Below Questions

I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1228


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

639


Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.

1697


Explain how you can characterize tables in cobol?

636


Can a Search can be done on a table with or without Index?

800






how do you reference the printer file formats from cobol programs

654


What are the rules of the move verb?

701


How do define dynamic array in cobol.

669


Write the code to count the sum of n natural numbers.

697


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

818


How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

2093


Why occurs cannot be used in 01 level in COBOL?

711


I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......

10578


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

643


how do you reference the rrds file formats from cobol programs

792