Time for action—running the examination transformation from a terminal window

Before executing the transformation from a terminal window, make sure that you have a new examination file to process, let's say exam3.txt. Then follow these instructions:

  1. Open a terminal window and go to the directory where Kettle is installed.
    • On Windows systems type:
      C:pdi-ce>pan.bat /file:c:pdi_labsexaminations.ktr c: pdi_filesinputexam3.txt
      
    • On Unix, Linux, and other Unix-based systems type:
      /home/yourself/pdi-ce/pan.sh /file:/home/yourself/pdi_labs/ examinations.ktr c:/pdi_files/input/exam3.txt
      
    • If your transformation is in another folder, modify the command accordingly.
  2. You will see how the transformation runs, showing you the log in the terminal.
    Time for action—running the examination transformation from a terminal window
  3. Check the output file. The contents of exam3.txt should be at the end of the file.

What just happened?

You executed a transformation with Pan, the program that runs transformations from terminal windows. As part of the command, you specified the name of the transformation file and provided the name of the file to process, which was the only argument expected by the transformation. As a result, you got the same as if you had run the transformation from Spoon—a small file appended to the global file.

When you are designing transformations, you run them with Spoon; you don't use Pan. Pan is mainly used as part of batch processes, for example processes that run every night in a scheduled fashion.

Note

Appendix B tells you all the details about using Pan.

Have a go hero—using different date formats

Change the main transformation of the last tutorial so that the process_date is saved with a full format, that is, including day of week (Monday, Tuesday, and so on), month in letters (January, February, and so on), and time.

Go for a hero formatting 99.55

Create a transformation to see for yourself the different formats for the number 99.55. Test the formats shown in the Numeric fields section and try some other options as well.

Tip

To test this, you will need a dataset with a single row and a single field—the number. You can generate it with a Generate rows step.

Pop quiz—formatting data

Suppose that you read a file where the first column is a numeric identifier: 1, 2, 3, and so on. You read the field as a Number. Now you want to send the data back to a file. Despite being a number, this field is regular text to you because it is a code. How do you define the field in the Text output step (you may choose more than one option):

a. As a Number. In the format, you put #.

b. As a String. In the format, you put #.

c. As a String. You leave the format blank.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.234.188