Consider the following:
77 W-NUM PIC 9 VALUE 0
------
MOVE 1 TO W-NUM
PERFORM PARA-X UNTIL W-NUM > 9.
------
PARA-X
ADD 1 TO W-NUM
How many times PARA-X is executed ?
Answers were Sorted based on User's Feedback
Answer / rahul
as the variable W-NUM is single digit (PIC 9), it will
never be greater than 9. Hence the loop will be infinite.
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / thrivikram
it goes into infinite loop.
when w-num =9 , it will become 0
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / hemanth reddy
Sorry i thought that it is < 9 .
If it is less than 9 it is correct.
If it is > 9 then it goes to infinite loop
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / ram.g
sorry for my wrong ans..
it will be in the infinite loop...
should use different ws variables..
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / mr.perfect
9 times.
Initially, W-Num value will be 1.
1>9, so para will be executed. - 1 time
2>9, so para will be executed. - 2 times
3>9, so para will be executed. - 3 times
4>9, so para will be executed. - 4 times
5>9, so para will be executed. - 5 times
6>9, so para will be executed. - 6 times
7>9, so para will be executed. - 7 times
8>9, so para will be executed. - 8 times
9>9, so para will be executed. - 9 times
10>9, this will go to 0 because , the PIC at WOrking
storage section is 9. so that 10 becomes 0
W-NNum = 0 . THe loop again start from 0> 9
this will execute Infinite loop.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / guest
it will go in a infinite loop. But simply because
when W-NUM is 9, after "ADD 1 TO W-NUM", W_NUM would again
become 0.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / avinanda mukherjee
Thrivikram is absulately correct....
Avinanda Mukherjee
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / gaurav
Rahul's answer is correct.
Please note that the W-NUM is defined as PIC 9, hence it
can contain only a single digit numberic number i.e from
number 0 to number 9. Thus when the PARA-X is executed 9
times when W-NUM contains 9. It will not be able to add
further 1 to W-NUM, thus it will go in a infinite loop.
Hope this clear things.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / hemanth reddy
It will execute 8 times.
Because Initially w_Num is 1 By checking 1 > 9 it will
execute the para-x and adding 1 to W-NUM
| Is This Answer Correct ? | 2 Yes | 4 No |
HOw can I get the negative sign while deduct high value from low value
what is redefines? where it can be effectively use for the purpose of memory utilization? give an example?
What are the different data types available in COBOL?
why occurs clause not mentioned in 01 level
6 Answers HCL, NIIT, TCS, Tesco,
What is the point of the REPLACING option of a copy statement?
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
1)what is use of linkage section? 2)what is difference between comp and comp-3
What rules are followed by the search verb.
If i have a variable A pic 9(2) value 10 Compute A = a - 100 what will be the value of A and will there be any error becoz of the Negative value
BY seeing a program how can we say that it is static call or dynamic call
i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL program fail?
In an EVALUATE statement, can I give a complex condition on a when clause?