This scenario describes a simple Job that reads the EDIFACT structure of an input UN/EDIFACT Customs Cargo (CUSCAR) message file, and extracts data according to the schema definition. The extract data is displayed on the Run console and sent to an XML file.
Drop the following components from the Palette onto the design workspace: tExtractEDIField, tLogrow, and tFileOutputXML.
Connect the components using Row > Main connections.
Double-click tExtractEDIField to display its Basic settings view and define its properties.
In this use case, the input schema is stored in the Metadata node of the Repository tree view for easy retrieval. For further information concerning metadata, see Talend Studio User Guide.
Select Repository from the Property Type list, and then click the three-dot button next to the field that appears to open the [Repository Content] dialog box.
In the [Repository Content] dialog box, select the desired metadata item, cuscar in this use case, and click OK.
In the EDI parameters area, fill the EDI filename field with the full path to the input EDIFACT message file.
In this use case, the input file is 99a_cuscar.edi.
Select the Ignore new line check box to skip the carriage return characters in the input file during data processing.
As all the other parameters are automatically retrieved, simply leave them as they are.
Double-click the tFileOutputXML component to show its the Basic settings view.
Fill the File Name field with the full path to the output XML file you want to generate.
In this use case, the output XML is 99a_cuscar_extract.xml.
Leave the other parameters as they are.
Save your Job and press F6 to run it.
The defined data in the input EDIFACT CUSCAR message file is retrieved, displayed on the console, and written into the output XML file.