Enabling Generation of Joins for an Application

Joins are enabled by placing a statement in a program-specific configuration file.

To enable a join

  1. Open the program-specific configuration file for editing:

    $LAWDIR/productline|dataarea/xxsrc/xxnnn.cfg

    where the following parameters apply.

    Parameter Description
    productline|dataarea The product line or data area that contains the program you want to enable joins for.
    xxnnn The program code, where xx is the two-letter system code abbreviation, and nnn is the numeric portion of the program code.
  2. Add the following line to the file:

    JOIN=FileName.IndexName(RelationName.0)[; (RelationName.0) ... ]

    where the following parameters apply.

    Parameter Description
    FileName The table you want to enable joins for, as defined in dbdef.
    IndexName The index that is used to access data from the primary file (FileName).
    RelationName The relationship that is used to access data from the joined file as defined in dbdef.

Example

This entry enables use of joins when retrieving data from the GLSYSTEM table, using index GLSSET1 and the CHART-OF-ACCTS relation:

JOIN=GLSYSTEM.GLSSET1(CHART-OF-ACCTS.0) 

The SQL generated by this enabled join is shown below:

select GLS.COMPANY, GLS.R_NAME, GLS.BS_ACCT, ... , 
  GLS.FB_UPDATING, GLS.ML_UPDATING, GCH.CHART_NAME, GCH.DESCRIPTION,
   ... , GCH.COMT_SUB_ACCT
from EMP8124K.GLSYSTEM GLS
LEFT JOIN EMP8124K.GLCHART GCH ON GCH.CHART_NAME = GLS.CHART_NAME
where GLS.COMPANY = 1
order by
GLS.COMPANY