Decimal conversion

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
akshu.agni
Participant
Posts: 17
Joined: Tue Jan 25, 2011 5:24 am
Location: Bangalore

Decimal conversion

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

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
akshu.agni
Participant
Posts: 17
Joined: Tue Jan 25, 2011 5:24 am
Location: Bangalore

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

Post 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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
akshu.agni
Participant
Posts: 17
Joined: Tue Jan 25, 2011 5:24 am
Location: Bangalore

Post by akshu.agni »

Ray, I think this is the only option available. I will try this.

Thanks all for your suggestions.
Aks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply