Describing a Partitioned FOCUS Data Source

In this section:

FOCUS data sources can consist of up to 1022 physical files. The horizontal partition is a slice of one or more segments of the entire data source structure. Note, however, that the number of physical files associated with one FOCUS data source is the sum of its partitions and LOCATION files. This sum must be less than or equal to 1022. FOCUS data sources can grow in size over time, and can be repartitioned based on the requirements of the application.


Top of page

x
Intelligent Partitioning

The FOCUS data source supports intelligent partitioning, which means that each vertical partition contains the complete data source structure for specific data values or ranges of values. Intelligent partitioning not only lets you separate the data into up to 1022 physical files, it allows you to create an Access File in which you describe the actual data values in each partition using WHERE criteria. When processing a report request, the selection criteria in the request are compared to the WHERE criteria in the Access File to determine which partitions are required for retrieval.

To select applications that can benefit most from partitioning, look for ones that employ USE commands to concatenate data sources, or for data that lends itself to separation based on data values or ranges of values, such as data stored by month or department. Intelligent partitioning functions like an intelligent USE command. It looks at the Access File when processing a report request to determine which partitions to read, whereas the USE command reads all of the files on the list. This intelligence decreases I/O and improves performance.

To take advantage of the partitioning feature, you must:

Concatenation of multiple partitions is supported for reporting only. You must load or rebuild each physical partition separately. You can either create a separate Master File for each partition to reference in the load procedure, or you can use the single Master File created for reporting against the partitioned data source, if you:

Note: Report requests automatically read all required partitions without user intervention.


Top of page

x
Specifying an Access File in a FOCUS Master File

How to:

Reference:

To take advantage of the partitioning feature, you must edit the Master File and add the ACCESSFILE attribute.

The name of the Access File must be the same as the Master File name, and it must be specified with the ACCESS = attribute in the Master File.



x
Syntax: How to Specify an Access File for a FOCUS Data Source
FILENAME=filename, SUFFIX=FOC, ACCESS[FILE]=accessfile,
.
.
.

where:

filename

Is the file name of the partitioned data source.

accessfile

Is the name of the Access File. This must be the same as the Master File name.



Example: Master File for the VIDEOTR2 Partitioned Data Source
FILENAME=VIDEOTR2,  SUFFIX=FOC,
 ACCESS=VIDEOACX,  $
  SEGNAME=CUST,       SEGTYPE=S1
   FIELDNAME=CUSTID,     ALIAS=CIN,         FORMAT=A4,          $
   FIELDNAME=LASTNAME,   ALIAS=LN,          FORMAT=A15,         $
   FIELDNAME=FIRSTNAME,  ALIAS=FN,          FORMAT=A10,         $
   FIELDNAME=EXPDATE,    ALIAS=EXDAT,       FORMAT=YMD,         $
   FIELDNAME=PHONE,      ALIAS=TEL,         FORMAT=A10,         $
   FIELDNAME=STREET,     ALIAS=STR,         FORMAT=A20,         $
   FIELDNAME=CITY,       ALIAS=CITY,        FORMAT=A20,         $
   FIELDNAME=STATE,      ALIAS=PROV,        FORMAT=A4,          $
   FIELDNAME=ZIP,        ALIAS=POSTAL_CODE, FORMAT=A9,          $
  SEGNAME=TRANSDAT, SEGTYPE=SH1,  PARENT=CUST
   FIELDNAME=TRANSDATE,  ALIAS=OUTDATE,     FORMAT=HYYMDI,      $
  SEGNAME=SALES,    SEGTYPE=S2,   PARENT=TRANSDAT
   FIELDNAME=TRANSCODE,  ALIAS=TCOD,        FORMAT=I3,          $
   FIELDNAME=QUANTITY,   ALIAS=NO,          FORMAT=I3S,         $
   FIELDNAME=TRANSTOT,   ALIAS=TTOT,        FORMAT=F7.2S,       $
  SEGNAME=RENTALS,  SEGTYPE=S2,   PARENT=TRANSDAT
   FIELDNAME=MOVIECODE,  ALIAS=MCOD,        FORMAT=A6, INDEX=I, $
   FIELDNAME=COPY,       ALIAS=COPY,        FORMAT=I2,          $
   FIELDNAME=RETURNDATE, ALIAS=INDATE,      FORMAT=YMD,         $
   FIELDNAME=FEE,        ALIAS=FEE,         FORMAT=F5.2S,       $
 DEFINE DATE/I4 = HPART(TRANSDATE, 'YEAR', 'I4');


x
Reference: Using a Partitioned Data Source

The following illustrates how to use an intelligently partitioned data source. The Access File for the VIDEOTR2 data source describes three partitions based on DATE:

TABLE FILE VIDEOTR2
PRINT LASTNAME FIRSTNAME DATE
WHERE DATE FROM 1996 TO 1997
END

The output is:

LASTNAME         FIRSTNAME   DATE
--------         ---------   ----
HANDLER          EVAN        1996
JOSEPH           JAMES       1997
HARRIS           JESSICA     1997
HARRIS           JESSICA     1996
MCMAHON          JOHN        1996
WU               MARTHA      1997
CHANG            ROBERT      1996

There is nothing in the request or output that signifies that a partitioned data source is used. However, only the second partition is retrieved, reducing I/O and enhancing performance.



x
Reference: Usage Notes for Partitioned FOCUS Data Sources

Top of page

x
FOCUS Access File Attributes

How to:

Reference:

Every request supplies the name of a Master File. The Master File is read and the declarations in it are used to access the data source. If the Master File contains an ACCESS= attribute, the Access File is read and used to locate the correct data sources. The Access File must have the same name as the Master File. If there is no Access File with the same name as the ACCESS= attribute in the Master File, the request is processed with the Master File alone.



x
Reference: Access File Attributes for a FOCUS Access File

Each FOCUS Access File describes the files and MDIs for one Master File, and that Master File must have the same file name as the Access File.

All attribute and value pairs are separated by an equal sign (=), and each pair in a declaration is delimited with a comma (,). Each declaration is terminated with the comma dollar sign (,$).

  1. Each Access File starts with a declaration that names its corresponding Master File.
  2. Next comes the DATA declaration that describes the location of the physical file. If the file is partitioned, it has multiple DATA declarations.

    If the file is intelligently partitioned so that an expression describes which data values reside in each partition, the DATA declaration has a WHERE phrase that specifies this expression.

  3. If the data source has LOCATION segments the LOCATION declaration names a location segment. Its corresponding DATA declaration points to the physical LOCATION file.
  4. If the data source has an MDI, the Access File has an MDI declaration that names the MDI and its target segment, followed by declarations that name the dimensions of the MDI, followed by the MDIDATA declaration that points to the physical MDI file. If the MDI is partitioned, there are multiple MDIDATA declarations for the MDI.


x
Syntax: How to Create a FOCUS Access File

Master File declaration:

MASTER=mastername,$

where:

mastername

Indicates the name of the Master File with which this Access File is associated. It is the same value included in the Master File ACCESS=filename attribute, used to indicate both the existence of the Access File and its name.

DATA=file_specification, 
   [WHERE= expression; ,]$
[DATA=file_specification, 
   [WHERE= expression; ,]$ ...]

where:

file_specification

Points to the file location. This is a complete file specification. There are can be up to 1022 DATA declarations (partitions) in a single Access File. The WHERE clause is the basis of the Intelligent Partitioning feature. The expression is terminated with the semi-colon and the entire declaration with the comma/dollar sign. WHERE expressions of the following type are supported:

WHERE = field  operator value1 [ OR  value2...]; ,$
WHERE = field FROM value1 TO value2 [AND FROM value3 TO value4];,$

Expressions can be combined with the AND operator.

Location File declarations:

LOCATION=location_segment_name,
  DATA=location_segment_file_specification,$

where:

location_segment_name

Is the name of the segment stored in the location file.

location_segment_file_specification

Is the full file specification for the physical file the segment is located in.

MDI declarations:

MDI=mdiname, TARGET_OF = segname,$
   DIM = [filename.]fieldname [, MAXVALUES = n] [, WITHIN = dimname1],$
   [DIM = [filename.]fieldname [, MAXVALUES = n] [, WITHIN = dimname1] ,$ ...]
 MDIDATA=mdi_file_specification,$
 [MDIDATA=mdi_file_specification,$ ...]

where:

mdiname

Is the name of the MDI.

segname

Is the name of the target segment.

filename

Is the name of the file where an MDI dimension resides.

fieldname

Is the name of a field that is a dimension of the MDI.

n

Is the number of distinct values in the dimension. When the MDI is created, the actual dimension value will be converted to an integer of length 1, 2, or 4 bytes, and this number will be stored in the index leaf.

mdi_file_specification

Is the fully-qualified specification of the physical MDI file. If the MDI is partitioned, it is the specification for one partition of the MDI. An MDI can have up to 250 MDIDATA declarations (partitions). An Access File can have an unlimited number of MDIs.

dimname

Defines a hierarchy of dimensions. This dimension is defined within the dimname dimension. For example, CITY WITHIN STATE.



Example: Access File for the VIDEOTR2 Data Source

VIDEOTR2 is an intelligently partitioned FOCUS data source. The Master File has an ACCESS=VIDEOTR2 attribute:

FILENAME=VIDEOTR2,  SUFFIX=FOC,    ACCESS=VIDEOTR2             
SEGNAME=CUST,       SEGTYPE=S1                                 
 FIELDNAME=CUSTID,       ALIAS=CIN,          FORMAT=A4,       $
 FIELDNAME=LASTNAME,     ALIAS=LN,           FORMAT=A15,      $
 FIELDNAME=FIRSTNAME,    ALIAS=FN,           FORMAT=A10,      $
 FIELDNAME=EXPDATE,      ALIAS=EXDAT,        FORMAT=YMD,      $
 FIELDNAME=PHONE,        ALIAS=TEL,          FORMAT=A10,      $
 FIELDNAME=STREET,       ALIAS=STR,          FORMAT=A20,      $
 FIELDNAME=CITY,         ALIAS=CITY,         FORMAT=A20,      $
 FIELDNAME=STATE,        ALIAS=PROV,         FORMAT=A4,       $
 FIELDNAME=ZIP,          ALIAS=POSTAL_CODE,  FORMAT=A9,       $
 FIELDNAME=EMAIL,        ALIAS=EMAIL,        FORMAT=A18,      $
SEGNAME=TRANSDAT, SEGTYPE=SH1,  PARENT=CUST                    
 FIELDNAME=TRANSDATE,    ALIAS=OUTDATE,   FORMAT=HYYMDI,       
   MISSING=ON, $                                               
SEGNAME=SALES,    SEGTYPE=S2,   PARENT=TRANSDAT                
 FIELDNAME=TRANSCODE,    ALIAS=TCOD,    FORMAT=I3,            $
 FIELDNAME=QUANTITY,     ALIAS=NO,      FORMAT=I3S,           $
 FIELDNAME=TRANSTOT,     ALIAS=TTOT,    FORMAT=F7.2S,         $
SEGNAME=RENTALS,  SEGTYPE=S2,   PARENT=TRANSDAT                
 FIELDNAME=MOVIECODE,    ALIAS=MCOD,      FORMAT=A6, INDEX=I, $
 FIELDNAME=COPY,         ALIAS=COPY,      FORMAT=I2,          $
 FIELDNAME=RETURNDATE,   ALIAS=INDATE,    FORMAT=YMD,         $
 FIELDNAME=FEE,          ALIAS=FEE,       FORMAT=F5.2S,       $
 DEFINE DATE/I4 = HPART(TRANSDATE, 'YEAR', 'I4');              

The following shows the Access File, named VIDEOTR2, on z/OS:

MASTER=VIDEOTR2 ,$            
  DATA=USER1.VIDPART1.FOCUS,    
    WHERE=DATE EQ 1991;,$           
                                  
  DATA=USER1.VIDPART2.FOCUS,    
    WHERE=DATE FROM 1996 TO 1998; ,$
                                  
  DATA=USER1.VIDPART3.FOCUS,    
   WHERE=DATE FROM 1999 TO 2000;,$ 

The following shows the Access File, named VIDEOTR2, on UNIX:

MASTER=VIDEOTR2 ,$            
  DATA=/user1/vidpart1.foc,    
    WHERE=DATE EQ 1991;,$           
                                  
  DATA=/user1/vidpart2.foc,    
    WHERE=DATE FROM 1996 TO 1998; ,$
                                  
  DATA=/user1/vidpart3.foc,    
   WHERE=DATE FROM 1999 TO 2000;,$ 

The following shows the Access File, named VIDEOTR2, on Windows:

MASTER=VIDEOTR2 ,$            
  DATA=c:\user1\vidpart1.foc,    
    WHERE=DATE EQ 1991;,$           
                                  
  DATA=c:\user1\vidpart2.foc,    
    WHERE=DATE FROM 1996 TO 1998; ,$
                                  
  DATA=c:\user1\vidpart3.foc,    
   WHERE=DATE FROM 1999 TO 2000;,$ 

WebFOCUS