How to suppress zero for decimal field in RCP enabled jobs

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
swapna07
Participant
Posts: 22
Joined: Fri Mar 08, 2013 11:29 am
Contact:

How to suppress zero for decimal field in RCP enabled jobs

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
swapna07
Participant
Posts: 22
Joined: Fri Mar 08, 2013 11:29 am
Contact:

Post by swapna07 »

Hi Ray,

I was not able to see your complete reply. Can you please post it separately.

-Swapna
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
swapna07
Participant
Posts: 22
Joined: Fri Mar 08, 2013 11:29 am
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure, that would be one solution.
-craig

"You can never have too many knives" -- Logan Nine Fingers
swapna07
Participant
Posts: 22
Joined: Fri Mar 08, 2013 11:29 am
Contact:

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As Ray noted, not if you insist on using RCP throughout. That's the nature of the beast.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koti9
Participant
Posts: 52
Joined: Wed Nov 09, 2005 10:51 am

Post 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
weiyi_will
Participant
Posts: 10
Joined: Sun Aug 11, 2013 10:46 pm
Location: Dalian

Post by weiyi_will »

Yes,use varchar instead of decimal on the DB connector stage, will have no leading zero
Post Reply