How to convert hexadecimal value to decimal in data stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
radhika7983
Participant
Posts: 16
Joined: Wed Apr 07, 2010 10:44 pm

How to convert hexadecimal value to decimal in data stage

Post by radhika7983 »

Hi, I have a requirement where I need to convert hexadecimal value coming from source to Decimal in the target.
Suppose if the source value is X'0055', than the target should be 85. Can some one suggest? Should we do it by calculations, like dividing by 16 and than considering the remainder and quotient? Or is there any other way?

Thank You
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... what is your literal source value? In your example, would it be 55 or literally the X'0055' string you've shown?
-craig

"You can never have too many knives" -- Logan Nine Fingers
elias.shaik
Participant
Posts: 51
Joined: Sat Dec 09, 2006 3:32 am

Post by elias.shaik »

if the source is a table then you can use sql funtions to convert hexadecimal to decimal in a better way.
------------
Elias
mnayer
Participant
Posts: 3
Joined: Mon Jun 25, 2007 9:06 am

Re: How to convert hexadecimal value to decimal in data stag

Post by mnayer »

radhika7983 wrote:Hi, I have a requirement where I need to convert hexadecimal value coming from source to Decimal in the target.
Suppose if the source value is X'0055', than the target should be 85. Can some one suggest? Should we do it by calculations, like dividing by 16 and than considering the remainder and quotient? Or is there any other way?

Thank You
Actually you can create a simple c function and a routine to be used in a transformation stage.

M. Nayer
Post Reply