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 true also true

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

New User


Joined: 11 Aug 2011
Posts: 3
Location: India

PostPosted: Thu Aug 11, 2011 7:43 pm    Post subject: Evaluate true also true
Reply with quote

Hi All,

I would like to know if there is any rule which says the in EVALUATE TRUE ALSO TRUE we cannot check more than one condition in teh also cause.

We have the following example in our code :
EVALUATE TRUE ALSO TRUE

WHEN STATE = 000 ALSO
(BRANCH = 123 OR BRANCH = 456)

In all of the evaluate statements we have the same convention.

Please let me know if this is a style of writing or a rule
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 11, 2011 7:56 pm    Post subject:
Reply with quote

you could set-up a lvl-88 branch-is-123-456 values 123, 456

then the evaluate would be
WHEN STATE = 000 ALSO BRANCH-IS-123-456

either will work, it is allowed - it follows the rules as dictated by the cobol manual (actually compiler).

now,
is it a 'rule' or 'style of writing', depends on your site - your site creates a style based on site rules.
Back to top
View user's profile Send private message
Prachi Mule

New User


Joined: 11 Aug 2011
Posts: 3
Location: India

PostPosted: Thu Aug 11, 2011 7:59 pm    Post subject:
Reply with quote

So I can add a third branch in the ALSO clause

Like :

WHEN STATE = 000 ALSO
(BRANCH = 123 OR BRANCH = 456 OR BRANCH = 789)

right??
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Aug 11, 2011 8:02 pm    Post subject:
Reply with quote

I think section 6.2.13 of the COBOL Language Reference manual explains it:
Quote:
Operands before
the WHEN phrase Are interpreted in one of two ways, depending on how they are specified:

Individually, they are called selection subjects.

Collectively, they are called a set of selection subjects.

Operands in
the WHEN phrase Are interpreted in one of two ways, depending on how they are specified:

Individually, they are called selection objects

Collectively, they are called a set of selection objects.

ALSO
Separates selection subjects within a set of selection subjects; separates selection objects within a set of selection objects.

THROUGH and
THRU Are equivalent.

Two operands connected by a THRU phrase must be of the same class. The two operands thus connected constitute a single selection object.

The number of selection objects within each set of selection objects must be equal to the number of selection subjects.
Your example compiles and tests just fine -- as long as you have two selection subjects, and two selection objects, the logic can be pretty much whatever you want.
Back to top
View user's profile Send private message
Prachi Mule

New User


Joined: 11 Aug 2011
Posts: 3
Location: India

PostPosted: Thu Aug 11, 2011 8:04 pm    Post subject:
Reply with quote

Oh ok.
Thanks a lot!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1228
Location: Israel

PostPosted: Thu Aug 11, 2011 9:34 pm    Post subject:
Reply with quote

Another option is to use multiple WHEN:
Code:
WHEN STATE = 000 ALSO BRANCH = 123
WHEN STATE = 000 ALSO BRANCH = 456
WHEN STATE = 000 ALSO BRANCH = 789
    PERFORM BRANCH-IS-123-456-789
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Aug 11, 2011 10:02 pm    Post subject:
Reply with quote

Prachi Mule wrote:
So I can add a third branch in the ALSO clause

Like :

WHEN STATE = 000 ALSO
(BRANCH = 123 OR BRANCH = 456 OR BRANCH = 789)

right??


If you do it with an 88-level, then you can have as many as you want without causing any confusion or increased complexity.

You can also do you ( STATE = 000 ) as an 88. Much nicer when you know that there is only one thing a literal relates to (the VALUE clause on an 88).

Code:
WHEN STATE-IS-HOME-STATE
  ALSO BRANCH-IS-HEAD-OFFICE-OR-STAFF-SALES


See how much more meaningful? OK, I've made the names up, but you see how it helps. If STATE is a geographical thing, then you wonder if both tests are necessary. A BRANCH can only be in one physical place, at least usually... Not so easy to think that when they are just a bunch of numbers.

By the way, I'd suggest not to use single words for data-names, especially ones which could so easily become "reserved" (by the Compiler) in the future.
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 Evaluate statement, when-clause in co... UmeySan COBOL Programming 10 Mon Jul 16, 2012 6:49 pm
No new posts Generate report with out using IF/EVA... bbharathiraj COBOL Programming 25 Tue May 22, 2012 10:19 am
This topic is locked: you cannot edit posts or make replies. Want to put in a loop in EVALUATE maxsubrat COBOL Programming 24 Fri Apr 06, 2012 3:35 pm
No new posts Evaluate statement - clarification Vijay Subramaniyan COBOL Programming 2 Fri Feb 03, 2012 1:53 pm
No new posts Reporting true size of dataset on tape andy deiss JCL & VSAM 7 Fri Sep 23, 2011 3:18 am


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