Scenario: Comparing unzipped files - 6.3

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.3
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a Job unarchiving a file and comparing it to a reference file to make sure it did not change. The output of the comparison is stored into a delimited file and a message displays in the console.

  1. Drag and drop the following components: tFileUnarchive, tFileCompare, and tFileOutputDelimited.

  2. Link the tFileUnarchive to the tFileCompare with Iterate connection.

  3. Connect the tFileCompare to the output component, using a Main row link.

  4. In the tFileUnarchive component Basic settings, fill in the path to the archive to unzip.

  5. In the Extraction Directory field, fill in the destination folder for the unarchived file.

  6. In the tFileCompare Basic settings, set the File to compare. Press Ctrl+Space bar to display the list of global variables. Select $_globals{tFileUnarchive_1}{CURRENT_FILEPATH} or "((String)globalMap.get("tFileUnarchive_1_CURRENT_FILEPATH"))" according to the language you work with, to fetch the file path from the tFileUnarchive component.

  7. And set the Reference file to base the comparison on it.

  8. In the messages fields, set the messages you want to see if the files differ or if the files are identical, for example: "[job " + JobName + "] Files differ".

  9. Select the Print to Console check box, for the message defined to display at the end of the execution.

  10. The schema is read-only and contains standard information data. Click Edit schema to have a look to it.

  11. Then set the output component as usual with semi-colon as data separators.

  12. Save your Job and press F6 to run it.

    The message set is displayed to the console and the output shows the schema information data.