ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Hexadecimal value of a decimal in ESQL ?

Post new topic  Reply to topic
 Hexadecimal value of a decimal in ESQL ? « View previous topic :: View next topic » 
Author Message
my_mqmb
PostPosted: Sat May 12, 2012 12:59 am    Post subject: Hexadecimal value of a decimal in ESQL ? Reply with quote

Voyager

Joined: 08 Jun 2011
Posts: 84

How do i convert hexadecimal value of a decimal in ESQL ?

like for example :

15 should be represented as F.

any 1 can help me with the code snippet ?

Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun May 13, 2012 5:26 am    Post subject: Re: Hexadecimal value of a decimal in ESQL ? Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

my_mqmb wrote:
How do i convert hexadecimal value of a decimal in ESQL ?

like for example :

15 should be represented as F.

any 1 can help me with the code snippet ?



Can you be more specific to what you are trying to do?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
my_mqmb
PostPosted: Sun May 13, 2012 11:05 pm    Post subject: Re: Hexadecimal value of a decimal in ESQL ? Reply with quote

Voyager

Joined: 08 Jun 2011
Posts: 84

fjb_saper wrote:


Can you be more specific to what you are trying to do?



I am trying to convert length of some string which is in integer value to its HEX equivalent ..

decimal to hex conversion ...

if the length is 15 i need the hex_length to be 'F'

how to convert using esql (not java)
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Sun May 13, 2012 11:19 pm    Post subject: Re: Hexadecimal value of a decimal in ESQL ? Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Either write a custom FUNCTION ...

which does the transformation based on an (input) CHAR/INT (and on the individual characters/integers (use the SUBSTRING function))...

... or probably you can use the ASBITSTREAM or CAST function.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 14, 2012 12:28 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

'hex' is an overloaded word. It can mean
a) a string containing the characters '0'..'9','A'..'F' with each pair of characters representing a byte value or
b) a raw byte value interpreted as a number using the twos-complement encoding. Can be little-endian or big-endian if the number is multi-byte.

Which do you want?
Back to top
View user's profile Send private message
my_mqmb
PostPosted: Mon May 14, 2012 12:51 am    Post subject: Reply with quote

Voyager

Joined: 08 Jun 2011
Posts: 84

kimbert wrote:
'hex' is an overloaded word. It can mean
a) a string containing the characters '0'..'9','A'..'F' with each pair of characters representing a byte value or
b) a raw byte value interpreted as a number using the twos-complement encoding. Can be little-endian or big-endian if the number is multi-byte.

Which do you want?



thanks kimbert for your reply..

what i need is option (b) where i am converting the value of the whole integer into hexadecimal form .

(not representing each pair of character in a string)
Back to top
View user's profile Send private message
my_mqmb
PostPosted: Mon May 14, 2012 12:56 am    Post subject: Re: Hexadecimal value of a decimal in ESQL ? Reply with quote

Voyager

Joined: 08 Jun 2011
Posts: 84

mqsiuser wrote:
Either write a custom FUNCTION ...

which does the transformation based on an (input) CHAR/INT (and on the individual characters/integers (use the SUBSTRING function))...

... or probably you can use the ASBITSTREAM or CAST function.


i have written a custom function to convert using 16 as the divisor for HEXADECIMAL.

but i need to know how it could be possible using ASBITSTREAM or CAST ?

when i use asbitstream it will treat it character by character which i dont want .
say for example 53 is represented in blob as X'0503'
what i need is its hexadecimal value ie 35
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 14, 2012 1:24 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Have you tried this?
Code:
CAST myInteger AS BLOB
Back to top
View user's profile Send private message
my_mqmb
PostPosted: Mon May 14, 2012 2:32 am    Post subject: Reply with quote

Voyager

Joined: 08 Jun 2011
Posts: 84

kimbert wrote:
Have you tried this?
Code:
CAST myInteger AS BLOB


hmmm , thnx pretty straightforward !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Hexadecimal value of a decimal in ESQL ?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.