Page 1 of 1

Decimal conversion

Posted: Fri Sep 23, 2016 9:25 am
by akshu.agni
Hi All,

I have created a generic job which reads the data from Teradata and creates a flat file.

The SQL i am placing in a file in unix and passing as a parameter to parallel job.

For the decimal columns in flat files, the values are starting with one blank space followed by decimal value.


Example:

"TRANS_NBR","ORDER_CUST_NBR","COST_AMOUNT"
"640124860","159884569"," 0000001.55"


Could you please help me how can i avoid space.


Regards,
Aks

Posted: Fri Sep 23, 2016 9:37 am
by chulett
It's a placeholder for the sign, space means a positive value. Does it actually hurt, cause an issue? My understanding is if you need to get rid of the space, you'd need to make the flat file target field a string. Or there may be an extended property to tell it that it is not signed. Not positive. No pun intended. :wink:

Posted: Fri Sep 23, 2016 12:35 pm
by akshu.agni
Hi,

The vendor asking us to remove the spaces for decimal field. Since its a generic job i am not able to remove space. Any work around which you can help me with.

Regards,
Aks

Posted: Fri Sep 23, 2016 1:02 pm
by chulett
Ah... 'generic job' as in RCP enabled. That complicates this. Let's see what others have to say, I'm wondering if that means some sort of post-processing task. :?

Posted: Mon Sep 26, 2016 6:42 pm
by ray.wurlod
You could use a Filter in your Sequential File stage to convert any instances of '" ' (double quote followed by space) into '"' (double quote not followed by space). Use a command such as sed or awk.

Posted: Tue Sep 27, 2016 5:26 am
by akshu.agni
Ray, I think this is the only option available. I will try this.

Thanks all for your suggestions.

Posted: Tue Sep 27, 2016 5:45 pm
by ray.wurlod
Well, no, you could use an after-job subroutine that invokes ExecSH to post-process the file or, if you are running the job from a sequence, a downstream Execute Command activity.