MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiple Whens in Evaluate

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
gans79
Beginner


Joined: 31 Aug 2005
Posts: 51
Topics: 27

PostPosted: Mon Jul 10, 2006 3:42 am    Post subject: Multiple Whens in Evaluate Reply with quote

hi,
I need to know what happens when there are multiple when in a evaluate
stmt,
ex:
Code:

 EVALUATE TRUE                 
    WHEN  VARW  > 0
    WHEN  VARX   > 0
    WHEN  VARY   > 0
    WHEN  VARZ   > 0
         ADD 1 TO VARA
 END-EVALUATE
 

here VARA will be incremented if all the conditions satisfy or even if one condition satisfy ?

thanks
ganesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jul 10, 2006 4:06 am    Post subject: Reply with quote

gans79,

Read this topic which explains in detail about the evaluate statement

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/6.2.13?DT=20020920180651

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gans79
Beginner


Joined: 31 Aug 2005
Posts: 51
Topics: 27

PostPosted: Mon Jul 10, 2006 4:34 am    Post subject: Reply with quote

Hi kolusu,
I went through the topic , but i was not able to get a clear answer to my
question, can u let me know the answer to my question

thanks
ganesh
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Jul 10, 2006 5:04 am    Post subject: Reply with quote

gans79,

Try this code :
Code:

WORKING-STORAGE SECTION. 
01 VARA  PIC 9(1) VALUE 0.
01 VARW  PIC 9(1) VALUE 0.
01 VARX  PIC 9(1) VALUE 0.
01 VARY  PIC 9(1) VALUE 0.
01 VARZ  PIC 9(1) VALUE 1.
PROCEDURE DIVISION.             
0000-MAIN.                     
    EVALUATE TRUE               
    WHEN  VARW   > 0           
    WHEN  VARX   > 0           
    WHEN  VARY   > 0           
    WHEN  VARZ   > 0           
         ADD 1 TO VARA         
         DISPLAY 'VARA IS ' VARA
    WHEN OTHER                 
         DISPLAY 'OTHER'       
    END-EVALUATE.               

In this case VARW ,VARX and VARY are all set to 0 and if they are greater than 0 , no action is being taken whereas when VARZ is greater than 0 i am adding 1 to VARA and displaying it.So only condition when is satisfied is WHEN VARZ > 0.However if you initialize VARZ to 0 and try running the code , you will get the output displayed as OTHER because none of the WHEN conditions met for displaying anything.Hope this helps.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Elroy
Beginner


Joined: 30 Jun 2006
Posts: 4
Topics: 2

PostPosted: Mon Jul 10, 2006 8:12 am    Post subject: Reply with quote

It sounds like you just want to AND them together?


WHEN VARW > 0 AND VARX > 0 AND VARY > 0 AND VARZ > 0
Back to top
View user's profile Send private message
blitz
Beginner


Joined: 24 Dec 2002
Posts: 28
Topics: 4

PostPosted: Tue Jul 11, 2006 6:04 am    Post subject: Reply with quote

AND or OR?!?
Back to top
View user's profile Send private message
chandresha
Beginner


Joined: 20 Dec 2005
Posts: 1
Topics: 0

PostPosted: Thu Jul 13, 2006 6:48 am    Post subject: Reply with quote

Hi ,

This EVALUATE is equivalent to

If VARW > 0 OR VARX > 0 OR VARY > 0 OR VARZ > 0
ADD 1 TO VARA
END-IF.

Hope this helps !

Chandresh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group