Page 1 of 1

Error Reading a Fixed Width File

Posted: Mon May 05, 2008 5:12 am
by loe_ram13
Hi,
I am having a fixed width file:
File contains these three records
ram1234 sam
ra 123 1sam
ram12342sam

The metadata is:
fname varchar 4
mark integer 4
id char 1
lname varchar4

In the Format tab I have set:
at Record Level
Record length=Fixed
and at Field Defaults:
Delimiter=none


When i try view data ,I am getting following error:
#E TOIX 000141 16:26:05(001) <Sequential_File_0> Unable to initialize the importer.
>##E TOIX 000000 16:26:05(002) <Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "mark".
>##E TFSR 000019 16:26:05(006) <main_program> Could not check all operators because of previous error(s)
>##E TCOS 000029 16:26:05(007) <main_program> Creation of a step finished with status = FAILED.

Should I add additional properties?
Any help is appreciated.

Posted: Mon May 05, 2008 6:24 am
by keshav0307
you have not specified the record length.

Posted: Mon May 05, 2008 6:52 am
by bkumar103
instead of varchar try using char. hope this will work.

Posted: Mon May 05, 2008 7:15 am
by ray.wurlod
Use Char, not VarChar, and specify the display widths.

Code: Select all

fname  Char(4)     width 4
mark   Integer     width 4
id     Char(1)     width 1
lname  Char(4)     width 4

Posted: Mon May 05, 2008 10:07 pm
by loe_ram13
ray.wurlod wrote:Use Char, not VarChar, and specify the display widths.

Code: Select all

fname  Char(4)     width 4
mark   Integer     width 4
id     Char(1)     width 1
lname  Char(4)     width 4[/co ...[/quote]

Hi Ray,
Where can i specify display widths? :?
like  server jobs ,I do not have a display column here.
Also I tried using everything as CHAR & Integer,yet I am getting the same error.Kindly help.
Thanks in advance.

Posted: Mon May 05, 2008 10:09 pm
by ray.wurlod
In the extended job properties - it's called Field Width. Right click on row in Columns grid and choose Edit Row... from the menu.

Posted: Mon May 05, 2008 10:35 pm
by loe_ram13
ray.wurlod wrote:In the extended job properties - it's called Field Width. Right click on row in Columns grid and choose Edit Row... from the menu. ...
Thanks Ray.
I have set Field Width as you have told.
Now Out of 5 rows in my seq file,i can only see 1st 2 rows.
While trying to view data,the following warning message is thrown:
Error executing View Data command:
##E TOIX 000159 10:03:06(008) <Sequential_File_0,0> Short read encountered on import; this most likely indicates one of the following possibilities:

Posted: Mon May 05, 2008 11:09 pm
by bkumar103
When i try view data ,I am getting following error:
#E TOIX 000141 16:26:05(001) <Sequential_File_0> Unable to initialize the importer.
>##E TOIX 000000 16:26:05(002) <Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "mark".
>##E TFSR 000019 16:26:05(006) <main_program> Could not check all operators because of previous error(s)
>##E TCOS 000029 16:26:05(007) <main_program> Creation of a step finished with status = FAILED.
Please post the complete error.

Posted: Mon May 05, 2008 11:33 pm
by devidotcom
Make sure the record length every entire record is equal.

Eg. Record length 5

11111
222
22222

here the second record 222 must have 2 spaces at the end when reading the fixed width file otherwise it will get rejected

Posted: Thu May 15, 2008 2:15 pm
by dsdoubt
So there isn't any way to read the Fixed Width file with respective data type for each field other than CHAR datatype?
If I mention "Record lenght = Fixed" I cant use Varchar not Inteter nor Decimal. Its allowing only Char datatype.

Posted: Fri May 16, 2008 3:37 am
by ArndW
dsdoubt - you cannot use any varying column such as VarChar or VarBinary but you can use decimal and integer. Just specify lengths.