Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Evaluate statement in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Thu Apr 14, 2005 2:53 pm    Post subject: Evaluate statement in cobol
Reply with quote

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
View user's profile Send private message

kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Thu Apr 14, 2005 3:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
learnmf

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Thu Apr 14, 2005 7:22 pm    Post subject:
Reply with quote

In the first case para-1 executed and in the second one the statement next to the evaluate stmt executed.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Thu Apr 14, 2005 11:45 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ankyhunk

Moderator


Joined: 05 May 2005
Posts: 98
Location: Navi Mumbai, India

PostPosted: Fri May 06, 2005 2:47 pm    Post subject:
Reply with quote

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
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Fri May 06, 2005 4:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Fri May 06, 2005 6:35 pm    Post subject:
Reply with quote

Ankur

Anu is Right and you are Wrong. Please test yourself OR check this example for more information.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg10/1.5.1.1.2?DT=20020923143836#HDRWQ168

Regds
-Som
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Fri May 06, 2005 7:06 pm    Post subject:
Reply with quote

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
View user's profile Send private message
nave

New User


Joined: 16 May 2005
Posts: 10
Location: bangalore,india

PostPosted: Mon May 16, 2005 6:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
nave

New User


Joined: 16 May 2005
Posts: 10
Location: bangalore,india

PostPosted: Mon May 16, 2005 6:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us