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
 

 

Difference b/w EVALUATE - OR and ALSO

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

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Tue Aug 09, 2005 5:39 pm    Post subject: Difference b/w EVALUATE - OR and ALSO
Reply with quote

Hi all,
when I faced an interview they asked me what is the diffrence b/w
EVALUATE TRUE
WHEN PLAN = '545' OR '656'
....
WHEN OTHER
END-EVALUTE

and

EVALUATE TRUE
WHEN PLAN = '545' ALSO '656'
....
WHEN OTHER
END-EVALUTE

wat is the difference these two statements...please help me out...!!
_________________
Have a nice day
Back to top
View user's profile Send private message

shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Tue Aug 09, 2005 5:46 pm    Post subject: Re: EVALUATE
Reply with quote

Hey...

In my understanding, 'ALSO' normally coded to check additional parameter's statements. U cannot use ALSO for the same variable.

like

we can check

EVALUATE TRUE

WHEN AGE >13 ALSO SEX = 'M'

If we use for the same variable....it has no meaning.. Both are same...
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Aug 09, 2005 6:03 pm    Post subject: Re: EVALUATE
Reply with quote

Hi ajayvamsi,

ALSO is used in EVALUATE statement to differentiate between subjects & objects mentioned in the condition.....

for ex...

Code:
EVALUATE AGE ALSO SEX

WHEN 22 ALSO M ...
WHEN 18 ALSO F....


Like that you differentiate between variables thru ALSO....

Hope I m clear....

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Aug 10, 2005 4:34 am    Post subject:
Reply with quote

Hi ajayvamsi,

I haven't compiled this, so I don't know if Shiva is right, but you could try:

EVALUATE TRUE ALSO TRUE
WHEN PLAN = '545' ALSO PLAN = '656'
....
WHEN OTHER
END-EVALUTE

The only problem is that the WHEN can never test TRUE. ALSO means "and" not "or".

P.S. The 1st example can be coded as below with the same result:

EVALUATE PLAN
WHEN '545'
WHEN '656'
....
WHEN OTHER
END-EVALUTE
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Aug 10, 2005 3:15 pm    Post subject: Re: EVALUATE
Reply with quote

As I earlier said.....
Quote:
ALSO is used in EVALUATE statement to differentiate between subjects & objects mentioned in the condition


The Variable mentioned after EVALUATE VERB is the subject in this case & the values being checked inside the EVALUATE is objects for that.
Like...

Code:
EVALUATE AGE
WHEN 22...
WHEN 24...
....


AGE is subject in this case & 22, 24 are the objects for that.

Quote:
I haven't compiled this, so I don't know if Shiva is right,

In SHIVA's case number of subjects are less than number of objects, so it fails in compiling.
But what he said is meaningfull....
Quote:
If we use for the same variable....it has no meaning.. Both are same...


ALSO means AND, not OR....So if you want to check value of PLAN for 545 OR 656...you should give two WHEN in EVALUATE stmt with same Execuatable stmts.

mmwife....In your code.....
Code:
EVALUATE TRUE ALSO TRUE
WHEN PLAN = '545' ALSO PLAN = '656'
....
WHEN OTHER
END-EVALUTE


Will control ever go in first WHEN.....Syntactically its fine.....Solution lies in the second code given by you.

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Aug 11, 2005 6:02 am    Post subject:
Reply with quote

Priyesh,

Quote:
ALSO means AND, not OR....So if you want to check value of PLAN for 545 OR 656...you should give two WHEN in EVALUATE stmt with same Execuatable stmts.

Quote:
Will control ever go in first WHEN.....Syntactically its fine.....Solution lies in the second code given by you.


That's what I meant when I said:
Quote:
The only problem is that the WHEN can never test TRUE. ALSO means "and" not "or".
Back to top
View user's profile Send private message
Karthikt

New User


Joined: 15 Aug 2005
Posts: 51

PostPosted: Mon Aug 15, 2005 11:19 am    Post subject:
Reply with quote

Hi,
ALSO Means and. When you are using this parameter, it should satisfy both the conditions. Then only it will process up for the statements down below the WHEN.

Correct 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 Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am


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