Page 1 of 1

Unable to load fixed width format file

Posted: Tue May 29, 2007 3:06 am
by siddesai
Hey Guys,
I 'm trying to extract a .dat file with fixed with format using a sequential file stage. I have set all the relevant properties including the actual size of all the files. eg. 110 bytes. But, whenever I try to do a view data and I get the below mentioned error.


>##E TOIX 000158 17:14:59(000) <SQ_SourceFile,0> Error reading on import.
>##E TOIX 000050 17:14:59(001) <SQ_SourceFile,0> Bad record delimiter after fixed-length record: expected "\n", got "\r"
>##E TOIX 000179 17:14:59(002) <SQ_SourceFile,0> Import error at record 0.
>##E TOIX 000089 17:14:59(003) <SQ_SourceFile,0> The runLocally() of the operator failed.
##I TOIX 000094 17:14:59(004) <SQ_SourceFile,0> Output 0 produced 0 records.
##I TOIX 000094 17:14:59(005) <SQ_SourceFile,0> Output 1 produced 0 records.

I tried to load all the data using Varchar but the moment I specify "decimal" it throws below mentioned msg
">##E TFIG 000000 17:23:49(002) <SQ_SourceFile> At field "CPI_ID": When validating import/export function: APT_GFIX_Decimal::validateParameters: the decimal "text" format is variable length, and no external length is specified;
>you should possibly specify an appropriate "width" property; external format: {text, padchar=32, nofix_zero, precision=10, scale=0, round=trunc_zero, ascii}.
"

Please guide as to what might be the possible issue.

Posted: Tue May 29, 2007 5:12 am
by keshav0307
set the final delimiter=none
have you specified length of all fields correctly.
because
you should possibly specify an appropriate "width" property; external format: {text, padchar=32, nofix_zero, precision=10, scale=0, round=trunc_zero, ascii

Posted: Tue May 29, 2007 5:59 am
by JoshGeorge
Looks like you have to edit your decimal fileds properly. Double click on the column grid, you will get the properties to edit. In the properties section under the Decimal type, add the field width property and set it to the size of your decimal meta data. If your decimal is length:12 scale:4 then the width will be 16 (12+4).

Posted: Tue May 29, 2007 7:17 pm
by ray.wurlod
The \r indicates that the file originated on a Windows system. Change the record delimiter string to \r\n

Posted: Tue May 29, 2007 8:51 pm
by siddesai
ray.wurlod wrote:The \r indicates that the file originated on a Windows system. Change the record delimiter string to \r\n ...
Thanks Ray. It worked!

Could you please elaborate on the cause of error? It should have been pretty straight forward with import of data but it just didn't work.

The extension of the file is .dat meaning a fixed width format. I specified all the fields and metadata was just right. But, it just didn't accept the delimeters.

I guess DataStage is more of play with it and learn how it works thing..

Posted: Sat Aug 15, 2020 9:18 am
by Dinarth Souto Júnior
ray.wurlod wrote:The \r indicates that the file originated on a Windows system. Change the record delimiter string to \r\n ...

Thanks!! It worked for me too!!