Decimal value reading issue

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
Amit Jaiswal
Premium Member
Premium Member
Posts: 38
Joined: Fri Apr 22, 2005 6:07 am

Decimal value reading issue

Post 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
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post 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.
Amit Jaiswal
Premium Member
Premium Member
Posts: 38
Joined: Fri Apr 22, 2005 6:07 am

Post 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
Ronetlds
Participant
Posts: 28
Joined: Thu Mar 30, 2006 12:48 pm

Post 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.
Ronetlds
Participant
Posts: 28
Joined: Thu Mar 30, 2006 12:48 pm

Post 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.
Post Reply