The MODIFY COMBINE Facility

In this section:

How to:

Some applications require that you use a single input transaction to update several data sources in the same MODIFY procedure. If the data sources are not defined in the same Master File, you can use the COMBINE facility to modify them as if they are one.

Note: In Maintain, you do not issue a COMBINE command to modify unrelated data sources. Instead, you reference multiple data sources in the MAINTAIN FILE command. For example:

MAINTAIN FILES EMPWRITE AND COURSE

You can maintain up to 63 data sources in a single MODIFY procedure that operates on a COMBINE structure. The COMBINE limit is 16 Master Files; however, each Master File can describe more than one data source, for a total of 64 per procedure, minus one for the virtual root segment created by the COMBINE command.

The COMBINE facility links multiple data sources and assigns a new name to them so FOCUS can treat the data sources as a single structure. Data sources in a COMBINE structure can have different SUFFIX attributes, but you cannot combine a FOCUS database with anything except other FOCUS databases.

Note: In Maintain, you can modify FOCUS databases and Adabas data sources in the same procedure.

When you issue a COMBINE command, the COMBINE structure remains in effect for the duration of the FOCUS session or until you enter another COMBINE command. Only one COMBINE structure can exist at a time, so each subsequent COMBINE command replaces the existing structure.

Do not confuse COMBINE with the dynamic JOIN command. You use JOIN to report from multiple data sources that share at least one common field or for LOOKUP functions. With the COMBINE facility, you can MODIFY multiple data sources. COMBINE is part of the MODIFY command; only the MODIFY and CHECK FILE commands process COMBINE structures. The FIND function also works in conjunction with COMBINE (see The FIND Function).

Note that COMBINE considers the component structures to be unrelated. FOCUS referential integrity does not apply to a COMBINE of single-data source Master Files. Your procedure should check for and enforce referential integrity, if necessary.


Top of page

x
Syntax: How to How to Use the COMBINE Command

The basic syntax for the COMBINE command is

COMBINE FILES  file1 [PREFIX pref1|TAG tag1] [AND]
   .
   .
   .
               filen [PREFIX prefn|TAG tagn] AS asname

where:

file1 - filen

Are the Master File names of the data sources you want to modify. You can specify up to 16 Master Files.

pref1 - prefn

Are prefix strings for each file; up to four characters. They provide uniqueness for fieldnames. You cannot mix TAG and PREFIX in a COMBINE structure. Refer to the FOCUS for S/390 documentation for additional information.

tag1 - tagn

Are aliases for the data source names; up to eight characters. FOCUS uses the tag name as a qualifier for fields that refer to that data source in the combined structure. You cannot mix TAG and PREFIX in a COMBINE, and you can only use TAG if FIELDNAME is set to NEW or NOTRUNC.

AND

Is an optional word to enhance readability.

asname

Is the required name of the combined structure to use in MODIFY procedures and CHECK FILE commands.

Once you enter the COMBINE command, you can modify the combined structure.


Top of page

x
How FOCUS Creates a COMBINE Structure

For example, the EMPINFO data source contains employee number, last name, first name, hire date, department code, current job code, current salary, number of education hours, and bonus plan information. A second data source, PAYINFO, is a historical record of the employee's pay history. It contains the employee number, date of increase, percent of increase, new salary, and job code.

Each time a salary changes, both the EMPINFO and PAYINFO data sources must reflect the change. Since both data sources need to share data entered for employee number, salary and job code, this application is appropriate for the COMBINE facility. You can update both data sources at the same time without having to define multi-segment Master and Access Files.

The following figures represent the data sources as separate entities.

EMPINFO data source          PAYINFO data source
           EMPINFO                PAYINFO  
01         S0          01         S0 
**************         ************** 
*EMPLOYEE_ID **        *PAYEID      ** 
*LAST_NAME   **        *DAT_INC     ** 
*FIRST_NAME  **        *PCT_INC     ** 
*HIRE_DATE   **        *SALARY      ** 
*            **        *            ** 	
***************        ***************  
**************         **************    
          EMPINFO                PAYINFO

To modify the data sources simultaneously, issue the following sequence of commands at the FOCUS command level or in a FOCEXEC:

COMBINE FILES EMPINFO PAYINFO AS EMPSPAY 
MODIFY FILE EMPSPAY
	.
	.
	.

In the following picture, generated by the CHECK FILE command, FOCUS defines a new segment, identified as SYSTEM99, to be the root segment of the combined structure. SYSTEM99 acts as the traffic controller for this structure; it is a virtual (artificial) segment. It counts as one segment towards the total of 64 segments allowed in the COMBINE structure.

check file empspay pict
  NUMBER OF ERRORS=     0
  NUMBER OF SEGMENTS=   3  ( REAL=    3  VIRTUAL=   0 )
  NUMBER OF FIELDS=    15  INDEXES=   0  FILES=     3
  TOTAL LENGTH OF ALL FIELDS=   95
 SECTION 01
              STRUCTURE OF SQLDS    FILE EMPINFO  ON 07/22/93 AT 09.54.27
          SYSTEM99
  01      S0
 **************
 *            **
 *            **
 *            **
 *            **
 *            **
 ***************
  **************
        I
        +-----------------+
        I                 I
        I EMPINFO         I PAYINFO
  02    I S0        03    I S0
 **************    **************
 *EMPLOYEE_ID **   *PAYEID      **
 *LAST_NAME   **   *DAT_INC     **
 *FIRST_NAME  **   *PCT_INC     **
 *HIRE_DATE   **   *SALARY      **
 *            **   *            **
 ***************   ***************
  **************    **************
          EMPINFO           PAYINFO

The COMBINE facility makes it easy to modify many files with the same transaction. For additional information regarding the COMBINE facility of MODIFY, refer to the FOCUS for S/390 Maintaining Databases manual.


Information Builders