Page 1 of 1

Decimal data reading using sequential file stage

Posted: Fri Oct 19, 2007 10:50 pm
by Amit Jaiswal
Hi,

We are migrating few Ab Initio graphs into Datastage jobs. We are facing some issues while reading decimal values using sequential file stage. Source and target files are ASCII plain text files. We are reading one columns as decimal(5,2). We can see actual value stored inside the source file is not having any period (.). Value stored is 12345 inside the source file without any decimal point. With decimla(10,2) datastage is reading this value as 00012345.00 whereas Abi is reading this value is 123.45 with same data type. How should I select datatype and options so as to read period properly even if it is not visible inside the source file. I know manually we can do it but I want to directly read this the way Ab Initio is reading the data.
Thanks in advance.
-Amit

Posted: Sat Oct 20, 2007 2:20 pm
by ray.wurlod
Did you specify scale = 2 in the DataStage column definition?

Posted: Sun Oct 21, 2007 1:48 pm
by Amit Jaiswal
Hi Ray,

Yes I have specified. However, since period is not visible in the file. DS is reading this data with decimal(10,2) data type as 00012345.00. I think in ab initio they have a option whether to display period or not. In ab inition decimal(10,2) means do not do not read or write period

[img]
Content from help:
Explicit and implicit decimal points
If the decimal point is explicit, indicate this by a period before position. There must be a decimal point in input data, and a decimal point is inserted in output data. Examples:

decimal(4.2) decimal(";".2)If the decimal point is implicit, indicate this by a comma before position. There must be no decimal point in input data, and no decimal point is inserted in output data. Examples:

decimal(5,3) decimal(";",5) NOTE: If you omit position in the specification of a zoned decimal, the decimal position is zero and only integral values are represented. This is also true for packed and scaled binary decimals. For more information, see "Zoned decimals", "Packed decimals: Defined", and "Scaled binary decimal syntax".
[/img]

What's the similar options in DataStage? If I am taking normal decimal with precision or character with equivalent length then data is getting trucated. Equivalent lenght means for decimal(10,2) field width I have to take field width as 10 or take the data type as char(10). With this data is getting truncated. If I increase the field width then fixed width file size is more than the Ab Initio is having which is not acceptable to the downstream users.

Thanks,
-Amit

Posted: Sun Oct 21, 2007 5:36 pm
by ray.wurlod
The quick fix is to read as delivered and divide by 100. Further thought and experimentation is needed to give a technical solution, and I don't have access to Enterprise Edition just at the moment.

Posted: Mon Oct 22, 2007 7:55 am
by gbusson
What is the decimal separator specified for the project?is it . or , or none?

Posted: Mon Oct 22, 2007 2:22 pm
by ray.wurlod
I think it's clear from the original post that it's none.