Flat files can have a hierarchical record structure, meaning that the file contains different record types. This structure can be expressed by associations between FlatFileRecord classes.
FlatFileAdapter_Hierarchic_Example
Click the icon to download a simple example model that shows how to compose a hierarchic flat file with the Flat File adapter in Scheer PASDesigner.
For example, this is an order file class structure for a file containing orders, order lines and stock data:
The flat file parser identifies each FlatFileRecord class by a regular expression found in the tagged value pattern. This pattern applies to the complete record (data line of the file). If the classes are placed in a hierarchical order, the flat file records must follow this order to be parsed correctly. If they do not, the parser stops at the first record not matching the expected pattern.
Flat File Record
Pattern
Description
2 Order
^ORDER.*
All record lines starting with ORDER are Order records.
3OrderLine
^PRODQNTY.*
All record lines starting with
PRODQNTY are OrderLine records.
4 Stock
^LOCNQNTY.*
All record lines starting with LOCNQNTY are Stock records.
5 EndRecord
END
All records containing END are EndRecords.
You can realize the hierarchical structure as classes in the Implementation folder:
An example file for this structure could be the following: