Placing a constraint 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
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

Placing a constraint in transformer

Post by RAJEEV KATTA »

I have a scenario where in I have to pass the records to output if the input field value is not a whole no for ex-:5678.00 or 5678.01.I extracted the mantissa from decimal and said if num(extracted value)=1 then pass the record but there are input records like 5678. & the mantissa value is getting extracted as 0 instead of blank which is creating problem.What function is best to resolve this issue.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Give examples. The mantissa of 5768.01 should be 576801 or 5.76801, depending on the convention you are using, never 1 or 0.

Reading between the lines, it appears that you need to compare the original number with itself having had a Floor() function applied.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

Post by RAJEEV KATTA »

The example of 5678.01 the mantissa should be 01 the values after decimal.
ds

Post by ds »

When you say 'num(extracted value)=1', do you mean the condition as
num(extracted value)=TRUE :?:

Also, the extracted value you get is NULL, is this the case when mantissa is 0 only or always ? In case it is NULL, only when the mantissa is supposed to be 0, you can create a basic routine to convert a NULL to zero and use it there...something as the one below:

Code: Select all


      If ( IsNull(InputNumber) Or (Len(Trim(InputNumber)) = 0) ) Then
         Ans = 0
      End Else
         Ans = InputNumber
      End

RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

Post by RAJEEV KATTA »

If the value is 5678.00 or 5678. then the value turns out to be 0.But I want to send the output only when it is not a whole number like "5678.00' and not "5678.".
ds

Post by ds »

Do we have the following as two different cases:

1) 5678.00
2) 5678.

:?: :?: :?:

I mean if it is a decimal datatype defined on the field, do you really have data with a decimal point and without a mantissa (as in the second case above) ?
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

Post by RAJEEV KATTA »

The input field datatype is varchar but as to your question the second one can have data without mantissa I mean 5678. What I am actually looking is if the input is not a whole no I need to pass it to output.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That is the strangest definition of mantissa that I have ever encountered, and I believe it to be wrong.

If the field is a string, use Field(InLink.TheField, ".", 2, 1) to identify that component following the decimal placeholder ("." assumed) and compare that against zero.

If the field is a decimal, use Floor() to compute that part to the left of the decimal placeholder, subtract that from the original value, and compare the result to zero.

If the field is a float or a dfloat then you have an issue because, under the IEEE conventions for storing floating point numbers, exact representation can not be guaranteed - you could try converting to decimal and proceeding as above, but no promises.

In my understanding, mantissa and exponent are most easily explained when the number is represented using scientfic notation. The mantissa is that part to the left of the "E", the exponent is that part to the right. For example 5678.01 is 5.67801E03; the mantissa is 5.67801 and the exponent is 3. Or, if 5678.01 is represented as 567801E-02 then the mantissa is 567801 and the exponent is -2.
Last edited by ray.wurlod on Fri Jan 11, 2008 6:26 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ds

Post by ds »

Indeed :?

Why would you need to have a decimal point if there is no mantissa and just a characteristic defined to it ?

I mean this is a whole number in itself :?:

- James
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Looked up the term as I hadn't heard it used like this.

http://en.wikipedia.org/wiki/Mantissa

Also found this:

http://en.wikipedia.org/wiki/Significan ... antissa.22

Doesn't really help, just thought it was interesting enough to share. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply