Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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 -> Mainframe COBOL
Author Message
umesh khadaria

New User


Joined: 11 Sep 2008
Posts: 3
Location: pune

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
References
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 9192
Location: 221 B Baker St

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: pune

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

Global Moderator


Joined: 23 Nov 2006
Posts: 9192
Location: 221 B Baker St

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: pune

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: 3273
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: 3273
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: 3731
Location: Brussels once more ...

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: 1027
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1