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: 7251

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: 7932
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: 10211
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: 7251

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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm


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