Comma to Decimal Point Substitution

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Comma to Decimal Point Substitution

Post by asitagrawal »

Hi Friends,

In my database, the Decimal values use comma(,) instead of deciaml points (.).
The values when read in DataStage hence treated as String (e.g -15,89 which actualy is -15.89).

How do I convert the comma into decimal??

Thx.
swarnkar
Participant
Posts: 74
Joined: Wed Jan 11, 2006 2:22 am

Re: Comma to Decimal Point Substitution

Post by swarnkar »

[quote="asitagrawal"]Hi Friends,

In my database, the Decimal values use comma(,) instead of deciaml points (.).
The values when read in DataStage hence treated as String (e.g -15,89 which actualy is -15.89).


Hi Asit,

You can use following function

Ereplace(Arg1,char(44),char(46))

Arg1 is the field name it will return the desired values.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I believe you'll find that no decimal placeholder character is stored at all; it is applied when extracting decimal data from the database. The fact that it is a comma suggests that you are in a European locale.

If you are running DataStage with NLS enabled, you can set your locale differently.

The answer posted by swarnkar will work, too, because inside DataStage there are no data types; your decimal number can be treated as a string. Convert() is a more efficient function than Ereplace() for this task, however.

But are "." characters really correct? Just because they're what you want, why is it that the owner of the data chooses to represent them as comma? Is it because that's the naturally expected representation there? In your position I'd check that before unilaterally converting to ".".
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