---
schema_version: "1"
id: f34eefeaefe7e5704038998a094dac805996d4a7d996381e83347919129f2b66
title: Fixed Width Format
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dataweave-formats-fixedwidth.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dataweave-formats-fixedwidth
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 43b3c75d75b3ea1742aec93f68ed6756b581a72d75651d22702be608b42fb181
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# Fixed Width Format

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

MIME Type: `application/flatfile`

ID: `flatfile`

Fixed width types are technically considered a type of Flat File format, but when selecting this
option, the Transform component offers you settings that are better tailored to the needs of this
format.

> [!NOTE] Fixed width in DataWeave supports files of up to 15 MB, and the memory requirement is
> roughly 40 to 1. For example, a 1-MB file requires up to 40 MB of memory to process, so it’s
> important to consider this memory requirement in conjunction with your TPS needs for large fixed
> width files. This is not an exact figure; the value might vary according to the complexity of the
> mapping instructions.

## Configuration Properties

DataWeave supports the following configuration properties for this format.

### Reader Properties

This format accepts properties that provide instructions for reading input data.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>allowLenientWithBinaryNotEndElement</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>When the schema contains elements of type Binary or Packed, the <code>lenient</code> option does not allow short records, regardless of the last element’s format type. When you set this property to <code>true</code>, the validation applies only to cases in which the record ends with type Binary or Packed.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>enforceRequires</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Produces an error when set to <code>true</code> if a required value is missing.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>missingValues</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Fill character used to represent missing values. To activate a non-default setting, set the <code>useMissCharAsDefaultForFill</code> property to <code>true</code>, and use one of the following values to <code>missingValues</code>:</p></div><div><ul><li><p><code>none</code> (for the reader) or <code>NONE</code> (for the writer): Treats all data as values.</p></li><li><p><code>spaces</code> (for the reader) or <code>SPACES</code> (for the writer): Interprets a field consisting of only spaces as a missing value. Default for flat file and fixed-width formats.</p></li><li><p><code>zeroes</code> (for the reader) or <code>ZEROES</code> (for the writer): Interprets numeric fields consisting of only <code>0</code> characters <em>and</em> character fields consisting of only spaces as missing values.</p></li><li><p><code>nulls</code> (for the reader) or <code>NULLS</code> (for the writer): Interprets a field consisting only of <code>0</code> bytes as a missing value. Default for COBOL copybook schema.</p></li></ul></div></div></td></tr><tr><td><p><code>notTruncateDependingOnSubjectNotPresent</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Fills the entire group when the DEPENDING ON subject is not present.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>recordParsing</code></p></td><td><p><code>String</code></p></td><td><p><code>'strict'</code></p></td><td><div><div><p>Specifies the expected type of separation between lines or records:</p></div><div><ul><li><p><code>strict</code>: Line break is expected at exact end of each record. <code>strict</code> is the default.</p></li><li><p><code>lenient</code>: Line break is used, but records can be shorter or longer than the schema specifies. Do not use <code>lenient</code> if your payload lacks line breaks. The other options to <code>recordParsing</code> support records that lack line breaks.</p></li><li><p><code>noTerminator</code>: Records follow one another with no separation. This option is preferred for fixed-length records that lack a line break.</p></li><li><p><code>singleRecord</code>: The entire input is a single record.</p></li></ul></div><div><p>Note that schemas with type <code>Binary</code> or <code>Packed</code> don’t allow for line break detection, so setting <code>recordParsing</code> to <code>lenient</code> only allows long records to be handled, not short ones. These schemas also currently only work with certain single-byte character encodings (so not with UTF-8 or any multibyte format).</p></div></div></td></tr><tr><td><p><code>retainEmptyStringFieldsOnParsing</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Allow parsing behavior to keep missing string value fields with a default value in the output map</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>schemaPath</code> (Required)</p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Path to the schema definition. Specifies the location in your local disk of the schema file that parses your input.</p></div></div></td></tr><tr><td><p><code>segmentIdent</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Segment identifier in the schema for fixed-width or COBOL copybook schemas. Required when parsing a single segment or record definition if the schema includes multiple segment definitions.</p></div></div></td></tr><tr><td><p><code>structureIdent</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Structure identifier in the schema for flat file schemas. Required when parsing a structure definition if the schema includes multiple structure definitions.</p></div></div></td></tr><tr><td><p><code>truncateDependingOn</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>For COBOL copybook, truncates DEPENDING ON values to the length used.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>useMissCharAsDefaultForFill</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>By default, the flat file reader and writer use spaces for missing characters and ignore the setting of the <code>missingValues</code> property. When you set this property to <code>true</code>, DataWeave honors the setting of the <code>missingValues property</code>. Introduced in DataWeave 2.3 (2.3.0-20210823) for the September 2021 release of Mule 4.3.0-20210823.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>zonedDecimalStrict</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>For COBOL copybook, uses the 'strict' ASCII form of sign encoding for zoned decimal values.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

### Writer Properties

This format accepts properties that provide instructions for writing output data.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>bufferSize</code></p></td><td><p><code>Number</code></p></td><td><p><code>8192</code></p></td><td><div><div><p>Size of the buffer writer, in bytes. The value must be greater than <code>8</code>.</p></div></div></td></tr><tr><td><p><code>deferred</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Generates the output as a data stream when set to <code>true</code>, and defers the script’s execution until the generated content is consumed.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>encoding</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>The encoding to use for the output, such as UTF-8.</p></div></div></td></tr><tr><td><p><code>enforceRequires</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Produces an error when set to <code>true</code> if a required value is missing.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>missingValues</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Fill character used to represent missing values. To activate a non-default setting, set the <code>useMissCharAsDefaultForFill</code> property to <code>true</code>, and use one of the following values to <code>missingValues</code>:</p></div><div><ul><li><p><code>none</code> (for the reader) or <code>NONE</code> (for the writer): Treats all data as values.</p></li><li><p><code>spaces</code> (for the reader) or <code>SPACES</code> (for the writer): Interprets a field consisting of only spaces as a missing value. Default for flat file and fixed-width formats.</p></li><li><p><code>zeroes</code> (for the reader) or <code>ZEROES</code> (for the writer): Interprets numeric fields consisting of only <code>0</code> characters <em>and</em> character fields consisting of only spaces as missing values.</p></li><li><p><code>nulls</code> (for the reader) or <code>NULLS</code> (for the writer): Interprets a field consisting only of <code>0</code> bytes as a missing value. Default for COBOL copybook schema.</p></li></ul></div></div></td></tr><tr><td><p><code>notTruncateDependingOnSubjectNotPresent</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Fills the entire group when the DEPENDING ON subject is not present.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>recordTerminator</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Line break for a record separator. Valid values: <code>lf</code>, <code>cr</code>, <code>crlf</code>, <code>none</code>. Note that in Mule versions 4.0.4 and later, this is only used as a separator when there are multiple records. Values translate directly to character codes (<code>none</code> leaves no termination on each record).</p></div></div></td></tr><tr><td><p><code>schemaPath</code> (Required)</p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Path to the schema definition. Specifies the location in your local disk of the schema file that parses your input.</p></div></div></td></tr><tr><td><p><code>segmentIdent</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Segment identifier in the schema for fixed-width or COBOL copybook schemas. Required when parsing a single segment or record definition if the schema includes multiple segment definitions.</p></div></div></td></tr><tr><td><p><code>structureIdent</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Structure identifier in the schema for flat file schemas. Required when parsing a structure definition if the schema includes multiple structure definitions.</p></div></div></td></tr><tr><td><p><code>trimValues</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Trim values that are longer than the width of a field.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>truncateDependingOn</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>For COBOL copybook, truncates DEPENDING ON values to the length used.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>useMissCharAsDefaultForFill</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>By default, the flat file reader and writer use spaces for missing characters and ignore the setting of the <code>missingValues</code> property. When you set this property to <code>true</code>, DataWeave honors the setting of the <code>missingValues property</code>. Introduced in DataWeave 2.3 (2.3.0-20210823) for the September 2021 release of Mule 4.3.0-20210823.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>zonedDecimalStrict</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>For COBOL copybook, uses the 'strict' ASCII form of sign encoding for zoned decimal values.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

## Supported MIME Types (for Fixed Width)

The Fixed Width format supports the following MIME types.

<table><colgroup><col></colgroup><thead><tr><th>MIME Type</th></tr></thead><tbody><tr><td><p><code>*/flatfile</code></p></td></tr></tbody></table>
