Mapping of Hierarchical Record Structures
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.
Even flat files can have a hierarchical record structure, means that the file contains different record types. This structure can be directly expressed in class diagrams by associations between <<FlatFileRecord>> classes.
See, for example, an order file class structure for a file containing order, order line and stock data:
Figure: Flat File Hierarchical Record Structures
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. |
3 OrderLine | ^PRODQNTY. | All record lines starting with
are OrderLine records. |
4 Stock | ^LOCNQNTY.* | All record lines starting with LOCNQNTY are Stock records. |
5 EndRecord | END | All records containing END are EndRecords. |
An example file for this structure could be the following:
ORDER 1234567 MYER 19990823 19990825 19990903 4631
PRODQNTY 1 PRD004 6 25.52 EA C I
LOCNQNTY 204 6
PRODQNTY 2 PRD001 9 25.52 EA C I
LOCNQNTY 202 4
LOCNQNTY 204 3
LOCNQNTY 211 2
PRODQNTY 3 PRD002 10 127.99 EA C I
LOCNQNTY 202 2
LOCNQNTY 204 1
LOCNQNTY 207 3
LOCNQNTY 211 4
END