We have moved to www.dataGenX.net, Keep Learning with us.

Wednesday, September 17, 2014

Read Fixed Width Flat File with Sequential File Stage

If we have a fixed width Flat file, we can read it via Sequential File stage only, no need to use Import Stage.   For reading a Fixed Width Flat file, you should know the format of Fixed width data. How are the data splitting into two or more output columns.

Here, I demonstrate How to read a Fixed Width Flat file from Sequential File Stage

A. Input File :

Below is the Input file which we are going to use in our job. This file contains a column RollNo which is concatenation of 4 fixed width columns which we have to split and read.

B. Design :

Below Job design demonstrate the logic where we are reading a fixed width file via 'seq file stage', Copy stage or other stage if any processing want to do and the target file.

 C. Seq File Properties ( Fixed )

This is what you have to define in your Input Seq File properties :

At Record Level :-
Final delimiter - end
Record delimiter - Unix NewLine ( the char which is splitting the Record )
Record length - fixed

At Field Level :- 
Delimiter - none ( as no delimiter is there in input data)
Quote - none

D. Input Metata

Now, define the input metadata as needed. In this example we are using below -

Year - 2 char
ClgCd - 3 char
BrCd - 2 char
SrNo - 3 char

Metadata should be defined as CHAR with LENGTH ( No VARCHAR ).

E. Output File Properties :-

 In Output, we are using a seq file, This is what I have defined for this job.

F. Output File 

This is How you can see the Output after successfully run of this job.

Like the Facebook Page & join Group

For WHATSAPP group , drop a msg to 91-88-00-906098

No comments :

Post a Comment