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 

Evaluate question

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


Joined: 14 Oct 2004
Posts: 62
Topics: 21

PostPosted: Fri Oct 07, 2005 1:48 am    Post subject: Evaluate question Reply with quote

Please look at the sample code..

Evaluate ws-1
when other
perform xyz
when 1
perform abc
End-evaluate

My question is which one gets executed first.

My answer would be when other, because execution will be from top to bottom.

Please let me know if you guys agrees with me.

Thanks.
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Fri Oct 07, 2005 2:13 am    Post subject: Reply with quote

have you compiled your program?
Back to top
View user's profile Send private message
Hilltop
Beginner


Joined: 14 Oct 2004
Posts: 62
Topics: 21

PostPosted: Fri Oct 07, 2005 2:29 am    Post subject: Reply with quote

This was an interview question, currently I don't do coding at my shop.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Oct 07, 2005 2:54 am    Post subject: Reply with quote

Hiltop,

You will end in a Compilation Error (RC 12). See the message below.
Code:

15  IGYPS2140-S   "OTHER" was found in a "WHEN" phrase of an "EVALUATE" statement.  The statement was discarded.
                                                                           
17  IGYPS2072-S   "WHEN" was invalid.  Skipped to the next verb, period or procedure-name definition.


There should be atleast 1 WHEN condition before issuing WHEN OTHER.

Here is the code
Code:

WORKING-STORAGE SECTION.                                     
01  WS-LITERALS.                                             
    05  WS-CNT                            PIC X(01) VALUE ' '.
    05  WS-EVALUATE-CNT                   PIC X(01) VALUE ' '.
PROCEDURE DIVISION.                                           
    MOVE '1' TO WS-CNT                                       
    MOVE WS-CNT  TO  WS-EVALUATE-CNT                         
                                                             
    EVALUATE WS-EVALUATE-CNT                                 
         WHEN  OTHER                                         
              DISPLAY 'OTHER ...'                             
         WHEN  '1'                                           
              DISPLAY '1....'                                 
    END-EVALUATE.                                             
    STOP RUN.                                                 


Thanks,
Phantom
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Fri Oct 07, 2005 3:20 am    Post subject: Reply with quote

exactly what I ment Wink
Back to top
View user's profile Send private message
Hilltop
Beginner


Joined: 14 Oct 2004
Posts: 62
Topics: 21

PostPosted: Fri Oct 07, 2005 4:02 am    Post subject: Reply with quote

Thanks a lot Phantom and Acevedo.
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