%dw 2.0
output application/flatfile schemaPath="src/main/resources/test-data/QBReqRsp.esl", structureIdent="QBResponse"
---
payload
Flat File Format
MIME type: application/flatfile
ID: flatfile
The Flat File format supports multiple types of fixed width records within a single message. The schema structure allows you to define how different record types are distinguished, and how the records are logically grouped.
Flat File 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 flat files. This is not an exact figure; the value might vary according to the complexity of the mapping instructions. |
Example: Specify a Flat File Schema
This example shows a DataWeave script that outputs data in the Flat File format.
Notice that it uses the schemaPath
and structureIndent
writer properties.
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.
Parameter | Type | Default | Description |
---|---|---|---|
|
|
|
When the schema contains elements of type Binary or Packed, the |
|
|
|
Error if required value missing.
Valid values are |
|
|
|
Fill character used to represent missing values. To activate a non-default setting, set the
|
|
|
|
Fills the entire group when the DEPENDING ON subject is not present. Introduced in DataWeave 2.3 with the August 2021 release of Mule 4.3.0-20210622. |
|
|
|
Expected separation between lines/records:
Note that schemas with type |
|
|
|
Schema definition. Location in your local disk of the schema file used to parse your input. |
|
|
|
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). |
|
|
|
Structure identifier in schema for flatfile schemas (only needed when parsing a structure definition, and if the schema includes multiple structure definitions) |
|
|
|
Truncate COBOL copybook DEPENDING ON values to the length used. Valid values are |
|
|
|
By default, the flat file reader and writer use spaces for missing characters and ignore the setting of the |
|
|
|
Use the |
Writer Properties
DataWeave accepts properties that provide instructions for writing output data in this format.
Parameter | Type | Default | Description |
---|---|---|---|
|
|
|
Size of the buffer writer. |
|
|
|
When set to |
|
|
|
Encoding to be used by this writer,
such as |
|
|
|
Error if a required value is missing.
Valid values are |
|
|
|
Fill character used to represent missing values. To activate a non-default setting, use
|
|
|
|
Fills the entire group when the DEPENDING ON subject is not present. Introduced in DataWeave 2.3 with the August 2021 release of Mule 4.3.0-20210622. |
|
|
System property |
Record separator line break. Valid values:
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.
( |
|
|
|
When set to |
|
|
|
Schema definition. Path where the schema file to be used is located. |
|
|
|
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). |
|
|
|
Structure identifier in schema for flatfile schemas (only needed when writing a structure definition and if the schema includes multiple structure definitions) |
|
|
|
Trim string values longer than the field length by truncating trailing characters. Valid values are |
|
|
|
Indicates whether trim values are longer than the field width. Valid Options are |
|
|
|
Truncate COBOL copybook DEPENDING ON values to the length used. Valid values are |
|
|
|
By default, the flat file reader and writer use spaces for missing characters and ignore the setting of the |
|
|
|
Use the |