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 

number is even or odd
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 11, 2006 4:57 am    Post subject: Reply with quote

Iknow

Good one. But why pretend if you already knew the answer?

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


Joined: 09 Jan 2006
Posts: 39
Topics: 15
Location: Inside the MATRIX

PostPosted: Wed Jan 11, 2006 5:01 am    Post subject: Reply with quote

Hi Kolusu,

Today only I found the answer. If I knew the answer already I would have posted it in Mainframe Challenge.


Thanks for your support.
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Wed Jan 11, 2006 1:18 pm    Post subject: Reply with quote

Code:

       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.                       COB1.                         
       AUTHOR.                           DTF.                           
       ENVIRONMENT DIVISION.                                           
       CONFIGURATION SECTION.                                           
       SOURCE-COMPUTER.  IBM-390.                                       
       OBJECT-COMPUTER.  IBM-390.                                       
       DATA DIVISION.                                                   
       WORKING-STORAGE SECTION.                                         
       01  TEST-FIELDS.                                                 
           05  ODD                    PIC 9(4) VALUE 123.               
           05  EVEN                   PIC 9(4) VALUE 124.               
       PROCEDURE DIVISION.                                             
           IF ((ODD / 2) * 2) = ODD                                     
              DISPLAY 'ODD TEST FAILED'                                 
           ELSE                                                         
              DISPLAY 'ODD TEST WORKED' 
           END-IF                               
           IF ((EVEN / 2) * 2) = EVEN                     
              DISPLAY 'EVEN TEST WORKED'                 
           ELSE                                           
              DISPLAY 'EVEN TEST FAILED'
           END-IF
               
           GOBACK.                                       


This seems to work and displays:
ODD TEST WORKED
EVEN TEST WORKED
________
Continental Mark V


Last edited by dtf on Tue Feb 01, 2011 2:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 11, 2006 1:24 pm    Post subject: Reply with quote

dtf,

The trick here is NOT to use any conditional Statements.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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
Goto page Previous  1, 2
Page 2 of 2

 
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