Parsing delimited file using the cFlatPack component
This scenario applies only to Talend ESB, Talend Data Services Platform, Talend MDM Platform, Talend Real Time Big Data Platform, and Talend Data Fabric.
For more technologies supported by Talend, see Talend Mediation Components.
In this scenario, a cFile component reads a delimited file from the local file system, which contains the customers information including id, first name, surname, and order id, as shown below:
1,"Harry",Carter,21
2,Padre,Boulevard,22
3,Andrew,Polk,23
4,Herbert,Reagan,"24"
5,Chester,Eisenhower,25
The file is parsed by the cFlatPack component, using a predefined PZMAP XML file:
<?xml version="1.0"?>
<!-- DTD can be pulled from the Jar or over the web-->
<!DOCTYPE PZMAP SYSTEM "flatpack.dtd" >
<!--<!DOCTYPE PZMAP SYSTEM "http://flatpack.sourceforge.net/flatpack.dtd" >-->
<PZMAP>
<COLUMN name="id" length="5" />
<COLUMN name="name" length="20" />
<COLUMN name="surname" length="20" />
<COLUMN name="orderid" length="5" />
</PZMAP>
The customer information is then printed in the execution console by a cBean component.
For more information about the PZMAP file configuration, see the website http://flatpack.sourceforge.net/documentation/index.html.