In Neuron ESB CU4 there is a flat file parser that can be used to convert single record format flat files into XML.  The supported flat files must have the following attributes: fixed-width or delimited. The following delimiters are supported:

  • Comma
  • Tab
  • Vertical Bar (otherwise known as “Pipe-Delimited”)
  • Semicolon
  • Custom string (any combination of characters)

All records in the flat file must conform to the same definition. The only exception to this are leading records and trailing records which can be ignored.

Using the Flat File Parser

Process Definition

The flat file parser is included as a Business Process step in Neuron ESB Explorer.  To use the flat file parser, create a new Business Process (or use an existing one) and drag the Flat File Process step from the Process Steps toolbox onto the Business Process Designer:

Flat-file-parser1

Creating a Flat File Definition

The flat file parser includes a wizard that will assist users in creating the flat file definition. The flat file definition cannot be created without using the wizard.  The Flat File Wizard requires a sample flat file in order to create the definition.  This sample flat file can either be imported into the new Neuron ESB Text Repository located by navigating to Repository->Documents->Text Documents within the Neuron ESB Explorer or, it can be retrieved directly from the file system.

  1. To start the wizard, right-click on the Flat File Parser step in the process designer and select Flat File Wizard…
    Flat-file-parser2
  2. On the Welcome page, click Next:
    Flat-file-parser3
  3. On the File Type page, select the type of file to process – Fixed Width or Delimited. If Delimited is selected, the appropriate delimiter must also be supplied.  If something other than the provided options are needed, select Custom String and enter the character(s) to be used as a delimiter.  Click Next:
    Flat-file-parser4

If Fixed Width is selected, continue with step 4.  If Delimited is selected, skip to step 8.

  1. On the Fixed-Width Flat File page, either select a sample flat file from the repository or the file system. To select a sample from the repository, select the Repository radio button and select from one of the files listed.  To select a file from the repository it must be imported before running the wizard.  To select a sample from the file system, select the File System radio button and click the ellipsis button to browse for a file from the file system.  Some flat files include column header names in the first line.  If your flat file includes column headers, check the box for First Row Contains Column Names.  Also, if you want the Flat File Parser to ignore any of the leading or trailing rows, indicate how many of each row to ignore:
    Flat-file-parser5
  2. Once you have selected a fixed-width document the preview pane will display the first 10 rows:
    Flat-file-parser6
  3. When parsing a fixed-width file you need to set the column breaks. To set a column break, click anywhere in the preview pane and a vertical line will appear.  Click the line again and it will disappear.  Note – you don’t have to click on the ruler above the preview pane, just click inside the preview pane:
    Flat-file-parser7
  4. After selecting all the column breaks, click Next. Skip to step 10.
  1. If you selected Delimited in step 3, the Comma-Delimited Flat File page will appear. On this page, either select a sample flat file from the repository or the file system.  To select a sample from the repository, select the Repository radio button and select from one of the files listed.  To select a file from the repository it must be imported before running the wizard.  To select a sample from the file system, select the File System radio button and click the ellipsis button to browse for a file from the file system.  Some flat files include column header names in the first line.  If your flat file includes column headers, check the box for First Row Contains Column Names.  Also, if you want the Flat File Parser to ignore any of the leading or trailing rows, indicate how many of each row to ignore:
    Flat-file-parser8
  2. Unlike the preview pane for fixed-width files you do not need to set column breaks. This file includes headers in the first row.  Click Next:
    Flat-file-parser9
  3. When you check the “First Row Contains Column Names” checkbox, the column names are automatically populated. However, you can still change these names on the Column Details page.  After confirming the column details, click Finish to close the wizard.
    Flat-file-parser10

After finishing the wizard, the flat file definition is stored as a process property.  You can re-run the wizard and see the same values you selected the previous time you ran it.

To test the Flat File Parser, use the Process Tester and use the same sample data you used when running the Wizard.