View previous topic :: View next topic
|
Author |
Message |
jackal Currently Banned New User
Joined: 21 Jan 2006 Posts: 48 Location: india
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
jackal Currently Banned New User
Joined: 21 Jan 2006 Posts: 48 Location: india
|
|
|
|
Thanks enrico...
so either of two....
1)0000000000650000 and 0000000000550000
or
2)65 and 55
right??? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Yes !
for char variables it is Your responibility to provide the proper alignement
and format consistency |
|
Back to top |
|
|
mnnarayankar
New User
Joined: 21 Jan 2008 Posts: 23 Location: bangalore
|
|
|
|
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 |
|
|
|