The Flat File adapter parse action processes the parsing of a flat file in the following steps:
Step | Description |
---|
open | Open file or blob. |
file | Create <<FlatFile>> object. |
fetch | Fetch first record. |
check
|
| Go through all associations (<<FlatFileRecord>> and <<FlatFileGroup>> classes) until the first one matches depending on the tagged values evaluationOrder, lineNuber, condition, and pattern. |
out |
| If no association matches, step out of the recursion and go to step check, abort with an error if there is no parent. |
group |
| If a group matches, create a <<FlatFileGroup>> object and goto step check. |
record |
| If a record matches, create a <<FlatFileRecord>> object. |
attribute | If the <<FlatFileRecord>> class has attributes, process attributes using current record data. |
next | Fetch next record. |
close | Close file and end Flat File Adapter. |
The following example shows the parsing process for a given class diagram. The names in the figure refer to the actions in the above table.
Figure: Flat File Adapter Parsing Process
![](/download/attachments/2287515/flat_file_parsing_process.png?version=1&modificationDate=1509716067000&api=v2)
Inspecting the Parsing Process With the Scheer PAS ANALYZER
You can inspect the parsing process of the Flat File Adapter with the Analyzer. To view the parser trace file:
- Run a testcase with Full Trace option
- Open the UML Tab in the Analyzer
- Navigate to the activity diagram that contains the Flat File Adapter action.
- Click on the <<FlatFileAdapter>> action.
- Select Show adapter input/output > OUTPUT from the context menu.
The adapter output will be displayed in the Watches section of the Analyzer.
![](/download/attachments/2287515/flat_file_parser_analyzer.png?version=1&modificationDate=1509716066000&api=v2)
- Right-click the displayed adapter output output and select Copy Value from the context menu.
- Paste the copied content into a text editor of your choice.
![](/download/attachments/2287515/flat_file_parser_log.png?version=1&modificationDate=1509716066000&api=v2)
The output text shows the detail of the parsing process.
Step | Log Item |
---|
First of all, it shows the <<FlatFile>> class that is going to hold the result of the parsing process. | Start parsing flat file class "urn:Services.Classes.HierarchicalFile.OrderFile" |
Then, it shows the pattern to be matched and the record that matches the pattern - if there is one. | "ORDER 1234567 MYER 19990823 19990825 19990903 4631 "
Found record "Orders" (class="urn:Services.Classes.HierarchicalFile.Order"): pattern "^ORDER.*" does match |
If the records are hierarchical nested, the trace log will show the nesting as well by indenting the nested records. | "PRODQNTY 1 PRD004 6 25.52 EA C I " Found record "Lines" (class="urn:Services.Classes.HierarchicalFile.OrderLine"): pattern "^PRODQNTY.*" does match
"LOCNQNTY 204 6" Found record "StockInfos" (class="urn:Services.Classes.HierarchicalFile.Stock"): pattern "^LOCNQNTY.*" does match
"PRODQNTY 2 PRD001 9 25.52 EA C I " Skipped record "StockInfos" (class="urn:Services.Classes.HierarchicalFile.Stock"): pattern "^LOCNQNTY.*" does not match
Found record "Lines" (class="urn:Services.Classes.HierarchicalFile.OrderLine"): pattern "^PRODQNTY.*" does match
|