Page 1 of 1

How to handle string"000000000000000000000000000"

Posted: Thu Dec 10, 2009 5:17 am
by kaushal.kumar@igate.com
Hi ,
in my job input is a sequential file(output of some other job).One of the field is decimal(4,16).For null value this field takes "0000000000000"(16 zero).I need to handel this zero and make it as 0.Please advice me how to do this.

Posted: Thu Dec 10, 2009 5:28 am
by LavanyaRamesh007
Hi ,

If your requirement is to handle just a fixed width string "000000000000000000000000000"
then just add a simple if INPUT_VALUE="000000000000000000000000000" then 0 else INPUT_VALUE

Posted: Thu Dec 10, 2009 6:15 am
by chulett
That zero already is a zero - simply moving it to a number field should "handle" it just fine. What issue are you having? :?

Posted: Thu Dec 10, 2009 3:57 pm
by ray.wurlod
All zeroes is not, by default, legal for Decimal data type.

There is something you can set (environment variable?) that allows DataStage to accept all zeroes for a decimal number.

Posted: Thu Dec 10, 2009 4:22 pm
by chulett
That sounds vaguely familiar but no clue where that setting would be. Would not "math" also fix that, for example multiplying by 1?

Posted: Thu Dec 10, 2009 4:42 pm
by ray.wurlod
It's the fix_zero argument to the conversion functions.
Parallel Job Developer's Guide p628 wrote:By default decimal numbers comprising all zeroes are treated as invalid. If the string fix_zero is specified as a second argument, then all zero decimal values are regarded as valid.

Posted: Thu Dec 10, 2009 9:48 pm
by chulett
Ah... that's why it sounded vaguely familiar - you're talking PX and this is a Server issue. Perhaps even a Server non-issue.

Posted: Thu Dec 10, 2009 11:15 pm
by ray.wurlod
:oops:

Posted: Sat Dec 12, 2009 12:14 pm
by kaushal.kumar@igate.com
Thanks for help.I have to check my job once i will be in office on monday and let you know wheather my problem is resolved or not.