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

Convert HEX to Numeric


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PepeVil

New User


Joined: 12 Jan 2023
Posts: 2
Location: Spain

PostPosted: Thu Jan 12, 2023 5:51 pm
Reply with quote

Hello,

This sentence: SELECT HEX (3882121118447824) FROM SYSIBM.SYSDUMMY1;
gets: '000DCAC4C23D78D0'.

It is possible to get the opposite, ie from '000DCAC4C23D78D0' get 3882121118447824?

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

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Jan 12, 2023 6:13 pm
Reply with quote

Did you try to Google for this?
Code:
db2 built-in functions convert hex to decimal
Back to top
View user's profile Send private message
PepeVil

New User


Joined: 12 Jan 2023
Posts: 2
Location: Spain

PostPosted: Thu Jan 12, 2023 7:26 pm
Reply with quote

Of course I have looked in Google and I have seen that adhoc functions can be built but I want to know if there was any solution in which it is not necessary to create a new function, for example, as a combination of several already existing functions.

I have tried but so far I have not succeeded.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Jan 12, 2023 7:51 pm
Reply with quote

PepeVil wrote:
Of course I have looked in Google and I have seen that adhoc functions can be built but I want to know if there was any solution in which it is not necessary to create a new function, for example, as a combination of several already existing functions.

I have tried but so far I have not succeeded.

There is no standard built-in DB2 function to convert FROM HEX, because it is never required in normal SQL-related logic. It has been said clearly in multiple sources, found from Google, and others.

Those who cannot survive without this kind of conversion have created their own versions of "HEX2DEC" functions. I personally have found several examples after less than 5 minutes of googling... icon_exclaim.gif
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Convert Service Unit to CPU Seconds All Other Mainframe Topics 1
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top