Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

comparing comp-3 and unpacked numbers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
juares castro

New User


Joined: 04 May 2012
Posts: 18
Location: Brazil

PostPosted: Mon May 30, 2016 6:46 pm    Post subject: comparing comp-3 and unpacked numbers
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Mon May 30, 2016 7:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 18
Location: Brazil

PostPosted: Tue May 31, 2016 6:30 am    Post subject:
Reply with quote

Thanks a lot Robert!
I will read COBOL Language Reference manual as You said.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jun 01, 2016 2:25 am    Post subject:
Reply with quote

Why not try and learn and that's quicker than anything unless you need a rapid answer for an interview question? icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us