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

Regarding Compare, how 65 > 55


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Fri Feb 01, 2008 1:11 pm
Reply with quote

Hi All,
I i have one element a pic x(30) and second also b pic x(30) and i am comparing both as
if a < b
display 'Y'
Else
display 'N'

In my case a = 0000000000650000 and b = 55
but compare is passing and displaying 'Y', could anyone let me know how as 65 > 55 so it should display 'N'.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2008 1:14 pm
Reply with quote

read the considerations for the comparison of chars

the content of the two filds might be left aligned, so ...
"00......" is certianly less than "55....."
Back to top
View user's profile Send private message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Fri Feb 01, 2008 1:21 pm
Reply with quote

Thanks enrico...
so either of two....
1)0000000000650000 and 0000000000550000
or
2)65 and 55
right???
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2008 1:23 pm
Reply with quote

Yes !

for char variables it is Your responibility to provide the proper alignement
and format consistency
Back to top
View user's profile Send private message
mnnarayankar

New User


Joined: 21 Jan 2008
Posts: 23
Location: bangalore

PostPosted: Mon Feb 04, 2008 1:19 pm
Reply with quote

Hi Jackal,


If u consider as a Alphabetic and Alphanumeric,
then both are the left justified field.

and Numeric is the Right justified.

As per your doubt



a pic x(30)
a = 0000000000650000


b pic x(30)
b = 55

if a < b
display 'Y'
Else
display 'N'

ya its true B > A

because A=55 and A=00

means A < B

Ans is 'Y'.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Compare two files with a key and writ... SYNCSORT 3
No new posts Compare latest 2 rows of a table usin... DB2 1
Search our Forums:

Back to Top