IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

comparing 2 numbers in cobol without using If statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Sat Oct 11, 2008 9:37 am
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
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

Moderator Emeritus


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

PostPosted: Sat Oct 11, 2008 11:08 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Oct 11, 2008 3:44 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Oct 11, 2008 3:47 pm
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: 8797
Location: Welsh Wales

PostPosted: Sat Oct 11, 2008 3:56 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top