Page 1 of 1
How to suppress zero for decimal field in RCP enabled jobs
Posted: Wed Nov 12, 2014 2:27 am
by swapna07
Hi All,
I have a RCP enabled jobs for dynamic DB tables. So for every run my table changes. There are some tables which has decimal field and my output is a sequential file. I need to find a way to suppress zero for these fields either at job or sequencer level. Also I am not using schema file.
Can anyone help?
Regards,
Swapna
Posted: Wed Nov 12, 2014 4:13 pm
by ray.wurlod
Not if you insist on using RCP throughout.
If you want to apply a transformation to a column, you need to name the column (field).
DataStage adds leading and trailing non-significant zeroes to Decimal numbers to assert/prove the precision and scale values. This behaviour is not (currently) negotiable.
Posted: Thu Nov 13, 2014 12:48 am
by swapna07
Hi Ray,
I was not able to see your complete reply. Can you please post it separately.
-Swapna
Posted: Thu Nov 13, 2014 1:24 am
by ArndW
The important part is visible.
You could, perhaps, post-process your text file to remove these zero-valued decimals using awk, sed or some other program.
Posted: Thu Nov 13, 2014 6:55 am
by swapna07
Hi ,
Do you mean to use sed/awk command in execute command stage at sequencer level. Just wanted to confirm as these are RCP jobs.
Thanks in advance.
Posted: Thu Nov 13, 2014 7:37 am
by chulett
Sure, that would be one solution.
Posted: Thu Nov 13, 2014 7:59 am
by swapna07
As I have dynamic tables in the RCP job. So I assume, I will have to read each and every schema file with proper table structure to get decimal field and use sed/awk command to suppress these zeros. And all this activity has to be included in a loop at sequencer.
This seems to be a tough approach
Just by chance , can we have other workaround for this ?
Regards,
Swapna
Posted: Thu Nov 13, 2014 8:03 am
by chulett
As Ray noted, not if you insist on using RCP throughout. That's the nature of the beast.
Posted: Thu Jul 23, 2015 7:09 am
by koti9
Hello,
Reading it as String in Schema file and loading it Number Field in target (Implicit Conversion)....Eliminated the leading zero's. But you will see a warning in the director log.
Thanks & Regards
Koti
Posted: Sun Jul 26, 2015 6:35 pm
by weiyi_will
Yes,use varchar instead of decimal on the DB connector stage, will have no leading zero