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
 

 

How to compare two different Hex Values in Cobol

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

New User


Joined: 30 Jun 2010
Posts: 9
Location: noida

PostPosted: Tue Feb 07, 2012 7:59 pm    Post subject: How to compare two different Hex Values in Cobol
Reply with quote

Hi,

I want to comapre two different Hex values. Can someone please help on this.

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Tue Feb 07, 2012 8:05 pm    Post subject: Reply to: How to compare two different Hex Values in Cobol
Reply with quote

I'm sure someone can, if you give sufficient information for someone to do so.

Show us what you are trying, and the problem you have. With what you've provided so far, we haven't a clue.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Feb 07, 2012 8:10 pm    Post subject:
Reply with quote

I would recommend using the IF statement. Further than that, however, would depend upon details you did not provide.
Back to top
View user's profile Send private message
daga.aditya

New User


Joined: 30 Jun 2010
Posts: 9
Location: noida

PostPosted: Tue Feb 07, 2012 8:16 pm    Post subject: Reply to: How to compare two different Hex Values in Cobol
Reply with quote

Actually i have a correlation id which is coming from powerbuilder. Whenever this correlation id has Hex values such as '9F' it gets converted to '3f' at the time db2 insertion since db2 doesnot support these values.

Solution i am trying to implement is i will compare the correlation id sent initially by PB and the one inserted in Db2. if there is a difference then i will use the one sent by PB.

Hope this helps.

Thanks.
Aditya.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Feb 07, 2012 8:20 pm    Post subject: Reply to: How to compare two different Hex Values in Cobol
Reply with quote

if You already know that the values are different no need to compare them icon_biggrin.gif

apart pulling Your leg
remember that everything is hex inside a <cpu>
the difference is on how to interpret it

x'0c' ==> packed decimal 0
x'0c' ==> binary equivalent of a decimal 12 ( signed or unsigned )

x'F1' ==> char "1"
x'F1' ==> unsigned binary for decimal 241
x'F1' ==> signed binary for -15 ( unless I made a silly mistake )

so hex value is a pretty meaningless definition
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Tue Feb 07, 2012 8:41 pm    Post subject: Reply to: How to compare two different Hex Values in Cobol
Reply with quote

Code:
If A = B, use B
 else use A


is the same as

Code:
use A


I don't understand the "not support" part.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Feb 07, 2012 8:46 pm    Post subject: Re: Reply to: How to compare two different Hex Values in Cob
Reply with quote

daga.aditya wrote:
A Whenever this correlation id has Hex values such as '9F' it gets converted to '3f' at the time db2 insertion since db2 doesnot support these values.


What is the definition of the column in DB2 that you are trying to insert this mystery char into, if it is char or varchar DB2 will accept any of the 256 possible values that a byte can contain.
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm


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