Example of File Source Definition in Informatica

  • Upload
    vam1

  • View
    73

  • Download
    0

Embed Size (px)

DESCRIPTION

Informatica Mapping describing File Source Definintion

Citation preview

Example of File Source Definition in Informatica Problem Statement :Create a mapping to load data from csv file containing employee data with the help of FileSource Definition Transformationinto EMP Table. Field information can be found in the header of file.Source Data: File Name:employee.dat File Format: csv file File Location: $$PMSourcFileDirFile Data:EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPT1,JOHNSON,ADMIN,6,12/17/1990,18000,null,42,HARDING,MANAGER,9,2/2/1998,52000,300,33,TAFT,SALES I,2,1/2/1996,25000,500,34,HOOVER,SALES I,2,4/2/1990,27000,null,35,LINCOLN,TECH,6,6/23/1994,22500,1400,46,GARFIELD,MANAGER,9,5/1/1993,54000,null,47,POLK,TECH,6,9/22/1997,25000,null,48,GRANT,ENGINEER,10,3/30/1997,32000,null,29,JACKSON,CEO,,1/1/1990,75000,null,410,FILLMORE,MANAGER,9,8/9/1994,56000,null,211,ADAMS,ENGINEER,10,3/15/1996,34000,null,212,WASHINGTON,ADMIN,6,4/16/1998,18000,null,413,MONROE,ENGINEER,10,12/3/2000,30000,null,214,ROOSEVELT,CPA,9,10/12/1995,35000,null,1Target Data:EMP_ALL Table Data:EMPNOENAMEJOBMGRHIREDATESALCOMMDEPT

1JOHNSONADMIN1/6/190012/17/19901800004

2HARDINGMANAGER1/9/19002/2/1998520003003

3TAFTSALES I21/2/1996250005003

4HOOVERSALES I24/2/19902700003

5LINCOLNTECH66/23/19942250014004

6GARFIELDMANAGER95/1/19935400004

7POLKTECH69/22/19972500004

8GRANTENGINEER103/30/19973200002

9JACKSONCEO1/1/19907500004

10FILLMOREMANAGER98/9/19945600002

11ADAMSENGINEER103/15/19963400002

12WASHINGTONADMIN64/16/19981800004

Sample Datafor above problem can be get fromhereSolution:Steps to Import File Source Definition :Prerequisite: ToimportSource Definitionfor file type ,you need to first copy the sample File on the machine where you are using Informatica Client. Or you can create Source Definition manually as well. In Informatica power center , first select Source Analyzer by clicking on below option Click Sources > Import from File

File Source Definition Transformation in Informatica Step 1 It will open the Open Flat File dialog box , select theemployee.datfile to be used as source Definition.

Once you select file , it will show Flat File Import Wizard Step 1 of 3 wizard. You will see content of file here. Choose the Flat File Type asDelimited Enter Filename as employee_data CheckImport field name from first line box ,to automatically add field name in source Definition.Note: You will notice thatStart import at row automatically set to 2 from 1.

Click on next.

File Source Definition Transformation in Informatica Step 3 Flat File Import Wizard Step 2 of 3 wizard will appear. Select the Delimited:Set the Delimiter asComma Treat Consecutive Delimiters as One:If selected, the Flat File Wizard reads one or more consecutive column delimiters as one. Otherwise, the Flat File Wizard reads two consecutive delimiters as a null value. Treat Multiple Delimiters as AND:If selected, the Flat File Wizard reads a specified set of delimiters as one. Escape Character:Character immediately preceding a column delimiter character embedded in an unquoted string, or immediately preceding the quote character in a quoted string. When you specify an escape character, the Integration Service reads the delimiter character as a regular character. This is calledescapingthe delimiter or quote character. Remove Escape Character From Data:This option is selected by default. Clear this option to include the escape character in the output string. Use Default Text Length:If selected, the Flat File Wizard uses the entered default text length for all string datatypes. Text Qualifier:Quote character that defines the boundaries of text strings. Choose No Quote, Single Quote, or Double Quotes. If you select a quote character, the Flat File Wizard ignores delimiters within pairs of quotes.

File Source Definition Transformation in Informatica Step 4 Click next. Flat File Import Wizard Step 3 of 3 wizard will appear. You will see Port name and its data type will be automatically added in the Source Definition. Name:Port name that you want to appear for each column. If you select Import Field Names from First Line, the wizard reads the column names provided in the file instead. Datatype:Column datatype. Select Text,Numeric, orDatetime, and then enter the appropriate Length/Precision, Scale, and Width. For numeric columns, Precision is the number of significant digits. The Flat File Wizard ignores the width for numeric columns in delimited files. For Text columns, Precision is the maximum number of characters contained in the source field or the target field. The Flat File Wizard ignores the precision when reading text columns in or writing text columns to delimited files. By default, the Flat File Wizard enters the same value for both Precision and Width. You can change the value of the precision or width, but the Flat File Wizard only lets you define the precision to be greater than or equal to the width. Note : Double check the data type for the Datetime related fields. Click finish to create Flat File Source Definition. You can edit the properties this source Defintion In properties Tab , Select Date,time Format as per your input file.

Below are the steps to create full mapping. Create a new mappingm_file_Source_Definition_exampleby Go to toolbar -> click mapping-> Create DragSource (employee_data) from FlatFile node andTarget (EMP_ALL)to the mapping. It will automatically add theSQ_employee_data relatedemployee_data Source Definition. Now connect all the required port fromSQ_employee_data to EMP_ALL Target Click on Mapping ( from tool bar) -> then Validate ( to validate the mapping) Now save the mapping ( by clicking on Repository-> Save or you can also pressCtrl+S) Generate the Sessions_file_Source_Definition_example in workFlow Manager. edit the session, for SQ_employee_data Set Source filetype as Direct. Set Source file directory as $PMSourceFileDir\ or other directory where file is placed Set Source filename as employee_data.dat File Source Definition Transformation Session Properties 4Over all Mapping:

File Source Definition Transformation in Informatica Full MappingSo, in this article we have gone throughstep by stepexample of FileSource Definition Transformation in Informatica mapping, learnt the step to add Source Definition for file Type , configure the port , properties , adding Source Definition mapping properties in mapping task.

http://www.tecktricks.com/example-of-file-source-definition-in-informatica-example-1/

Also Refer: http://www.tecktricks.com/step-by-step-of-creating-file-target-definition-in-informatica-and-using-it-in-informatica-mapping/http://www.tecktricks.com/dynamically-split-target-flat-file-in-informatica/http://www.tecktricks.com/difference-between-relational-lookup-and-flat-file-lookup-transformation-in-informatica/

http://www.howtointegratedata.com/category/informatica/informatica-transformations/