Page 1 of 1

Decimal value reading issue

Posted: Wed Oct 17, 2007 11:48 pm
by Amit Jaiswal
Hi,

I have column-x as decimal(21) in the source and decimal(21,4) in the target. I am reading it from ASCII format sequential file and storing into ASCII sequential file. This is nullable column and inside a source actualvalue for this column is .01. However, I am assuming that since I am reading this column as decimal(21), it should truncate the 0.01 and only pass the value before decimal to output column. But it is addting
0.01 also in the output. Can anyone tell me why this is happening? Is there anyway to ignore zero if we mention decimal(m,0)? I don't want DS should read any value after decimal since there is no scale in the source data type.

Thanks in advance

-Amit

Posted: Thu Oct 18, 2007 12:54 am
by Maveric
That could be because of RCP. Switch off RCP and do an implicit conversion from decimal 21 to 21,4. Should work. Try it.

Posted: Thu Oct 18, 2007 5:44 am
by Amit Jaiswal
Hi All,

I am sorry issue is somewhat different here. I am reading from a sequential file in a decimal(21,2) data type column and storing into dataset with same decimal(21,2). In next job I am reading this dataset file and sending it to sequential file target through funnel a funnel stage. In dataset file I can see correct value 0000000000000009283.55, however, in output sequential file it is changing the value precesion it becomes 0000000000000009283.00. This column is nullable NO in the target and he field width set is 21 there. If I change the fieldwidth value from 21 to 23 I am able to see correct result. But other file which refering the same layout for reading data is giving import error. I have a dependency that other existing files are using the same metadata for reading a file and therefore can not change the field width freely. Can any one suggest me the way to correct it?

PS - RCP is disabled in this case.

Thanks
-Amit

Posted: Thu Oct 18, 2007 9:10 am
by Ronetlds
Floor() function works well for truncating.

In general, if needed, you could multiply/divide by desired power of 10, apply Floor() (or Ceiling() if rounding up), then multiply/divide by desired power of 10 to get the exact precision you want.

Posted: Thu Oct 18, 2007 9:10 am
by Ronetlds
Floor() function works well for truncating.

In general, if needed, you could multiply/divide by desired power of 10, apply Floor() (or Ceiling() if rounding up), then multiply/divide by desired power of 10 to get the exact precision you want.