Page 1 of 1

How to read fixed width files(Header,Trailer and detail rec)

Posted: Thu Feb 19, 2009 6:10 am
by venki
Hi,
I am new to profiling..
My source system is FIXEDWIDTH file. This file structure is ,
00123420090218
01234446venkgfftyhh123bbh 123 T02
01234447cenkgfftyhh123bbh 123 T02
01234448dbnkgfftyhh123bbh 123 T02
01234449aenkgfftyhh123bbh 123 T02
991234004
In which 1st line is header (start with 00, single record), lost line is trailer (start with 99 single record) and in between records are detail records(start with 01 multiple records).

My query is how to read this type of files and also how to define structure in QETXT.INI.

please suggest me.

Posted: Thu Feb 19, 2009 3:08 pm
by ray.wurlod
That is NOT a fixed-width format. If it were, every record type would have the same length. What you can do is define every field as Char data type and the field delimited as 000.

Do you need to profile header and trailer information? If not, pre-process the file using a DataStage job so that it only has detail records in it. Then you can read the file as fixed-width format.

Posted: Mon Feb 23, 2009 7:00 am
by venki
Hi ,

Thank you..

If i remove First line (header) and Lastline (Trailer) from the file, then it should be FIXED WIDTH file.

Please some one correct me if i am wrong?

Posted: Mon Feb 23, 2009 2:11 pm
by ray.wurlod
I can not guarantee that. Only the provider of the file can guarantee that.