Division truncation

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
juliejarrett
Participant
Posts: 12
Joined: Tue Jul 06, 2004 11:54 pm

Division truncation

Post by juliejarrett »

In the Transformer I am tring to do a division and the answer keeps truncating

ie 1 / 3 = .33330 The scale we specified was 5.

Any ideas how we could get .33333

Thanks
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Are you writing the result directly from the transformer to the target(may be seq file,Hashed file or db table)? Is there any other stage in between the target and the transformer? What is the data type in your target and what the data type you are using in the map?
Success consists of getting up just one more time than you fall.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The default PRECISION in DataStage is 4.

The only way you can change this is to perform your calculation in a Routine, in which a PRECISION statement appears to change that value.

Code: Select all

FUNCTION DivideByThree(Arg1)

PRECISION 9

Ans = Fmt((Arg1) / 3, "MR9")

RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply