MIRROR_COMPARE_NODE procedure

The MIRROR_COMPARE_NODE procedure populates a result table with one or more rows for each object in every library that is different from the same object on the other node. The compares can be made for all libraries in SYSBAS, for all libraries in the current IASP, or for all libraries in SYSBAS and all active IASPs.

For each object being compared, comparison operations can be performed for the definitional attributes of the object, the data contained in the object, or both. Only *DTAQ, *FILE, *OUTQ, *USRIDX, and *USRSPC objects support data comparisons. A value of YES or QUICK must be specified for at least one of the compare-attributes or compare-data parameters. For more information about object comparisons, see MIRROR_COMPARE_OBJECT table function.

Authorization: The privileges held by the authorization ID of the statement must include *ALLOBJ special authority. For the authority needed to use this function, see Authorization.

To specify a parallel degree value other than NONE, the privileges held by the authorization ID of the statement must include *JOBCTL special authority or QIBM_DB_SQLADM, function usage authority.

Read syntax diagramSkip visual syntax diagram MIRROR_COMPARE_NODE ( COMPARE_SCOPE =>  compare-scope ,COMPARE_ATTRIBUTES => compare-attributes,COMPARE_DATA => compare-data,PARALLEL_DEGREE => parallel-degree,PARALLEL_JOBS => parallel-jobs,RESULT_LIBRARY => result-library,RESULT_FILE => result-file,VERBOSE_LOG => verbose-log,OBJECT_TYPE_LIST => object-type-list )
The schema is QSYS2.
compare-scope
A character or graphic string expression that determined the scope of the comparisons.
ALL
The scope includes all libraries in SYSBAS and in all active and available IASPs on the primary node.

This option submits multiple batch jobs with a job name of MCOMP_ALL to do the comparisons. A result set is returned from the procedure that contains the list of all the jobs that were submitted. When all the jobs are complete, result-file will contain information from all the compares.

IASP
The scope includes all libraries in the IASP namespace of the caller.
*SYSBAS
The scope includes all libraries in SYSBAS on the primary node.
compare-attributes

A character or graphic string expression that indicates whether the attributes are compared for each object. The attributes being compared for an object varies based upon the object type. Not all attributes for an object are eligible to be compared.

NO
The attributes are not compared for an object.
QUICK
The attributes are compared for an object until the first difference is found. Only a single row is returned for an object if any differences are detected. This option is faster because a complete list of differences for an object is not returned.
YES
All the attributes are compared for an object. A row is returned for each difference found. This is the default.
compare-data
A character or graphic string expression that indicates whether the data is compared for *DTAQ, *FILE, *OUTQ, *USRIDX, and *USRSPC objects. compare-data is ignored for all other objects.
NO
The data is not compared for an object.
QUICK
The data is compared for *DTAQ, *FILE, *OUTQ, *USRIDX, and *USRSPC objects until the first difference is found. Only a single row is returned if any differences are detected. This option is faster because a complete list of differences for an object is not returned.
YES
All the data is compared for a *DTAQ, *FILE, *OUTQ, *USRIDX, and *USRSPC object. A row is returned for each difference found. This is the default.
parallel-degree
A character or graphic string that specifies the maximum degree of parallelism to use for comparing each object.

If the Db2® Symmetric Multiprocessing (SMP) feature is not installed, an error is issued if the value is not NONE.

2-256
The maximum degree of parallelism to be used.
NONE
No parallelism will be used. This is the default.
parallel-jobs
An integer value that specifies the maximum number of jobs that can be run at one time to compare individual objects in a library. The default is 1.
result-library
A character or graphic string expression that identifies the name of the library to contain the details from the compare. The library must exist. When compare-scope is ALL, the result library cannot be QTEMP. If this parameter is omitted, QTEMP is the default.
result-file

A character or graphic string expression that identifies the system name of the file to contain the details from the compare. The result file includes rows that contain details for any differences found during the compare and any additional rows returned when verbose-log has a value of YES. If this parameter is omitted, QIBM_MCOMP is the default. If the file already exists, new rows are inserted into the file.

verbose-log
A character or graphic string expression that indicates whether to return at least one row for each object that is compared.
NO
Rows are returned only for objects that do not compare as identical. This is the default.
YES
A row is returned for every object that is compared.
object-type-list

A character or graphic string expression containing one or more system object types separated by a comma or blanks that identify the objects in a library to compare. The default for this parameter is *ALLMIRROR.

The following special values are allowed for object-type-list.

*ALL
All system object types are compared.
*ALLMIRROR

All replication-eligible objects that return a value that is not EXCLUDE or INELIGIBLE from the QSYS2.CHECK_REPLICATION_CRITERIA function are compared. This includes the library object.

When compare-scope is ALL or *SYSBAS, only the following replication-eligible object types are allowed to be compared for the QSYS library.
*AUTL
Authorization list
*ENVVAR
System-level environment variable
*FCNUSG
Function usage
*SECATR
Security attribute
*SYSVAL
System value
*USRPRF
User profile
*ALLNONMIRROR

All non-mirrored objects that return an EXCLUDE or INELIGIBLE value from the QSYS2.CHECK_REPLICATION_CRITERIA function are compared.

When compare-scope is ALL or *SYSBAS, only the following object types are allowed to be compared for the QSYS library.
*ENVVAR
System-level environment variable
*SYSVAL
System value

The table that contains the result is identical to the table returned by QSYS2.MIRROR_COMPARE_LIBRARY. See MIRROR_COMPARE_LIBRARY result table.

Example

  • Compare all the replicated objects that reside in SYSBAS.
    CALL QSYS2.MIRROR_COMPARE_NODE(COMPARE_SCOPE =>'*SYSBAS',
                                   RESULT_LIBRARY => 'DB2M_COMP',
                                   RESULT_FILE => 'SYSBASCOMP');
  • Compare all replicated objects in IASP33. At least one row will be returned for every object that is compared.
    -- Set your job to run in IASP33. 
    CALL QSYS2.MIRROR_COMPARE_NODE(COMPARE_SCOPE => 'IASP',
                                   RESULT_LIBRARY => 'DB2M_COMP',
                                   RESULT_FILE => 'IASP_COMP',
                                   VERBOSE_LOG => 'YES');
  • Compare all the replicated object types in SYSBAS and in all ASPs. A quick compare of both the object attributes and the object data is used to identify the objects that might need a full compare. The result is returned in COMPARES/COMP1. The COMPARES library must exist. The file will be created by the procedure.
    CALL QSYS2.MIRROR_COMPARE_NODE(COMPARE_SCOPE => 'ALL',
                                   COMPARE_ATTRIBUTES => 'QUICK',
                                   COMPARE_DATA => 'QUICK',
                                   RESULT_LIBRARY => 'COMPARES',
                                   RESULT_FILE => 'COMP1');

    A result set is returned from the procedure that contains the name of each job submitted to process the compare with a compare_scope of ALL.