Previous Topic: The Historical Database

Next Topic: TITLE Statement


History Files

The history file name indicates that the user wants to build an output file with the report. There are two kinds of history files:

The first kind is the detail level history file. It is an archive or database of all accounting information (not just the information output on the report being created.) The output of the VM Interface's translate component is a detail level history file. It includes all the data in the raw VM accounting data, but no dollar charges (since rates are not supplied to the translate component). If you wish to preserve the charges you apply with VMRATE and/or FORMRATE statements, you may create a detail level history file as output from the report writer. This file may be used as input for future reports.

The second type of history file is a summary level history file that creates an output file of summary line information. It is useful for creating subsequent periodic or year-to-date reports with little effort. The summary level history file can be created at any sort level from 1 to 5. Note that a level-3 summary file, for example, also contains information that may be summarized mathematically for sort levels 1 and 2.

The history level flag defines the kind of history file to be created and at which level. A level 1-5 flag refers to the corresponding sort control level for a summary level history file. Requesting a level-7 (detail level) history file causes the report writer to produce an output history file that includes any charges you have applied. This output file is otherwise the same as the file produced by the translate program.

Summary Level History File Example

The following example illustrates how to create a summary level history file:

                   Points to Start Date in
                   Basic Accounting Table
                               │
                               │
Points to Account Number       │  ┌────── Points to Start Time in
in Basic Accounting Table      │  │       Basic Accounting Table
               │               │  │
               │        ┌──────┘  │
               │        │         │                               History
               │        │         │                              File Name
               │        │         │                                 │
               ▼        ▼         ▼                                 ▼
          ┌────────┐┌────────┐┌────────┐                       ┌──────────┐
ASORT     │07708AE1││04306A21││03702A21│                       │HISTORY  2│
          └────────┘└────────┘└────────┘                       └──────────┘
               ▲        ▲         ▲                                 ▲
               │        │         │                                 │
             First   Second    Third                           History Level
             Sort    Sort      Sort                                Flag
             Level   Level     Level

In this example, the user requested that history records be generated for each change in the second sort control field as indicated by the History Level Flag 2. Each time this sort control field (Start Date) changes, a record is written to the history file defined by the file name HISTORY. To use this SORT statement, you would include a FILEDEF command in the CAIJV050 EXEC that defines the name HISTORY, for instance:

FILEDEF HISTORY DISK REPAHIST DATA A4 ( RECFM VB LRECL 8188 BLKSIZE 8192

Report A is sorted on three levels. The most general level is Account Number (starting at position 77 in the Basic Accounting Table), sorted in ascending order on the first 8 positions. CA JARS ejects to a new page after printing summary lines, and includes a descriptive header.

The second sort level is start date (starting position 43), a 6-character field sorted in ascending order. CA JARS double spaces before printing summary lines and includes a descriptive header.

The third sort level is start time (starting position 37 in the Basic Accounting Table). It is 2 characters long (the hours portion), sorted in ascending order. CA JARS double spaces before printing summary lines and includes a descriptive header. Note that reports designed to use the history file as input does not provide information to any level of detail greater than that specified at the time the history file was created. The following examples explain this statement:

Summary Level History Flag Example #1

Sort Definitions:              Level 1:  account number
                               Level 2:  start date

History File Name:             HIST001

History Level Flag:            1

A history file (ddname HIST001) is generated during the formatting of this report. Each time the first level sort control field changes (each new account number), a record is output to HIST001, summarizing information for the previous account. Assuming there are 50 different account numbers to be reported on, there are 50 records generated and written to HIST001. Only those data elements that can be logically added up for totals contain values. The data element corresponding to the sort control field also has a value. In this case, each history record contains an account number in the appropriate field since it was used as the sort control field definition. The ddname HIST001 must be defined in a FILEDEF command before you run the Report Writer (see the CAIJV050 EXEC).

Summary Level History Flag Example #2

Same parameters as in Example #1 with the following exception:

History Level Flag:            2

This example shows the importance of choosing Sort Definitions and a corresponding history level flag wisely when creating a history file. In the previous example, each record generated contained an account number because the history level flag caused history records to be generated at the first level. However, in that example, since start date is not logically additive and is a subordinate sort definition to that specified by the history flag, no output records contain a start date. Obviously, this could be a problem in subsequent reporting if it becomes necessary to identify or report on start date.

In Summary Level History Flag Eample #2, the history flag is set so that a record is generated and written to HIST001 each time the second level sort control field changes (each new start date). Since start date is subordinate to account number, each record generated also contains the appropriate account number. More records are written to HIST001 (each start date within each account as opposed to each account), but the future flexibility is worth it. If HIST001 is input to the Report Writer, you can sort on account number and/or start date (or any other field that contains valid data) and still maintain integrity in the data by start date.

Note: