IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference b/w EVALUATE - OR and ALSO


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajayvamsi

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Tue Aug 09, 2005 5:39 pm
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
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: 1448
Location: Chicago, IL

PostPosted: Tue Aug 09, 2005 6:03 pm
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
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: 1448
Location: Chicago, IL

PostPosted: Wed Aug 10, 2005 3:15 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
Search our Forums:

Back to Top