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

# 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

DataWeave accepts properties that provide instructions for reading input data in this format.

<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></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>Error if required value missing. 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>nulls</code> for copybook schema, <code>spaces</code> otherwise</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>: Treat all data as actual values</p></li><li><p><code>spaces</code>: Interpret a field consisting of only spaces as a missing value</p></li><li><p><code>zeroes</code>: Interpret numeric fields consisting of only '0' characters and character fields consisting of only spaces as missing values</p></li><li><p><code>nulls</code>: Interpret a field consisting only of 0 bytes as a missing value</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. <em>Introduced in DataWeave 2.3 with the August 2021 release of Mule 4.3.0-20210622.</em></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>Expected separation between lines/records:</p></div><div><ul><li><p><code>strict</code>: Line break expected at exact end of each record.</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>: 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>schemaPath</code> (Required)</p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Schema definition. Location in your local disk of the schema file used to parse 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 copybook schemas (only needed when parsing a single segment/record definition and 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 schema for flatfile schemas (only needed when parsing a structure definition, and 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>Truncate COBOL copybook DEPENDING ON values to the length used. 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>, the reader honors the setting of the <code>missingValues</code> property. <em>Introduced in DataWeave 2.3 (2.3.0-20210823) for the September 2021 release of Mule 4.3.0-20210823.</em> 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>Use the <code>strict</code> ASCII form of sign encoding for COBOL copybook zoned decimal values. Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

### Writer Properties

DataWeave accepts properties that provide instructions for writing output data in this format.

<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.</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>When set to <code>true</code>, DataWeave generates the output as a data stream, and the script’s execution is deferred until it is consumed. 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>Encoding to be used by this writer, such as <code>UTF-8</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>Error if a required value is missing. 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>NULLS</code> for copybook schema, <code>SPACES</code> otherwise</p></td><td><div><div><p>Fill character used to represent missing values. To activate a non-default setting, use <code>useMissCharAsDefaultForFill</code>, and use one of the following values to <code>missingValues</code>:</p></div><div><ul><li><p><code>NONE</code>: Write nothing for missing values.</p></li><li><p><code>SPACES</code>: Fill the field with spaces.</p></li><li><p><code>ZEROES</code>: Fill numeric fields with <code>0</code> characters and character fields with space characters.</p></li><li><p><code>NULLS</code>: Fill the field with 0 bytes.</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. <em>Introduced in DataWeave 2.3 with the August 2021 release of Mule 4.3.0-20210622.</em></p></div></div></td></tr><tr><td><p><code>recordTerminator</code></p></td><td><p><code>String</code></p></td><td><p>System property <code>line.separator</code></p></td><td><div><div><p>Record separator line break. Valid values:</p></div><div><ul><li><p><code>lf</code></p></li><li><p><code>cr</code></p></li><li><p><code>crlf</code></p></li><li><p><code>none</code></p></li></ul></div><div><p>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>retainEmptyStringFieldsOnParsing</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>When set to <code>true</code>, this property makes the reader retain fields that lack values and set their values to an empty string. The default behavior of the reader is to remove those fields. <em>Introduced in the January 2023 version of DataWeave 2.4 for Mule version 4.4.0-20230102.</em></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>Schema definition. Path where the schema file to be used is located.</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 copybook schemas (only needed when writing a single segment/record definition, and 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 schema for flatfile schemas (only needed when writing a structure definition and 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 string values longer than the field length by truncating trailing characters. Valid values are <code>true</code> or <code>false</code>.</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>Indicates whether trim values are longer than the field width. Valid Options 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>Truncate COBOL copybook DEPENDING ON values to the length used. 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>, the writer honors the setting of the <code>missingValues</code> property. <em>Introduced in DataWeave 2.3 (2.3.0-20210823) for the September 2021 release of Mule 4.3.0-20210823.</em></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>Use the <code>strict</code> ASCII form of sign encoding for COBOL copybook zoned decimal values. 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>
