This page explains the Flat File Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to Flat File Adapter in the Designer guide.

Sometimes, flat files contain records without any data but just the field separators, like in line 4 to 7 of this example below:

Figure: Flat File Records without Data

There are two ways to skip the records containing no data.

Handle Empty Records With a Pattern

Specify a pattern in tagged value pattern that only matches with the records having data. In our example, the regular expression ^[^;].* supposes that a record is without data when it starts with a separator.

 Figure: Flat File – Exclude Records Without Data

The flat file parser will abort parsing when a record does not match any <<FlatFileRecord>> class. Thus we have to specify a <<FlatFileRecord>> class for the records without data as well.

Class NoData has no pattern. Actually it matches all records, including the records containing data. Thus, it is important to set tagged value evaluationOrder to ensure that this record type will be parsed last on parsing the records.
NoData has no attributes defined, therefore no fields are parsed. Thus, the object of type noData would be created without having any content. To avoid such empty records, set tagged value ignoreEmptyRecords=true on NoData class.

Use Tagged Values on the <<FlatFileRecord>> Class

Use a combination of tagged values ignoreEmptyStrings and ignoreEmptyRecords on the <<FlatFileRecord>> class.

Figure: Flat File – Ignore Empty Records and Strings

Ignoring empty strings will lead to the Flat File Adapter processing empty strings to NULL, and ignoring empty records will lead to the Flat File Adapter not processing a record, if it has no data.

Note, that a record containing only empty Strings is not empty – in opposition to a record composed from NULLs.

  • No labels