Page 1 of 1

Error Reading Char Field from Sequential File

Posted: Tue Oct 03, 2006 11:43 pm
by ajmore
Hi All :)

I have to read a sequential file(records r comma seperated), apply transformation and insert data into dataset.I am specifying Metadata for col1 as char(6) and col2 as varchar(30).Input Data is as follows(First Line is Col. name)

statecode,statefullnametext

ACT,Australian Capital Territory
NSW,New South Wales
NT,Northern Territory

but while reading the File i am getting following Error

<Sequential_File_23,0> Field "statecode" delimiter not seen, at offset: 6
<Sequential_File_23,0> Import warning at record 0.
<Sequential_File_23,0> Import unsuccessful at record 0.
<Sequential_File_23,0> Field "statecode" delimiter not seen, at offset: 6
Missing record delimiter "\n", saw EOF instead


But when i use First Col. DataType as varchar(6) job is working fine..
Please suggest me the solution to use char datatype and why it is so.......

Thanks

Posted: Tue Oct 03, 2006 11:47 pm
by ray.wurlod
Is the "First Line is Column Names" property set to True? This does need to be explicitly set - it does not import with the other format information, because it is a stage property whereas the other format information form link properties.

I suspect that this is the problem because the error is reported from row #0 (the first line in the file).

The other possibility is that this line has the wrong number of commas in it.

Posted: Tue Oct 03, 2006 11:57 pm
by ajmore
ray.wurlod wrote:Is the "First Line is Column Names" property set to True? This does need to be explicitly set - it does not import with the other format information, because it is a stage property whereas the other ...


Thanks for the quick response ray..
I have set the "First Line Column Names" property to True..
and while importing seq. file metadata the record level delimiter is set to "Unix Newline" while Final Delimiter as "end" and pad char as "space".

Posted: Wed Oct 04, 2006 2:30 am
by pavankvk
ajmore wrote:
ray.wurlod wrote:Is the "First Line is Column Names" property set to True? This does need to be explicitly set - it does not import with the other format information, because it is a stage property whereas the other ...


Thanks for the quick response ray..
I have set the "First Line Column Names" property to True..
and while importing seq. file metadata the record level delimiter is set to "Unix Newline" while Final Delimiter as "end" and pad char as "space".
The actual problem is with a comma delimited file you shouldnt specify the length. you specified the first column as char(6) so datastage importer tries to locate a , at position 6 where as your data in the first column is only 3 bytes. when even you use comma delimited dont specify length for a char data type.

Posted: Wed Oct 04, 2006 6:32 am
by chulett
It's not about specifying the length per se, but about char versus varchar. When you declared the first field to be a char(6), that means it will always have 6 characters in it - period. DataStage isn't seeing that.

It needs to be declared as a varchar as well.