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
 

 

Compare between a numeric (9(8)) and packed decimal(s9(9)

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

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Mon Aug 11, 2014 2:41 pm    Post subject: Compare between a numeric (9(8)) and packed decimal(s9(9)
Reply with quote

Is it possible to compare between a numeric (9(8)) and packed decimal(s9(9) comp-3) field in cobol with out any type casting?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Mon Aug 11, 2014 2:55 pm    Post subject: Reply to: Compare between a numeric (9(8)) and packed decima
Reply with quote

What do you mean by "type casting"? Give some specific examples.
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Mon Aug 11, 2014 4:07 pm    Post subject: Reply to: Compare between a numeric (9(8)) and packed decima
Reply with quote

Type casting means from numeric to char/alpha numeric or the vice versa..
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Aug 11, 2014 4:48 pm    Post subject: Reply to: Compare between a numeric (9(8)) and packed decima
Reply with quote

You can compare the two. However, keep in mind that if the COMP-3 field exceeds 99999999 (max value of the 8-byte display-numeric field), your compare may not work as expected.

The compiler will "PACK" the 8-byte display-numeric field into a COMP-3 work-field and a "Compare Decimal/Pack" (CP) instruction will be issued.

This is basic knowledge for any s.e. icon_eek.gif
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Mon Aug 11, 2014 5:23 pm    Post subject:
Reply with quote

Thanks...
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Mon Aug 11, 2014 6:09 pm    Post subject: Re: Reply to: Compare between a numeric (9(8)) and packed de
Reply with quote

Dhrubojoty mukherjee wrote:
Type casting means from numeric to char/alpha numeric or the vice versa..


Well if that's what it means (to you) then the question is moot in this case, is there is no "char/alpha numeric" involved.

The compare will not be a problem as is. Try it.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Aug 11, 2014 7:03 pm    Post subject:
Reply with quote

If you have not yet found it, the Enterprise COBOL Language Reference manual at http://publibfp.boulder.ibm.com/epubs/pdf/igy5lr11.pdf has a table of valid and invalid elementary variable moves (on pages 373 - 374 of the version 5.1 manual) under the MOVE statement discussion. This table tells you which moves are allowed in COBOL and should be consulted first -- if you had done so, you would have had your answer much earlier than through posting on this forum.

Also, COBOL does not use "type casting" as such -- the table of valid moves indicates any conversions that will be done.
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 Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


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