Reading Fixed length record file
Moderators: chulett, rschirm, roy
Reading Fixed length record file
Hi,
I have the following fixed length input :
Input :
Q0009814 TEST DATA 500000P
I would like to extract 3 columns from the below fixed length record file.
Col1 - Q0009814
Col2 - TEST DATA
Col3 - 500000P
and I want to mention my Record Length = 40 and length of Col1,Col2,Col3 are 18,15,7 respectively.
How do I set that in Sequential file stage.I can find 'Record Length' (will that be 'fixed' or 40), but not 'Field Length'.
Thanks
I have the following fixed length input :
Input :
Q0009814 TEST DATA 500000P
I would like to extract 3 columns from the below fixed length record file.
Col1 - Q0009814
Col2 - TEST DATA
Col3 - 500000P
and I want to mention my Record Length = 40 and length of Col1,Col2,Col3 are 18,15,7 respectively.
How do I set that in Sequential file stage.I can find 'Record Length' (will that be 'fixed' or 40), but not 'Field Length'.
Thanks
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
How to read fixed width from a schema file
I want to know if we can read a fixed widht file using the schema file ..........my problem is i get data from different locations and the schema for each of them is different.......i want to read data from any source just by changing the schema file ....i could do that for a comma delimited file ........i want to know if we can do that for a fixed width file
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
Re: How to read fixed width from a schema file
you will have to read all the files in seperate stages. In case you want to process them in same job, you will have to be more specific. Send us examples of 2-3 files that you will get so that we can explaind the solution to you.sgubba wrote:I want to know if we can read a fixed widht file using the schema file ..........my problem is i get data from different locations and the schema for each of them is different.......i want to read data from any source just by changing the schema file ....i could do that for a comma delimited file ........i want to know if we can do that for a fixed width file
there is no stage that allows that or schema cannot be read from any text file. you will have to logically implement it
Re: Reading Fixed length record file
Yeah i am able to do it now...Assume In a fixed file lenght format column NAME is at position from 1-10 for one source data file ....and the same column "NAME" is at position 200-210 for another source data file ....i should be able to read any kind of source data file by just changing the schema file.I am using a column import to break a record into differnt columns by using schema file ....i was able to do it by field delimiter ....now i am able to read it for a fixed lenght filed format
mydsworld wrote:Hi,
I have the following fixed length input :
Input :
Q0009814 TEST DATA 500000P
I would like to extract 3 columns from the below fixed length record file.
Col1 - Q0009814
Col2 - TEST DATA
Col3 - 500000P
and I want to mention my Record Length = 40 and length of Col1,Col2,Col3 are 18,15,7 respectively.
How do I set that in Sequential file stage.I can find 'Record Length' (will that be 'fixed' or 40), but not 'Field Length'.
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
As you import the table definition check the "Fixed width" check box on the Format tab, then enter 18,15,7 in the column widths field. Select the Define tab and note that the widths are recorded as "Display width". Make any other required changes, such as addition of data elements and descriptions, and click OK to save the table definition into the Repository.
Use it from there.
Use it from there.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.