Log out?

Exercise 4.2 – Transforming Basic Fixed-Width Files

Purpose:

To practice transforming fixed-width files using the File Spec Editor.


Steps:

  1. Create a Route
    1. From the eiConsole File Management screen, select the “Add Route” button.
    2. In the dialog that appears, enter the name “Fixed-Width Files” and select “OK”.
    3. The Route should now appear in the table on the screen. Double click it to open it.


  2. Document Source System
    1. Select the “Source System” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Change the “System Name” to “Text File”
    3. Select the “Choose Source Icon” button, and scroll down to select one of the plain file icons


  3. Configure the Listener
    1. Select the “Listener” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Select “Directory / File” from the “Listener Type” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    3. Assign a polling directory, using the “…” button to open the file chooser. The polling directory should NOT be the directory with all the sample files, since files will be moved/deleted by the listening process.


  4. Add Source Transformation Module
    1. Select the “Source Transform” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Click the “Add Format” button. In the dialog that appears, name the Format “People Fixed File Spec”, and click “OK”. The transformation configuration panel will appear below.
    3. Select “Delimited and Fixed-Width File” from the “Transformation Module” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    4. In the new configuration panel that appears below, select the “Edit” button next to the “File Spec” configuration field to open the “File Spec Editor”.


  5. Create a File Spec
    1. When the “File Spec Editor” opens, a dialog called “Select for New File Type” will be present. In the sole selection box, choose the last option in the list, called “User-defined”, and click “Next”.
    2. In the new screen, leave “Record Style” set to “Delimited” with the “Record Delimiter” as “\n”. Change the “Field Style” to be “Fixed Width”. Finally, click “Save”.
    3. In the “File Spec Editor”, the left-hand panel is a tree where the specification will be built.
    4. Right click on the root Node of the tree, called “Base”, and select “Add New Record”. In the dialog that pops up, enter “People” as the record name, and click “OK”.
    5. Right click on the new “People” record, and select “Add New Field”. Name the field “First Name”, and click “OK”.
    6. Select the new “First Name” field in the tree. In the bottom left, a new configuration panel will appear. In the “Length” field, set the length to 15.
    7. Repeat the above process to add the following new fields and their lengths until the specification is complete:
      1. Middle Initial (1)
      2. Last Name (15)
      3. Gender (1)
      4. SSN (11)
      5. Birth Date (10)
      6. Occupation (30)
      7. Vehicle Make (10)
      8. Vehicle Model (10)
      9. Address1 (20)
      10. Address2 (20)
      11. City (10)
      12. State (2)
      13. Zip Code (5)
    8. Once the spec is complete, find the button with the icon of a floppy disk in the toolbar above the tree, and click it. Enter “people-file-spec” as the name of the specification to save it.
    9. After saving it, press the “X” button in the top right of the screen to close the “File Spec Editor” and return to the “Route Editing Grid”.


  6. Configure the Transport
    1. Select the “Transport” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Select “Directory / File” from the “Transport Type” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    3. Select the “Target Directory”, using the “…” button to open the file chooser.
    4. Set “people-output” as the “Target File Name”.
    5. Set “xml” as the “Target File Extension”.


  7. Document the Target System
    1. Select the “Target System” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Change the “System Name” to “XML File”
    3. Select the “Choose Target Icon” button, and scroll down to select one of the XML icons


  8. Prepare to Test
    1. In the menu bar at the top, select “Route” -> “Testing Mode”. Make sure the changes to the Route are saved.
    2. Copy the file called “people_fixed.txt” from the “Samples” directory provided into the directory chosen as the polling directory.


  9. Perform the Test
    1. At the top of the “Testing Mode” screen, select the “Execute Test” button.
    2. If the “Route” was configured successfully, all the Stages should light up with green checkmarks.
    3. In the OS File Explorer, open the directory selected as the “Target Directory”. The file “people-output.xml” should be there, with the contents of the original file transformed into XML.


  10. Output Files
    1. Compare the results from the exercise with the following example output files to see if they are correct.
      1. people-output.xml


This is a unique website which will require a more modern browser to work! Please upgrade today!

Thanks!

Our editors are notified.

Close