Previous Topic: Accessing non-SQL Defined TablesNext Topic: PATH Parameter Syntax


Filling the Input Buffer

The example shown below illustrates three primary paths:

PATHAA DEPARTMENT EMPLOYEE EXPERTISE
PATHBB DEPARTMENT
PATHCC DEPARTMENT EMPLOYEE

At run time, CA Culprit accesses and processes the records specified on these PATH parameters in the following sequence:

  1. CA Culprit starts with the path that has the lowest sort-sequenced path id, and then builds a string of database records; in this example, CA Culprit navigates path AA first.
  2. CA Culprit returns the string to the input buffer, which is processed by each report in the CA Culprit run.
  3. CA Culprit obtains a new occurrence of the last record type retrieved in the path (EXPERTISE) and returns the new string to the input buffer. When no further occurrences of EXPERTISE exist for a given employee, CA Culprit navigates path CC, which specifies the same DEPARTMENT EMPLOYEE record sequence as path AA.
  4. CA Culprit obtains a new occurrence of the next-to-last record on path AA (EMPLOYEE) and extends the string again. When no further occurrences of EMPLOYEE exist for a given department, CA Culprit navigates path BB.

The iteration process continues until all possible occurrences of each record type on the paths have been returned.

CA Culprit does not clear the input buffer before it builds the next string of database records. Therefore, if the current string is shorter than the previous string, residual information will exist in the input buffer. The user must test the value of PATH-ID in the input buffer to determine which path CA Culprit has navigated.

The following figure lists a subset of information stored in occurrences of the EMPLOYEE, EXPERTISE, and SKILL records from the employee database in Employee Database Subschema.

EMPLOYEE EXPERTISE SKILL NAME LEVEL KATHERINE O'HEARN 03 FORTRAN COBOL ASSEMBLER 02 IDD LAURA PENMEN - - LARRY LITERATA 03 EDITING 02 INTERACT COBOL

Examples

The following examples indicate the contents of the input buffer when different paths are specified; residual information in the input buffer is enclosed in parentheses.

Example 1: Primary Path Id

PATHAA EMPLOYEE EXPERTISE SKILL

Since the path specifies only a primary path id, CA Culprit must retrieve an occurrence of each database record specified; therefore, CA Culprit will not retrieve the EMPLOYEE record occurrence for LAURA PENMEN since there are no occurrences of EXPERTISE and SKILL records for this employee. The contents of each input buffer appear below:

PATH ID      EMPLOYEE NAME              EXPERTISE     SKILL
                                          LEVEL

   AA       KATHERINE O'HEARN               03       FORTRAN
   AA       KATHERINE O'HEARN               03       COBOL
   AA       KATHERINE O'HEARN               03       ASSEMBLER
   AA       KATHERINE O'HEARN               02       IDD
   AA       LARRY     LITERATA              03       EDITING
   AA       LARRY     LITERATA              02       INTERACT
   AA       LARRY     LITERATA              02       COBOL

Example 2: Alternate Path Id

PATHAA EMPLOYEE EXPERTISE (BB) SKILL

Since the PATH parameter specifies an alternate path id, CA Culprit can process an incomplete path. In this example, CA Culprit can retrieve occurrences of EMPLOYEE records that do not have an associated occurrence of an EXPERTISE record. The contents of the input buffer shown below indicate that CA Culprit was able to retrieve the LAURA PENMEN record occurrence. Note however that KATHERINE O'HEARN's previously retrieved expertise level (02) and skill (IDD) remain in the PENMEN buffer.

PATH ID      EMPLOYEE NAME              EXPERTISE     SKILL
                                          LEVEL

   AA       KATHERINE O'HEARN               03       FORTRAN
   AA       KATHERINE O'HEARN               03       COBOL
   AA       KATHERINE O'HEARN               03       ASSEMBLER
   AA       KATHERINE O'HEARN               02       IDD
   BB       LAURA     PENMAN               (02)     (IDD)
   AA       LARRY     LITERATA              03       EDITING
   AA       LARRY     LITERATA              02       INTERACT
   AA       LARRY     LITERATA              02       COBOL

Example 3: Multiple Primary Paths

PATHAA EMPLOYEE EXPERTISE SKILL
PATHCC EMPLOYEE

In the above example, CA Culprit begins by navigating the path with the lowest path id, AA. Once CA Culprit retrieves all occurrences of path AA, CA Culprit navigates path CC before accessing the next occurrence of the EMPLOYEE record. The contents of the input buffer appear below:

PATH ID      EMPLOYEE NAME              EXPERTISE     SKILL
                                          LEVEL

   AA       KATHERINE O'HEARN               03       FORTRAN
   AA       KATHERINE O'HEARN               03       COBOL
   AA       KATHERINE O'HEARN               03       ASSEMBLER
   AA       KATHERINE O'HEARN               02       IDD
   CC       KATHERINE O'HEARN              (02)     (IDD)
   CC       LAURA     PENMAN               (02)     (IDD)
   AA       LARRY     LITERATA              03       EDITING
   AA       LARRY     LITERATA              02       INTERACT
   AA       LARRY     LITERATA              02       COBOL
   CC       LARRY     LITERATA             (02)     (COBOL)