Fixed-Width File Formats
You can create and save fixed-width file formats that specify the formatting details for fixed-width flat files.
You can use a fixed-width flat file as a source or target in mappings and Mapping Configuration tasks. When you select a flat file connection for a Source transformation or Target transformation, you specify the flat file type. If you select the fixed-width flat file type, you select the most appropriate fixed-width file format to use based on the data in the fixed-width flat file.
You can create multiple fixed-width file formats. For example, you might have a fixed-width file format to use for fixed-width flat files that contain quarterly sales data and another fixed-width file format to use for fixed-width flat files that contain inventory data.
If a fixed-width file format does not already exist, you must create a fixed-width file format before you create a mapping or Mapping Configuration task that uses a fixed-width flat file.
To configure a fixed-width file format, you specify the number of columns and the width, name, and datatype for each column. You can also set advanced fixed-width format properties. For example, you can specify how to handle null characters or specify the default date format for each column.
You can delete fixed-width file formats that you no longer use. You cannot delete a fixed-width file format that is used in a mapping or Mapping Configuration task.
Configuring a Fixed-Width File Format
Create fixed-width file formats that you can use for flat files in Source and Target transformations.
1. Click Configure > Fixed Width File Formats.
2. To create a fixed-width file format, click New. To edit a fixed-width file format, click the Edit icon next to the fixed-width file format.
3. Enter the fixed-width file format details.
Field | Description |
---|
Configuration Name | The name of the fixed-width file format. |
Description | Optional. Description of the fixed-width file format. |
4. Specify the connection and flat file to use as a sample as you configure the format options.
Field | Description |
---|
Sample Flat File Connection | The connection to the sample file that you use to specify the fixed-width format. |
Sample Object | The sample file that you use to specify the format options. The data in the sample file appears on the page to help you determine the appropriate format options for your data. The format options that you specify do not alter or save the sample file. |
5. Configure the column boundaries to fit the data in your sample file. You can enter the boundaries in the Column boundaries field or you can position the boundaries using the ruler. Each mark on the ruler represents a byte.
- - To configure column boundaries in the Column boundaries field, enter the number of bytes to determine the width of the first column. Then enter boundaries for the subsequent columns. Separate each value with a comma. Press Enter after you enter a boundary to see the placement of the boundary on the ruler.
- - To configure column boundaries using the ruler, use the mouse to drag the boundary to the appropriate location on the ruler for the first column. To add new boundaries, click the ruler or click the Add icon. Use the mouse to drag boundaries to the appropriate position on the ruler as necessary.
The following image shows boundaries configured for three columns:
6. To specify column names and data types, click Edit Columns and then enter the column name and select the data type for each column.
7. To specify advanced properties, click Additional Attributes and specify the following properties:
Property | Description |
---|
Line sequential | Ends each row with a newline character. Must be enabled when you use a fixed-width file format for a flat file source or target object. Line sequential is enabled by default. |
Number of rows to skip | Use this setting to skip blank or header rows. |
Number of bytes to skip after column ending | Number of bytes between the last column of one row and the first column of the next. |
Null character type | Specify whether the null character is text or ASCII code. |
Null character | The character to represent a null value. |
Repeat null character | Reads repeat null characters in a single field as a single null value. |
Strip trailing blanks | Removes trailing blanks from string values. |
Default Date Format | Date format to use for the column when a date format is not specified in the flat file connection. To specify the default date format, enter the following information: - - Whether the field width is adjusted or fixed. Enter A for adjusted width or F for fixed width.
- - The field width in bytes.
- - The date format.
For example, if you want the format to be fixed width with a width of 12 bytes and date format of DD/MM/YYYY, enter the following text: F 12 DD/MM/YYYY |
8. Click OK. A summary of the format options for the fixed-width file format appears.