View previous topic :: View next topic
|
Author |
Message |
abhicet2003
New User
Joined: 16 Nov 2005 Posts: 21
|
|
|
|
Hi,
Please give me the solution for this.
01 WS-COUNT PIC9 VALUE 5
PERFORM XX-PARA WS-COUNT TIMES
XX-PARA.
MOVE 10 TO WS-COUNT
HOW many times xx-para will get executes?
Thanks |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi abhicet2003,
It will execute just 5 times. that's it
Correct me if I am wrong |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
It will execute 5 times.
PERFORM N TIMES executes the section/para N times irrespective of vale of N being modified later.
This is not an infinite loop.
Thanks,
Parikshit |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
It will execute only 5 times |
|
Back to top |
|
|
sandeep4u
New User
Joined: 12 Aug 2005 Posts: 32
|
|
|
|
Hi,
It will execute only five times..definately..
correct me i m wrong...
thanks,
sandy |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
abhicet2003,
I know I'm being a Smart A--, but it will execute 6 times, 5 for the "PERFORM WS_COUNT TIMES" and once it will fall through XX_PARA.
Dave |
|
Back to top |
|
|
abhicet2003
New User
Joined: 16 Nov 2005 Posts: 21
|
|
|
|
Thanks a lot for your Quick response. |
|
Back to top |
|
|
ajayvamsi
New User
Joined: 21 Jul 2005 Posts: 56 Location: Hyderabad
|
|
|
|
it wil execute only 1 time |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
01 WS-COUNT PIC9 VALUE 5
MOVE 10 TO WS-COUNT
Do you realise that WS-COUNT will have value of 0 after that MOVE statement?
However if you code
01 WS-COUNT PIC 99 VALUE 5
then the value will be 10.
The paragraph will execute 5 times because Cobol stores the initial WS-COUNT value in a seperate register.
However if you were to subsequently repeat the
PERFORM XX-PARA WS-COUNT TIMES
it would then execute it 10 times (or whatever value was in WS-COUNT at the time of the 2nd execution) |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Another "Smart A"-- ans:
It will not compile. PIC9 (no space) is invalid. |
|
Back to top |
|
|
philipraju Warnings : 1 New User
Joined: 16 Apr 2006 Posts: 29
|
|
|
|
It will executes defineitely for 5 times only,because of we cant overwright the value of the variable i.e.in the loop,here we assigning the value in first para and then overwriting the same variable with some other value,that is aplicable to that particular para only(i think),not for calling para.
..............corret Me if im wrong |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Good catch mmwife |
|
Back to top |
|
|
swamy
New User
Joined: 22 Jul 2005 Posts: 1 Location: banglore
|
|
|
|
it will executes five times only....
thanks
Swamy |
|
Back to top |
|
|
|