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 we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What is SET TO TRUE all about, anyway?
study the data discriptions and answer the questions given below i)01 ORDER RECORD 05 OUT-HEADER PIC X(50) 05 ITEM-COUNT PIC 99 05 OUT-ITEM PIC X(20) OCCURS 1 TO 20 DEPENDING ON ITEM-COUNT ii)01 NAME-AND-ADDRESS 05 N-AND-A-LINE OCCURES 5 05 LINE-LENGTH PIC P9 05 N-AND-A-CHAR PIC X OCCURS 1 TO 20 DEPENDING ON LINE-LENGTH iii)01 SALES-LIST 05 SALESMAN-COUNT PIC 99 05 SALES PIC 9(6) OCCURS 1 TO 100 DEPENDING ON SALESMAN-COUNT iv)01 ORDER-RECORD 05 NO-OF-BRANDS PIC 99 05 BRAND-PURCHASED OCCURS 1 TO 15 DEPENDING ON NO-OF-BRANDS which of the following is true? a.i) and iii) are valid b.i) and iv) are valid c.i) and iii) are not valid d.all are valid
File status must be checked both while opening and reading the file or only while reading the file?
What is cobol?
Differentiate COBOL and COBOL-II?
whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?
what is search and searchall?what is the diffrence between them?give an best example?
How to resolve the soc4 & soc7 other than following answers. Soc4 can resolved using mispleed dd name and dd name is not matching with file and soc7 check the sysdump and copy the offest address then correct it in the program.
10 Answers ADP, Amdocs, Cap Gemini, Keane India Ltd, Super Value, TCS,
Write a program to explain size error.
can we write paragraph in area B .....
What is the difference between CONTINUE & NEXT SENTENCE ?