Decimal Calculation problem

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
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Decimal Calculation problem

Post by abc123 »

I am trying to do a decimal calculation and write to a decimal and/or char column (I have tried both types). I get a value of
all 0s. My incoming column values are IncomingCol1 =1 and IncomingCol2=1000. I have tried with other values as well such as
2,7 and 12. I still get all 0s. I also tried:

DecimalToString(DecimalToDecimal( (DecimalToDecimal(IncomingCol1) / DecimalToDecimal(IncomingCol1)), "round_inf") * 100)
and
DecimalToString(DecimalToDecimal( (DecimalToDecimal(IncomingCol1) / DecimalToDecimal(IncomingCol1)), "round_inf") * 100, "trunc_zero")

The 2nd one errored out. Any ideas?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Why are you doing decimaltodecimal conversion again? Doesnt just dividing the two columns and getting the percentage work?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

I tried that. It doesn't work. I have a previous situation where DecimalToDecimal made it work. Without DecimalToDecimal, I get all blanks. By the way, my incoming columns are CHAR data types.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

What I meant was, I did something similar and it worked when I used to DecimalToDecimal. Would appreciate any help. Thanks.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

How about StringToDecimal() instead of DecimalToDecimal() for CHAR fields?
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

All I get is blanks when I use StringToDecimal. It was the first thing I tried.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you post a specific example of a string and the StringToDecimal call? If you got that working correctly, perhaps the rest would fall into place as well.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Actually, proper data was being produced. I could not see it because I used decimal as the output type. When I put in float(10,5), I could see the data. Thanks for your help.
Post Reply