DecimalToDecimal conversion in Transformer

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
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

DecimalToDecimal conversion in Transformer

Post by vijayrc »

Hi,
Searched for DecimalToDecimal, found few posts, but it isn't clear atleast for me, as I have to do the follwoing and struggling to get the right syntax [Transformer is what i'm using]

Field 1
Input Field : Decimal 12,1
Output Field Decimal 8,1

Field 2
Input Field: Decimal 12,0
Output Field: Decimal 9,0

Thanks,
Vijay
Last edited by vijayrc on Fri Jan 11, 2008 8:16 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You shouldn't need to do anything.

However DataStage will generate a warning to alert you that you can not fit all known Decimal(12,1) values into a Decimal(9,1) field.

If you know that you will be able to, because none of your Decimal(12,1) values has more than nine significant digits, then why not read the values in the first place as Decimal(9,1) - with a CAST, for example?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

If you are sure that the input data will fit into Decimal 8,1 and Decimal 9,0 for fields 1 and 2 respectively, then you can directly map them from source to target. However DataStage will generate a warning. And you can suppress the warning to informational from the Director log.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

Maveric wrote:If you are sure that the input data will fit into Decimal 8,1 and Decimal 9,0 for fields 1 and 2 respectively, then you can directly map them from source to target. However DataStage will generate a warning. And you can suppress the warning to informational from the Director log.
Yes..I'm getting Warnings, and I want to avoid those warnings instead of downgrading them to Informational, and hence this attempt.

Implicit conversion from source type "decimal[12,0]" to result type "decimal[9,0]": Possible range limitation.


Tried the following with Modify too, but it generates a warning:
Conversion from source type "decimal[15,2]" to result type "decimal[12,2]": Possible range limitation; rounding requested where no rounding possible.

New_Decimal_Field:Decimal[12,2] = decimal_from_decimal [round_inf] (Old_Decimal_Field)

Old_Decimal_Field is 15,2
New_Decimal_Field is 12,2
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add an extra Specification to the Modify stage. This new Specification contains the single word NOWARN.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ray.wurlod wrote:Add an extra Specification to the Modify stage. This new Specification contains the single word NOWARN. ...
Thanks Ray..That worked w/o a warning. But I have to introduce a Modify just for this in my stream. If you could suggest something in a Transformer, that would be great. I'm still trying on making transforming transformation of this decimal conversion
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I am unaware of any mechanism for preventing Transformer stage from generating warnings.

I had assumed, because you said "tried the following with Modify too" that you had a Modify stage in the job. Well, now you do. Leave it there - it doesn't eat much.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ray.wurlod wrote:I am unaware of any mechanism for preventing Transformer stage from generating warnings.

I had assumed, because you said "tried the following with Modify too" that you had a Modify stage in the job ...
Thanks Ray for your input. I just tried having a Modify for this purpose, to eliminate the warning and to see if it works. Now that it works with your suggestion of NOWARN, I would either let it stay there just for warning suppression or go with Message Handler to suppress this warning.

Still hanging on to find a solution with a transformer as I have one along the way in my job stream

Thanks again for all your help inDS community
Post Reply