![Creating Flat file with two Headers in Informatica PowerCenter issues-after-qlikview-version-upgrade-on-passive-node-of-production-servers](https://www.s-squaresystems.com/wp-content/uploads/Creating-Flat-file-with-two-Headers-in-Informatica-PowerCenter.png)
FLAT FILE:
A flat file is an ASCII text file which is saved with extension .txt, .csv, etc…
Source Analyzer:
Step 1: Go to tools menu –> Source Menu –> Source analyser files from source menu.
-
- Provide the user ID and Password to connect to the DB and to import required tables.
- Import source data from Database.
![Picture99](https://www.s-squaresystems.com/wp-content/uploads/Picture99.png)
Target:
Step 2: Go to tools menu –> target menu –> target files from target menu.
-
- Import Target data from file(.csv,.txt) location or Create the file if no flat file exists as shown in the below steps.
- Go to Targets and select Create Option as shown below Screenshot.
![Picture100](https://www.s-squaresystems.com/wp-content/uploads/Picture100.png)
-
- After click on the Create option the below window will be opened and provide a Target table name and select the appropriate database type and Click on Create as shown below screenshot:
![Picture101](https://www.s-squaresystems.com/wp-content/uploads/Picture101.png)
After creating the Target table, the following empty Table will be created.
![Picture103](https://www.s-squaresystems.com/wp-content/uploads/Picture103.png)
-
- We have to edit the empty Target table by double-clicking and provide the below information by clicking on the Edit button as shown below screen shot and provide the Column names data types:
![Picture104](https://www.s-squaresystems.com/wp-content/uploads/Picture104.png)
-
- After Clicking on ok we will see the below screenshot with a respective table of data information. Click on Done.
![Picture105](https://www.s-squaresystems.com/wp-content/uploads/Picture105.png)
Mapping:
Create Mapping with the respective name (ex:m_CUSTOMERFLATFILE), m_ is a naming convention for mapping creation.
Have create two pipelines, one is to generated headers and second is to load actual data.
Flow one:
-
- Pick only one row from source query with below query:
SELECT ID,NAME,AGE,ADDRESS,SALARY FROM CUSTOMERS where rownum<2;
![Picture106](https://www.s-squaresystems.com/wp-content/uploads/Picture106.png)
-
- Next expression transformation adds the names of the fields to variable port in order to generate second header line.
![Picture107](https://www.s-squaresystems.com/wp-content/uploads/Picture107.png)
-
- Pass that port to the target file.
![Picture108](https://www.s-squaresystems.com/wp-content/uploads/Picture108.png)
FLOW TWO:
The data load order of the mapping: flow one should run first to create the header, To load the actual data in the flat file please follow the below steps:
-
- Create a second flow to load actual data in the flat file:
![Picture109](https://www.s-squaresystems.com/wp-content/uploads/Picture109.png)
-
- Go to mapping –>then target load plan as shown below.
![Picture110](https://www.s-squaresystems.com/wp-content/uploads/Picture110.png)
-
- Make sure flow one is on top as mentioned below by changing the order using side arrow as shown below:
![Picture111](https://www.s-squaresystems.com/wp-content/uploads/Picture111.png)
Save mapping.
Workflow Manager:
Workflow:
Go to Workflow manager à to create workflow and session for the mapping process.
Session:
Go to Workflow manager à to create a task for the session in the mapping process.
Create a link between session and worklet as shown in below screenshot. Save the workflow designer.
![Picture113](https://www.s-squaresystems.com/wp-content/uploads/Picture113.png)
EDIT TASK:
Go to Workflow->Rght click on Session-> Edit Mapping->select flow one Target file i.e
Step1:CUSTOMERTABLE->Edit Attribute.
Under header option select “use header command output” then in next row under Header Command write header one which you want to show as first header name (ex: ”echo/creating 2 headers”) as shown below Screen Shot.
![Picture114](https://www.s-squaresystems.com/wp-content/uploads/Picture114.png)
Step2: from the flow two target table i.e CUSTOMERTABLE1->Edit Attribute.
Select Append if exists, As shown below screenshot, select ok.
Note: Make sure both flow one and flow two target file names should be the same.
![Picture115](https://www.s-squaresystems.com/wp-content/uploads/Picture115.png)
Save Workflow and Right click on Session for getting Workflow monitor for output details, as shown below.
![Picture116](https://www.s-squaresystems.com/wp-content/uploads/Picture116.png)
OUT PUT:
Please find the below Screen shot for Flat file generated with 2 headers.
![Picture117](https://www.s-squaresystems.com/wp-content/uploads/Picture117.png)