View previous topic :: View next topic
|
Author |
Message |
vinit_infy Warnings : 1 New User
Joined: 07 Apr 2005 Posts: 56
|
|
|
|
What is the difference between these two:
1) Evaluate True
When X
When Y And Z
Perform Para-1(For Example)
End-Evaluate
2) Evaluate True
When X
Continue
When Y And Z
Perform Para-1
End-Evaluate.
Regards,
Vinit |
|
Back to top |
|
|
kanak
Moderator
Joined: 12 Mar 2005 Posts: 252 Location: India
|
|
|
|
in the first case when X is true then it will perform para1, where as in 2nd expample, if the x is true then next exucatble statement will be executed which ever is present after end-evaluate. |
|
Back to top |
|
|
learnmf
Active User
Joined: 14 Mar 2005 Posts: 123
|
|
|
|
In the first case para-1 executed and in the second one the statement next to the evaluate stmt executed. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi Vinit!
Quote: |
1) Evaluate True
When X
When Y And Z
Perform Para-1(For Example)
End-Evaluate |
In the above case if X is true or if (y and z) is true, (in either of the cases) para-1 will be performed.
Quote: |
2) Evaluate True
When X
Continue
When Y And Z
Perform Para-1
End-Evaluate |
In the above case if x is true the next executable statement will be executed which is present after End-Evaluate part. If y and z are true then para-1 will be performed.
HTH.. |
|
Back to top |
|
|
ankyhunk
Moderator
Joined: 05 May 2005 Posts: 98 Location: Navi Mumbai, India
|
|
|
|
Hi,
I differ with anu
Quote: |
In the above case if X is true or if (y and z) is true, (in either of the cases) para-1 will be performed. |
In the first case, when X is true & both Y & Z are true only then para-1 will be performed. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Quote: |
I differ with anu
1) Evaluate True
When X
When Y And Z
Perform Para-1(For Example)
End-Evaluate
In the first case, when X is true & both Y & Z are true only then para-1 will be performed. |
Hi Ankur,
Can you please check that again. Because this kind of code, we will be using in many programs. If i get time i will show you the proof also. |
|
Back to top |
|
|
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 134
|
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hey Ankur,
Try to run this sample code and see the results:
Code: |
WORKING-STORAGE SECTION.
01 WH-HOLD-NUM PIC 9(1).
01 WH-HOLD-VAL1 PIC 9(1).
01 WH-HOLD-VAL2 PIC 9(1).
PROCEDURE DIVISION.
MAIN-PARA.
MOVE 0 TO WH-HOLD-NUM
EVALUATE WH-HOLD-NUM
WHEN 0
WHEN 1
MOVE 8 TO WH-HOLD-VAL1
WHEN 2
MOVE 3 TO WH-HOLD-VAL1
END-EVALUATE
MOVE 1 TO WH-HOLD-NUM
EVALUATE WH-HOLD-NUM
WHEN 0
WHEN 1
MOVE 8 TO WH-HOLD-VAL2
WHEN 2
MOVE 3 TO WH-HOLD-VAL2
END-EVALUATE
DISPLAY WH-HOLD-VAL1.
DISPLAY WH-HOLD-VAL2.
STOP RUN. |
Here is my proof:
Code: |
********************************* TOP OF DATA ********************************
8
8
******************************** BOTTOM OF DATA ****************************** |
|
|
Back to top |
|
|
nave
New User
Joined: 16 May 2005 Posts: 10 Location: bangalore,india
|
|
|
|
i think what anu has showed is partially correct,since the first variable should be zero(WH-HOLD-VAL1=0) and the the second variable should be 8.that is my answer.
so in here the vineets quest what i answer is in the first case when y and z is true the perform statement works and in second case both x y z is true the para will be perfoermed,but i am still in doubtful with the default BREAK statement which is hidden with the each when clause,so what will be the effect of continue in the evaluate clause.plaease inform me if i am wrong |
|
Back to top |
|
|
nave
New User
Joined: 16 May 2005 Posts: 10 Location: bangalore,india
|
|
|
|
hi anu ,vineet
i think what anu has showed is partially correct,since the first variable should be zero(WH-HOLD-VAL1=0) and the the second variable should be 8.that is my answer.
so in here the vineets quest what i answer is in the first case when y and z is true the perform statement works and in second case both x y z is true the para will be perfoermed,but i am still in doubtful with the default BREAK statement which is hidden with the each when clause,so what will be the effect of continue in the evaluate clause.plaease inform me if i am wrong |
|
Back to top |
|
|
|