Decimal to String

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

ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To me, "keeping" in this context means "transferring into the result". Perhaps "using" would have been a better participle.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I agree. Being anal, the function only 'keeps' the delimiter if you tell it to return multiple delimited substrings and then only between the instances. So 'using' would have been more accurate. And to continue the theme:
ssnegi wrote:So the field operator does use the . as delimiter for extracting from a decimal.
That wasn't what was being discussed, especially since you specified a period as the delimiter. It was the question 'does the function work with a decimal' and the answer is still officially 'no' according to the documentation. And for all we know that only 'works' in your specific version, something thing we've seen before.

We've seen plenty of examples here where people think something is working as they'd like when in fact they are taking advantage of a bug... and then a future update closes the loophole and things 'mysteriously' break. So I would suggest rather than posting something like that, take the time to use the function properly inside the Field function. That would make it 'future proof'.
-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 »

Actually, in this specific case, there is probably an implicit conversion performed from decimal to string, since the Field() function requires a string data type as its first argument.

I prefer not to rely upon implicit conversions in parallel jobs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I was assuming the same thing, only way I can see it working. And like you I try not to rely on implicit conversions... unless we are talking Server jobs, of course. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Post by ssnegi »

Code: Select all

DecimalToString(Field(DecimalToString(DSLink.COL),'.',1),"suppress_zero"):'.':Field(DecimalToString(DSLink.COL),'.',2) 
This will convert the decimal to String before the field function call.
Post Reply