IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to compare two different Hex Values in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 07, 2012 8:05 pm
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 07, 2012 8:10 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 07, 2012 8:20 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 07, 2012 8:41 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top