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

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: 8120
Location: East Dubuque, Illinois, USA

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: 10276
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: 7315

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 BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


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