Multiplication with -1 in Transformer

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
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Multiplication with -1 in Transformer

Post by nkln@you »

I have a i/p link variable A in transformer and I doing a derivation
as A*-1. (i.e i need to negate the vaue of A)

When value of A is 0.00999, A*-1 is giving result as 0. Whereas only A is giving , it is giving 0.00999.

Why am I getting a value of 0 when it is multipled by -1.

Any solution for this.
Aim high
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

I tried using -A. Still the output value is 0.
Aim high
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

nkln@you

Can you please tell us what is the Data Type you have been using for the derivation(Target).

If you have you the appropriate data type then you should get the -ve value

I believe you are using an inappropriate data type so the solution is becoming as 0 (no precision added )
Regards,
Shree
785-816-0728
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

The datatype in database is number. In Transformer it is decimal, lenght =38, display=40
Aim high
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What data type are you using in DataStage? This behaviour might occur, for example, if you were using an unsigned numeric or an inappropriate scale value. Are any warnings logged?
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 »

Scale? Same thing happens if you multiply by +1, yes?
-craig

"You can never have too many knives" -- Logan Nine Fingers
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

Ray,

The datatype in Datastage is decimal whose lenght is 38 , display is 40, no value for scale. There are no errors or warnings in logs.



Chulett,

Yes, Chullet even when I multiplied with +1 it is giving a value of 0. Only when it is directly mapped, I am getting original values. This is wierd.

What's wrong with my code
Aim high
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ill highlight Craig's suggestion, SCALE. Fix the scale.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's not weird. You've had two people asked about the value you were using for scale - don't you think that's a big clue? :P
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry, three people. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

Yes,

Sorry that I could not grab the issue in Scale. I changed my datatype in database from NUMBER to NUMBER(38,12). Now I am getting the required output.

I have a small doubt . even NUMBER should accept Decimal digits right?
Aim high
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

NUMBER with precision will accept decimal. Without precision will just be an integer.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Please make the post Green
Post Reply