View previous topic :: View next topic
|
Author |
Message |
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Hi everyone!
Is the comparison between COMP-3 numbers against unpacked numbers OK?
I mean, if We have, for example:
a-field 9(5) COMP-3 and
b-field 9(5)
Could We compare easily: IF a-field = b-field ...
without move one of them to the same PIC of compared field in Cobol program?
Thanks in advance. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Have you read the Enterprise COBOL Language Reference manual on numeric comparisons? If not, why not -- it has almost all the answers you could possibly want on how COBOL works on the mainframe. If you did read that, did you not see this on page 272 of the version 6.1 COBOL manual (emphasis added by me):
Quote: |
Numeric comparisons
A numeric comparison is a comparison of the algebraic value of two operands of
class numeric.
When the algebraic values of numeric operands are compared:
v The length (number of digits) of the operands is not significant.
v The usage of the operands is not significant.
v Unsigned numeric operands are considered positive.
v All zero values compare equal; the presence or absence of a sign does not affect
the result.
The behavior of numeric comparisons depends on the settings of the NUMPROC
and ZONEDATA compiler options. For details, |
|
|
Back to top |
|
|
juares castro
New User
Joined: 04 May 2012 Posts: 34 Location: Brazil
|
|
|
|
Thanks a lot Robert!
I will read COBOL Language Reference manual as You said. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Why not try and learn and that's quicker than anything unless you need a rapid answer for an interview question? |
|
Back to top |
|
|
|