Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Query on EVALUATE

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

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Mon Oct 12, 2009 4:33 pm    Post subject: Query on EVALUATE
Reply with quote

Hi can anyone explain the execution of EVALUATE statement?

EVALUATE TRUE
WHEN VAR-A IS NUMERIC
PERFORM read file A

WHEN VAR-B IS NUMERIC
PERFORM read file B
END-EVALUATE

If both the variables ( VAR-A and VAR-B) are numeric, then what 'll happen... whether both the files 'll be read or file A alone?

Thanks in advance
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Mon Oct 12, 2009 4:41 pm    Post subject:
Reply with quote

/RANT ON/
why can't you read the description provided in ANY COBOL manual?
/RANT OFF/

IBM Manuals button at top-of-page, does not matter the version,
EVALUATE has not changed.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Oct 12, 2009 4:44 pm    Post subject:
Reply with quote

I think that the first one will get execute
Back to top
View user's profile Send private message
pecram24

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Mon Oct 12, 2009 4:46 pm    Post subject:
Reply with quote

yeah u r right.. but i don't find the ans that is related to my question.. if u knew please share it..


Thanks..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Mon Oct 12, 2009 4:51 pm    Post subject:
Reply with quote

The manuals link at the top of the page does not take long to click -- nor does it take long to find the COBOL Language Reference manual -- nor does it take long to find the EVALUATE statement in the manual where it reads
Quote:
6.2.13.4 Executing the EVALUATE statement

After the comparison operation is completed, execution of the EVALUATE statement proceeds as follows:

* If a WHEN phrase is selected, execution continues with the first imperative-statement-1 following the selected WHEN phrase. Note that multiple WHEN statements are allowed for a single imperative-statement-1.

* If no WHEN phrase is selected and a WHEN OTHER phrase is specified, execution continues with imperative-statement-2.

* If no WHEN phrase is selected and no WHEN OTHER phrase is specified, execution continues with the next executable statement following the scope delimiter.

* The scope of execution of the EVALUATE statement is terminated when execution reaches the end of the scope of the selected WHEN phrase or WHEN OTHER phrase, or when no WHEN phrase is selected and no WHEN OTHER phrase is specified.


If you cannot use the manual to find such a clear statement, or cannot understand such a clear statement, perhaps you should reconsider your career choice -- IT has many, many, many times when things are much more complex than this and you will be expected to understand from your reading which applies, and why.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Oct 12, 2009 4:52 pm    Post subject:
Reply with quote

I think , not sure but evaluate works like whenever the first condition get satisfy it comes out of the evaluate , so as soon as the first condition get satify then it will execute that and comes out
Back to top
View user's profile Send private message
pecram24

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Mon Oct 12, 2009 4:59 pm    Post subject:
Reply with quote

Yes Ketan.. i tooo have a thought that if anyone of the condition given in the WHEN clause is true the execution 'll come out of the EVALUATE statement after executing the imperative statements...
but i need to get clarified on this...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Mon Oct 12, 2009 5:06 pm    Post subject:
Reply with quote

Sigh.
Quote:
* If a WHEN phrase is selected, execution continues with the first imperative-statement-1 following the selected WHEN phrase.
says the first WHEN that is TRUE will have its statement(s) executed.
Quote:
* The scope of execution of the EVALUATE statement is terminated when execution reaches the end of the scope of the selected WHEN phrase or WHEN OTHER phrase, or when no WHEN phrase is selected and no WHEN OTHER phrase is specified.
says once the statement(s) for the WHEN have been executed, control passes out of the EVALUATE.

Extremely clear in the manual -- reading and comprehension are optional.
Back to top
View user's profile Send private message
pecram24

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Mon Oct 12, 2009 5:14 pm    Post subject:
Reply with quote

yes....
but here we are not not checking the same variable for different conditions instead we are checking two different variables...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Mon Oct 12, 2009 5:31 pm    Post subject:
Reply with quote

pecram24 wrote:
yes....
but here we are not not checking the same variable for different conditions instead we are checking two different variables...


number of variables that you are testing does not matter.

the order of the WHEN clauses is what matters:
First one satisfied, is the only one that is executed.

if you need to check two different variables
and do something for each, then evaluate is the incorrect command.
Back to top
View user's profile Send private message
pecram24

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Mon Oct 12, 2009 5:43 pm    Post subject:
Reply with quote

Hi all thank u for your answers...
i just wanted to confirm whether my understanding is correct or not....

Thanks,
Ram
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Mon Oct 12, 2009 5:52 pm    Post subject:
Reply with quote

Quote:
i just wanted to confirm whether my understanding is correct or not....


you are welcome.
We realize that such a complex question requires continual expansive explanations;
especially since something like this is so difficult to test.
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 query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
No new posts Query on IEFBR14 with GDG Ashishpanpaliya JCL & VSAM 4 Tue Nov 07, 2017 8:34 pm
No new posts Query on XMITIP abdulrafi All Other Mainframe Topics 1 Wed Oct 25, 2017 6:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us