Page 1 of 1
How to Convert Decimal to binary
Posted: Mon Mar 02, 2009 3:45 am
by raj158347
Hi All,
Can please some help me , how to Convert the decimal value to binary in DS px?
Regards
Raj
Posted: Mon Mar 02, 2009 4:21 am
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.
Decimal to binay conversion
Posted: Mon Mar 02, 2009 4:32 am
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?
Posted: Mon Mar 02, 2009 1:20 pm
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.
Re: Decimal to binay conversion
Posted: Mon Mar 02, 2009 2:46 pm
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.
Posted: Mon Mar 02, 2009 3:21 pm
by chulett
"1010" is the
binary representation of a decimal 10... 8+2... not two 10s stuck together.
![Confused :?](./images/smilies/icon_confused.gif)
Posted: Mon Mar 02, 2009 4:57 pm
by ray.wurlod
More specifically:
1*8 + 0*4 + 1*2 + 0*1