Error Reading a Fixed Width File

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
loe_ram13
Participant
Posts: 35
Joined: Thu Apr 12, 2007 1:17 am

Error Reading a Fixed Width File

Post 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.
Thanks
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

you have not specified the record length.
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

instead of varchar try using char. hope this will work.
Birendra
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
loe_ram13
Participant
Posts: 35
Joined: Thu Apr 12, 2007 1:17 am

Post 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.
Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
loe_ram13
Participant
Posts: 35
Joined: Thu Apr 12, 2007 1:17 am

Post 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:
Thanks
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post 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.
Birendra
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post 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
dsdoubt
Participant
Posts: 106
Joined: Sat Jul 15, 2006 12:17 am

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

dsdoubt - you cannot use any varying column such as VarChar or VarBinary but you can use decimal and integer. Just specify lengths.
Post Reply