Learning to Drive the "CAR" That Started It All

Over the years, the basis for FOCUS reporting examples in the product documentation often has been the CAR file, a simple structure with basic data elements for tracking new car sales.

The familiar data fields, such as country, make, model, bodytype, seats, retail_cost, and dealer_cost, provide a flexible context for illustrating FOCUS data processing concepts with reasonable assurance that readers will understand the concepts. The underlying FOCUS database structure and relationships between the various data elements are described in a Master File Description (MFD).

As has always been the case, understanding what goes into the MFD is the first step to using FOCUS successfully.

Master File Descriptions are comma-delimited files, with commas separating the pertinent data values. Each master has a single file level containing two keywords that name the file and tell how it was created and stored. FILENAME contains the name, and SUFFIX reveals how the data was created and stored, be it with a sequential or flat file, a VSAM, FOCUS (FOC), or a third-party database management system such as DB2 or Oracle. As you probably know, FOCUS can read most popular data sources.

Here is the the CAR Master File description:

FILENAME=CAR,SUFFIX=FOC                     
SEGNAME=ORIGIN,SEGTYPE=S1                   
     FIELDNAME=COUNTRY,COUNTRY,A10,FIELDTYPE=I,$
SEGNAME=COMP,SEGTYPE=S1,PARENT=ORIGIN       
     FIELDNAME=CAR,CARS,A16,$                   
SEGNAME=CARREC,SEGTYPE=S1,PARENT=COMP       
     FIELDNAME=MODEL,MODEL,A24,$                
SEGNAME=BODY,SEGTYPE=S1,PARENT=CARREC       
    FIELDNAME=BODYTYPE,TYPE,A12,$              
    FIELDNAME=SEATS,SEAT,I3,$                  
    FIELDNAME=DEALER_COST,DCOST,D7,$           
    FIELDNAME=RETAIL_COST,RCOST,D7,$           
    FIELDNAME=SALES,UNITS,I6,$                 
SEGNAME=SPECS,SEGTYPE=U,PARENT=BODY         
   FIELDNAME=LENGTH,LEN,D5,$                  
   FIELDNAME=WIDTH,WIDTH,D5,$                 
   FIELDNAME=HEIGHT,HEIGHT,D5,$               
   FIELDNAME=WEIGHT,WEIGHT,D6,$               
   FIELDNAME=WHEELBASE,BASE,D6.1,$            
   FIELDNAME=FUEL_CAP,FUEL,D6.1,$             
   FIELDNAME=BHP,POWER,D6,$                   
   FIELDNAME=RPM,RPM,I5,$              
   FIELDNAME=MPG,MILES,D6,$            
   FIELDNAME=ACCEL,SECONDS,D6,$        
SEGNAME=WARANT,SEGTYPE=S1,PARENT=COMP
   FIELDNAME=WARRANTY,WARR,A40,$       
SEGNAME=EQUIP,SEGTYPE=S1,PARENT=COMP 
   FIELDNAME=STANDARD,EQUIP,A40,$    

The second level of the MFD contains the keywords SEGNAME and SEGTYPE, which describe the logical grouping of the data, relative to the segment "key." The SEGTYPE key tells how many of the first n fields make that data unique.

A SEGTYPE of S1, for example, identifies the first field as the key for that data group and indicates that it is stored in ascending order. A value of S2 identifies the first two fields as the key for that segment. A SEGTYPE key containing an H, such as SH1, shows that the first field is the key and the data is stored in descending (high to low) order.

The final keyword in all but the first SEGNAME declaration is PARENT, which defines data grouping dependencies within the given segment. For example, the SEGNAME=ORIGIN contains COUNTRY information and may own one or more occurrences of SEGNAME=COMP, which contains CAR information belonging to that country. Having three segments under CAR implies three independent paths of CAR data Each BODY segment has a unique SPECS segment (U) containing its physical specifications.

STRUCTURE OF FOCUS FILE CAR   
                                               
        ORIGIN                               
  01    S1                                   
 **************                                
 *COUNTRY     **I                              
 *            **                               
 *            **                               
 *            **                               
 *            **                               
 ***************                               
  **************                               
        I COMP                                 
  02    I S1                                   
 **************                                
 *CAR         **                               
 *            **             
 *            **                                      
 *            **                                      
 ***************                                      
  **************                                      
        I                                             
        +-------------------+-------------------+         
        I CARREC            I WARANT            I EQUIP   
  03    I S1          06    I S1           07   I S1      
 **************      **************       **************   
 *MODEL       **     *WARRANTY    **      *STANDARD    **  
 *            **     *            **      *            **  
 *            **     *            **      *            **  
 *            **     *            **      *            **  
 *            **     *            **      *            **  
 ***************     ***************      ***************  
  **************      **************       **************            
        I
        I BODY       
  04    I S1         
 **************      
 *BODYTYPE    **     
 *SEATS       **     
 *DEALER_COST **     
 *RETAIL_COST **     
 *            **     
 ***************     
  **************     
        I SPECS  
  05    I U          
 **************      
 *LENGTH      *      
 *WIDTH       *      
 *HEIGHT      *      
 *WEIGHT      *      
 *            *      
 **************      

Each logical data grouping under a SEGNAME may have one or more FIELDNAME keywords providing detailed information about the stored fields. The order of these keywords is FIELDNAME/ALIAS/FORMAT. For example, an alternate name for accessing a FIELD is ALIAS, which in the case of DEALER_COST (see BODY) is DCOST.

An ALIAS may be shorter or longer than a FIELDNAME to avoid unnecessary typing or confusion. The final keyword, FORMAT, describes the physical representation of the data on a report. In our sample CAR file, the FORMAT keyword itself is not shown, but we know that the format value immediately follows the alias value. So in the case of DEALER_COST, the field immediately following the ALIAS, DCOST, is D7. Data can be stored numerically as alphanumeric (A), integer (I), packed (P), floating point single precision (F), floating point double precision (D) or DATE values. Each FIELDNAME definition terminates with a .

The CAR Master File Description that comes with FOCUS includes both data and a FOCEXEC for populating the database. On VM/CMS, the data is stored as CCARS DATA F, assuming FOCUS was installed on the F mini-disk.

On MVS, the data is stored as member CCARS in the file Allocated to DDNAME = MASTER. This comma-delimited flat file contains 70 records for loading the CAR file. The load procedure is called CARTEST and it also resides on the F disk on CMS and as member CARTEST in the file assigned to DDNAME = FOCEXEC.

This procedure initializes and reloads the CAR file with five countries, 10 cars, 18 models and 18 body types. It then performs several retrieval functions to validate the loaded data, including:

A TABLE request that summarizes data
A TABLE request that extracts detail data and creates an extract file
A TABLEF request that summarizes the extracted detail data
A TABLE request that uses summarization and record selection
A SCAN command that edits the FOCUS file
A TABLE request that prints a financial report
A GRAPH that produces a point plot

These retrievals quickly test many of the major areas of FOCUS to confirm a correct installation and implementation of the software.

Back Next