MERGE

The MERGE control statement is used to merge 1 to 9 existing databases together into one new database. Logic is included to reset generation and tape sequence numbers to eliminate any conflict between the input databases. The output database must be a newly-created, empty database.
view
The MERGE control statement is used to merge 1 to 9 existing databases together into one new database. Logic is included to reset generation and tape sequence numbers to eliminate any conflict between the input databases. The output database must be a newly-created, empty database.
Note:
The SARPAC tape consolidation utility is required to complete the merge process, therefore, you must have previously installed the Expanded Retention Option (ERO).
The high-level name of the output database must have previously been defined with the NAME control statement (or the PARM parameter of the EXEC JCL statement).
Syntax:
MERGE 
tape-index driver parameters
ARCHCHG=
baseyear
where:
  • tape-index
    Specifies the high-level naming prefix to be set for the TAPEIDX initialization parameter
    If omitted, TAPEIDX is set to the high-level name of the output database.
    To prevent conflicts with any existing archival tapes, MERGE requires that this high-level naming prefix for tapes be different from those for any tapes defined in the input databases.
  • driver
    Specifies the name of the secondary disk storage driver and must be the same as the DSK2DRVR initialization parameter
    Use
    driver
    only if you have an optical disk secondary storage driver.
  • parameters
    Specifies the identifiers for the secondary disk storage driver as defined by the DSK2PARM initialization parameter
    Use parameters only if you have an optical disk secondary storage driver. These parameters vary according to type of optical disk driver.
  • ARCHCHG=baseyear
    Establishes the baseyear designation of the ARCHCHG initialization parameter for the merged database. The baseyear is a four-digit year that can range from 1980 to the present year and must be equal to or earlier than the oldest report in the merged database.
    When ARCHCHG baseyear is specified,
    View
    calculates the GEN number for the report using the number of days from the baseyear to the report date. This initialization parameter is designed for installations that want to change the archival date of a report during collection.
    When the ARCHCHG parameter is omitted, the GEN number for reports is initially determined based on the number of days from the earliest report in the merged database. After the merge,
    View
    increments the GEN number for the reports using the standard method and execution of the started task backup cycle.
    Note:
    This option can only be specified for databases that have the EROOPT=YES initialization parameter setting. Also, the EROPRO initialization parameter will be automatically set to YES as required by the ARCHCHG initialization parameter.
Contents
Initialization Parameter
The initialization parameters from the original databases might not be applied to the resultant database.
Parameters that are unique to the various original databases are be set to their default value. For example, if database SARMERG1 has CLSL=A, and database SARMERG2 has CLSL=B, the merged database will have a blank CLSL.
Parameters that are identical among the various original databases will be set to the same value. For example, if database SARMERG1 has EXPRESS=CA.DLVR, and Database SARMERG2 has EXPRESS=CA.DLVR, the merged database will have EXPRESS=CA.DLVR.
Two initialization parameters, GEN= and TAPESEQ= are not set from any original database value. These two parameters are created dynamically. The GEN value is set based on the difference between the number of days of the oldest and newest reports. The TAPESEQ value is set based on the number of tapes in the resultant database.
Under all circumstances, SARINIT must be run on the resultant database, and each initialization parameter value must be reviewed and set appropriately.
Tapes and Reports
The database which results from a MERGE contains every tape control record and every report from each original database. There elements are never considered duplicate and even if three identical databases were merged into one new database, the new database would contain three tape control records for tape and three identical copies of every report.
User Profiles, Logical Views, Filters, Panels and Banners
The database that results from a MERGE always contains one control record or panel from each original database. Duplicate control records and panels are always taken from the last SARMERG File.
If USERA is defined in SARMERG1, and USERB is defined in SARMERG2, the resulting merged database contains user profiles for both USERA, and USERB. If USERA was defined in SARMERG1 with a DISTID of DISTID1 and in SARMERG2 with a DISTID of DISTID2, the resulting merged database contains a user profile for USERA with a DISTID of DISTID2.
This also applies to Logical Views, Filter Definitions, Panels, and Banners. Duplicate definitions, panel, or banner specifications are always taken from the last SARMERG File.
Note:
Under all circumstances, these definitions, panels, and banners must be reviewed and corrected as required.
Specifying Database Names
Unloaded copies of the databases that are merged are defined in the JCL with DD statements named SARMERGn, where n specifies a number from 1 to 9. The first unloaded database that is merged is defined with the DD statement SARMERG1, the second with DD statement SARMERG2, and so on. When only one database is merged, the operation functions as a reset operation to reset generation and tape sequence numbers.
Merge Process
When you perform a merge operation, following these steps in order:
  1. Terminate all activity against the databases to be merged. Be sure to stop all direct-to-
    View
    archival activity from the
    Deliver
    product.
  2. Unload the databases using the UNLOAD function of this utility.
  3. Define a new database (large enough to hold all the data from the input databases) using the ADDDS function of this utility.
  4. Perform the merge function.
    The input unloaded databases are processed twice. The first time, they are scanned to determine how the reset of generation and tape sequence numbers is done; the second time, they are actually loaded to the new, output database.
  5. Verify the successful completion of the merge function.
  6. Run SARINIT to review, add, or change any initialization parameters in the merged database.
  7. Run the SARPAC tape consolidation utility as many times as necessary to copy all the archival tapes to new tapes owned by the merged database.
After you complete Step 6, the newly-created, merged database can be used in production. Step 7 can be run while the database is being used in production.
Common Information Between Databases
The following actions occur with a MERGE:
  • For any common definitions in the input database (such as options and panel definitions), only the definition from the last database to be merged is used.
  • Multiple Define SYSOUT definitions for the same SYSOUT identifiers are merged.
  • Multiple Define DISTRIBUTION definitions for the same SYSOUT identifiers are merged.
  • All PC-transmitted queue entries are deleted from the output, merged database.
Why You Must Run SARPAC
Although definitions of the archival tapes from the input databases are copied to the output merged database, ownership of the tapes remains with the input databases. Therefore, SARPAC tape consolidations must be run to copy the tape archival data to new tapes owned by the new, merged database.
After the archival tape data has been copied using the SARPAC utility, references to the original tapes are removed from the merged database at the next backup or clean cycle. Only the references to the tapes are removed from the database; the tapes are not un cataloged since the merged database does not actually own them.
Optical Disk Considerations
Additional consideration must be given when merging databases containing SYSOUT archived to secondary (optical) disk storage.
Generation Numbers
The resulting generation numbers in the output merged database are computed from the archival dates of the SYSOUT groups. The numbers are based on a 24-hour generation beginning at the time of day specified in the TIME initialization parameter in the last database to be merged. The current generation number in the output merged database is one more than that of the most recently archived SYSOUT group.
If MERGE ARCHCHG baseyear is specified,
View
calculates the GEN number for the report using the number of days from the baseyear to the SYSOUT's report date.
When using the MERGE control statement, adhere to the following:
  • The
    View
    archival started task, SARSTC, SARFSS, SARXTD, and
    Deliver
    direct to
    View
    must be inactive.
  • Do not TADD tapes from the original database until they have been SARPACed.