I remember one day when Doug was in the office in Sacramento asking him a question, and him needing to go look at the source code. So we walked into his office and he booted up his PC. At the time, before Windows 95, our PCs had Windows 3.1 which ran on top of DOS. I was a bit surprised after the machine completely booted up with the Windows graphical interface to watch Doug go to the top of the screen and close the graphical user interface. He wanted to get back to the DOS prompt so he would be able to work. This fact speaks a great deal about removing layers between him and the machine.
The Format phase program is a generalized control break engine, a very different kind of program than the extract program. Control break logic is what performs a “group by” function in a database, or a “sum fields” function in a sort utility. It collapses a set of records with the same key together to produce a subtotal of some kind, and then performs the same function on the next set of rows.
The Extract Record was created to support this control break logic. It is vital to understand it’s structure before understanding the remaining logic table functions, and the remaining processes of the SAFR Scan Engine.
Extract Record Overview
I have created view 3264 and specified that it use the Format Phase. This changes some of the function codes that are used in the extract phase.
The extract records are written to Extract Files, temporary files between the Extract Phase and the Format Phase. The Extract Record has the following general layout.
- The control area contains values that describe the rest of the record, like the number of SAFR view columns on this record, and the length of the sort key. The last field in the control area is the view number. We’ll explain why later.
- The Sort Key or SK area contains the values the user has specified the output file should be sorted and/or grouped by.
- The Data Transform or DT area contains alphabetic and alphanumeric and numeric column data that is not used in a format time calculation, including sub-totaling, or format time selection logic.
- The Calculated Transform or CT area contains column data that is either used in a format time calculation, including sub-totaling, or format time selection logic.
With this understanding, let’s look at the logic table for a view requiring the format phase.
Logic Table Phase
The following graph shows these additional functions.1
Extract Phase
The following is the Extract Phase Logic Table Trace for view 3264 for the first event file record.
The following is the first extract record for this view shown in hex format:
Only one view wrote to EXTR001. But each extract file also receives a Control Record which has a count of all the records written to the extract file. This record is the last record written to the extract file. Thus the total records written to the extract file is 15.2
At the conclusion of the Extract Phase, the following extract records are contained in the file, plus the header and control records.
Parent Topic: Part 5. The Programmer