Hi -
Is the following expected -
Job :
src --> xfm --> db2
In the xfm 2 decimal numbers are divided in a stage variable and the result put in a target field defined as a decimal(15,4) which then is inserted into the db2/as400 database where the field also is defined as decimal(15,4).
In version 5.2 there is no problem with this, the job runs without errors/warnings -
Eg.
var1 = 23.3150
var2 = 30.0000
In the stagevariable : var1 / var 2
Then the result inserted into the db2 database is 0.7772
In 7.5.1 I get a warning :
SaOrLiStockDayTest..xfm: The column data has been truncated to '0.77716666666666'.
The data is inserted into the database as 0.7772 but it is not good since we get a lot of warnings (hence the job aborts!).
I am aware that in the transformer the value internally is represented as 0.777166666666667 but the question is, is this expected behaviour in version 7.5.1 - compared with 5.2 ?
It is easily solved by using the function NumericRound4(), but I would like to avoid this solution since it then has to be implemented a lot of places.
Thx
/Peter
Rounding and decimals
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 133
- Joined: Wed Mar 05, 2003 4:19 pm
- Location: Lima - Peru. Sudamerica
- Contact:
Re: Rounding and decimals
Hi Peter
Use the next data stage function
Formato = "R": Num_Decimals
Ans = FMT(Number, Formato)
In your case set the next values
Formato = 'R4'
Ans = FMT(0.77716666666667,'R4')
The result is 0.7772
I hope this help
Use the next data stage function
Formato = "R": Num_Decimals
Ans = FMT(Number, Formato)
In your case set the next values
Formato = 'R4'
Ans = FMT(0.77716666666667,'R4')
The result is 0.7772
I hope this help
Saludos,
Miguel Seclén
Lima - Peru
Miguel Seclén
Lima - Peru