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

Wednesday, July 09, 2014

Column Import Stage - Read a Fixed width File

The Column Export stage is a restructure stage. It can have a single input link, a single output link and a single rejects link. Typically used to divide data arriving in a single column into multiple columns.
    Here, I tried to explain How to use it for importing data...

a) Design :

 As you can see, Here we have followed this design to elaborate the stage. We are reading a file, Importing Columns with Import Stage and then loading them into Sequential File.

b) Input Data : 


Data is having 3 columns, Name, RollNo, Major. RollNo is made by concatenation of Year, College code, Branch Code and Student No. So in our design we are going to import this column.
We are reading this data as 3 columns separated by ','  NAME, ROLLNO, MAJOR

c) Import Stage Properties :
As we are going to split, 'ROLLNO' column. So, we will follow these properties.

Input Column ( need to import )  :- RollNo
Output Columns : ( in which Input is divided )
1. Year
2. ClgCode
3. Branch
4. SrNo

   i) Input tab Properties : It is same as Source Schema.
  ii) Output tab Properties : This property played a important role for reading the column. In this property we need to define the Column Format, MetaData and column mapping. Lets go one by one.

    Column Format : - In this we will define the column format which need to be imported. Here we are importing "RollNo"

"RollNo" dont have any delimiter within it. So set this properties as below.

Final Delimiter - end
Delimiter - none

      Column Mapping :  Map the generated column to Output column.

      Column Metadata : Define the output column metadata ( schema or definition ). Define the Imported Column as 'CHAR' ( not VARCHAR if string type ) and define the length also.

d) Output 
Compile the job and Run, After successful Run, the output should be like this...

Like the Facebook Page & join Group

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

1 comment :

  1. i, I am using a Column Import stage to read EBCDIC data. One of those is a packed decimal field which contains EBCDIC spaces. So I want to use the "default" property on that field those values are spaces and rest should be as it is.