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
 

 

comparing 2 numbers in cobol without using If statement

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

New User


Joined: 11 Sep 2008
Posts: 3
Location: india

PostPosted: Sat Oct 11, 2008 9:30 am    Post subject: comparing 2 numbers in cobol without using If statement
Reply with quote

I want to write a cobol code for comparinig 2 numbers but not to use any if condition. can anyone crack this?????
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Oct 11, 2008 9:37 am    Post subject:
Reply with quote

Hello and welcome to the forum,

You could use EVALUATE.
Back to top
View user's profile Send private message
umesh khadaria

New User


Joined: 11 Sep 2008
Posts: 3
Location: india

PostPosted: Sat Oct 11, 2008 11:00 am    Post subject:
Reply with quote

I dont want to use any conditions. is there any code so that by using on compute verb we can do this.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Oct 11, 2008 11:08 am    Post subject:
Reply with quote

Hello,

Maybe it will help if you describe exactly what you are wanting to accomplish.

Quote:
I dont want to use any conditions.
Of course you do - if we can believe your original post.
Quote:
code for comparinig 2 numbers
.

If you are playing some technical puzzle game, it would be good to mention this. This is most likely not for any business requirement.

Once we understand better, we may be able to provide other suggestions.
Back to top
View user's profile Send private message
umesh khadaria

New User


Joined: 11 Sep 2008
Posts: 3
Location: india

PostPosted: Sat Oct 11, 2008 12:45 pm    Post subject:
Reply with quote

sure its a technical puzzle...
suppose i have 2 numbers A and B.
i want to find out which is greater. i cant use IF and Evaluate Statement.
one way i had found is sort them in a file and check there occurence.
is there any arithmatic computation by which we can achieve this..
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Sat Oct 11, 2008 3:44 pm    Post subject: Reply to: comparing 2 numbers in cobol without using If stat
Reply with quote

... at the end of the string, You will find some kind of comparison,
( sort will have to compare things )

the only way to get away with it, given that the numbers are in the proper format,
is good old assembler, many arithmetic and load operations operation will set the condition code

I' ll leave to You to find out all the different behaviors,
two positive, two negatives, one of each
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Sat Oct 11, 2008 3:47 pm    Post subject: Reply to: comparing 2 numbers in cobol without using If stat
Reply with quote

if it is a puzzle, You should have posted in a different forum
and be ready after a while to post also the answer....
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Sat Oct 11, 2008 3:56 pm    Post subject:
Reply with quote

Maybe HOMEWORK is a better description of the thread.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Oct 11, 2008 10:17 pm    Post subject:
Reply with quote

Try Subtraction!
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


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