Fixed Length File Source

The Fixed-Length File Source object in Centerprise provides a high-speed reader for files containing fixed length records. It supports files with record delimiters as well as files without record delimiters.

Getting Fixed Length Source Object

In this section, we’ll cover how to get Fixed Length File Source object on the dataflow designer from the toolbox.

1. To get a Fixed Length File Source from the Toolbox, go to Toolbox > Sources > Fixed Length File Source. If you’re unable to see the toolbox, go to View > Toolbox or press Ctrl + Alt + X.

../_images/140.png

2. Drag-and-drop the Fixed Length File Source object onto the designer.

../_images/230.png

You can see that the dragged source object is empty right now. This is because we haven’t configured the object yet.

Configuring the Fixed Length File Source Object

1. To configure the Fixed Length File Source object, right-click on its header and select Properties from the context menu.

../_images/320.png

When you select the Properties option from the context menu, a dialog box will open.

../_images/416.png

This is where you configure the properties for Fixed Length File Source object.

2. The first step is to provide the File Path for the fixed length source. By providing the file path you are building the connectivity to the source dataset.

../_images/515.png

Note: In this case we are going to be using a fixed length file that contains Orders sample data. This file works with the following options:

  • File Contains Headers

  • Record Delimiter is specified as

    ../_images/613.png

3. The dialog box has some other configuration options:

  • Options

    ../_images/713.png

    • If the source File Contains Header and you want Centerprise source layout to read headers from the source file, check the box.
    • If you want the file to be read in portions, for instance, your file has data over 1000 rows, on selecting Partition File for Reading, Centerprise will read your file according to the Partition Count that you specify. For example, for a file with 1000 rows, you give the partition count to be 2, it will read your file in two partitions. This is a back-end process that makes data reading more efficient and helps in processing the data faster. This will not have any effect on your output.
    • Record Delimiter box allows you to select the delimiter for the records in the source file. The choices available are carriage-return line-feed combination , carriage-return and line-feed**. You can also type the record delimiter of your choice instead of choosing from the available options.
    • In case the records don’t have a delimiter and you rely on knowing the size of a record, the number in the Record Length box is used to specify the character length for a single record.
    • Encoding box allows you to choose the encoding scheme for the delimited file from a list of choices. The default value is Unicode (UTF-8)
    • Check the This is a COBOL data file box if you are working with COBOL files and do not have COBOL copybooks, you can still import this data by visually marking fields in the layout builder and specifying field data types. For more advanced parsing of COBOL files, you can use Centerprise COBOL File Source.
    • To define hierarchical file layout and process the data file as a hierarchical file check the This is a Hierarchical File box. Centerprise IDE provides extensive user interface capabilities for processing hierarchical structures.
  • Advanced File Options

    ../_images/812.png

    • In the Header spans over option, give the number of rows that your header takes. Refer to this option when your header spans over multiple rows.
    • Check on Enforce exact header match if you want the header to be read as it is.
    • Check on Column order in file may be different from the layout, if the field order in your source layout is different from the field order in Centerprise layout.
    • Check on Column headers in file may be different from the layout if you want to use alternate header values for your fields. The Layout Builder lets you specify alternate header values for the fields in the layout.
    • Check the Use SmartMatch with Synonym Dictionary option when the header values vary in the source layout and Centerprise layout. You can create a Synonym Dictionary file to store the values for alternate headers. You can also use Synonym Dictionary file to facilitate automapping between objects on the flow diagram that use alternate names in field layouts.
  • To skip any unwanted rows at the beginning of your file, you can specify the number of records that you want to omit through the Skip initial records option.

    ../_images/912.png

  • Raw text filter

    ../_images/1013.png

    • If you don’t want to apply any filter and process all records, check on No filter. Process all records.
    • If there is a specific value which you want to filter out, you can check on Process if begins with and give the value that you want Centerprise to read from the data, in the box.
    • If there is a specific expression which you want to filter out, you can check on Process if matches this regular expression and give the expression that you want Centerprise to read from the data, in the box.
  • String Processing

    String processing options come in use when you are reading data from a file system and writing it to a database destination.

    ../_images/11-1575548973619.png

    • Check on Treat empty string as null value when you have empty cells in the source file and want those to be treated as null objects in the database destination that you are writing to, otherwise Centerprise will omit those accordingly in the output.
    • Check on Trim strings when you want to omit any extra spaces in the field value.

4. Once you’ve specified the data reading options on this screen, click Next.

../_images/1213.png

The next screen is your Length Markers screen. You can put marks and specify the columns in your data.

Using the Length Markers screen, you can create the layout of your fixed-length file. To insert a field length marker, you can click in the window at any point. For example, if you want to set the length of a field to contain five characters and the field starts at five, then you need to click at the marker position nine.

../_images/1311.png

Note: In this case we are using a fixed length file with Orders sample data.

  • If you point your cursor to where the data is starting from, (in this case next to OrderID) and double-click on it, Centerprise will automatically detect columns and put markers in your data. Blue lines will appear as markers on the columns that will get detected.

    ../_images/149.png

    You can modify the markers manually. To delete a marker, double-click on the column which has been marked.

    ../_images/1510.png

    In this case we removed the second marker and instead added a marker after CustomerID and EmployeeID.

    In this way you can add as many markers as the number of columns/fields there are in the data set.

    • You can also use the Build from Specs feature to help you build destination fields based on an existing file instead of manually specifying the layout.

      ../_images/169.png

5. After you have built the layout by inserting the field markers, click Next.

../_images/178.png

The next screen will show you a Layout Builder. On this screen, you can modify the layout of your fixed length source file.

../_images/187.png

  • If you want to add a new field to your layout, go to the last row of your layout (Name column), which will be blank and double-click on it, and a blinking text cursor will appear. Type in the name of the field you want to add and select subsequent properties for it. A new field will be added to the source layout.

    ../_images/197.png

    Note: Make sure to specify the length of the field that you’ve added in the properties of the field.

  • If you want to delete a field from your dataset, click on the serial column of the row that you want to delete. The selected row will be highlighted in blue.

    ../_images/207.png

    Right-click on the highlighted line, a context menu will open where you will have the option to Delete.

    21

    Selecting delete will delete the entire row.

    ../_images/2210.png

    The field is now deleted from the layout and won’t appear in the output.

    Note: Modifying the layout (adding or deleting fields) from the layout builder screen in Centerprise will not make any changes to the actual source file. The layout is specific to Centerprise only.

  • Other options that the Layout Builder provides are:

    ../_images/236.png

Column Name Description
Data Type Specifies the data type of a field, such as Integer, Real, String, Date, or Boolean.
Start Position Specifies the position from where that column/field starts.
Length Defines the length of a column/field.
Alignment Specifies the alignment of the values in a column/field. The options provided are “right”, “left” and “center”.
Allows Null Controls whether the field allows blank or NULL values in it.
Expressions Defines functions through expressions for any field in your data.

6. After you’re done customizing the layout on the Object Builder screen, click Next. You will be taken to a new screen - Config Parameters. Here, you can define parameters for the fixed length file source.

Parameters can provide easier deployment of flows by eliminating hardcoded values and provide an easier way of changing multiple configurations with a simple value change.

Note: Parameters left blank will use their default values assigned on the properties page.

../_images/246.png

7. Once you’ve been through all the options to configure, click OK.

../_images/253.png

The FixedLengthFileSource object is now configured.

../_images/263.png

The Fixed Length Source object has now been modified from its previous configuration. The new object has all the modifications that we specified in the layout builder.

In this case, the modifications that we made were:

  • Separated the EmployeeID column from the OrderDate column.
  • Added the CustomerName column.

You have successfully configured your Fixed Length File Source object. The fields from the source object can now be mapped to other objects in a dataflow.