How to Convert Decimal to binary

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
raj158347
Participant
Posts: 26
Joined: Thu Apr 19, 2007 5:15 am
Location: Chennai

How to Convert Decimal to binary

Post by raj158347 »

Hi All,
Can please some help me , how to Convert the decimal value to binary in DS px?


Regards
Raj
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why?

What kind of "binary"? After all, every decimal number is already in a binary form within DataStage.

Do you need some form of "packed decimal", or perhaps binary coded decimal representation?

I guess the easiest way is to write via a Complex Flat File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
raj158347
Participant
Posts: 26
Joined: Thu Apr 19, 2007 5:15 am
Location: Chennai

Decimal to binay conversion

Post by raj158347 »

Hi Ray,
Thanks for your quick response,
Actually i am getting input value as decimal and i need to convert binary for business logic,
Eg: Input is 10
Output 1010

Is there any build in functuion?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

None of which I am aware in parallel Transformer stage. You could readily write your own. You could use Oconv() with "MB" in a BASIC Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Re: Decimal to binay conversion

Post by bollinenik »

Hi Raj,
If you can pass business logic so that I can help you out.
as per your example: INput is 10 and Output is 1010
Does it mean what ever input is there you just need to concatinate the same value again to the input value , If you can explain it clearly I can help you out.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

"1010" is the binary representation of a decimal 10... 8+2... not two 10s stuck together. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

More specifically:
1*8 + 0*4 + 1*2 + 0*1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply