Comparing data sets using templates

When you choose to use templates in your comparisons, you can specify an “Old” template only, a “New” template only or both “Old” and “New” templates.

"Old" template only or "New" template only
This excludes records not-selected in either the “Old” or the “New” data set.

During the compare, the Compare Utility uses the “Old” or “New” template to provide information about the selected record types, record identification criteria and record selection criteria for the “Old” and “New” data sets. Any field selection and field resequencing information in the templates is ignored, however, you can specify fields to be used in a multi-segment key that can be used with the Keyed Synchronization comparison option.

You determine which records are selected or excluded by editing the template and:
  • Selecting record types
  • Specifying record identification criteria
  • Specifying record selection criteria
Not-selected records:
  • do not match a record type in the template, due to either record identification criteria or record length;
  • match a record type, but belong to an unselected record type; or
  • do not meet the record selection criteria for the record type.
"Old" and "New" templates (based on the same copybook or dynamic template structure)
This allows you to exclude records from both the “Old” and the “New” data sets, based upon the template information, and allows you to specify which fields in the “Old” data set are compared with which fields in the “New” data set.

During the compare, the Compare Utility uses the “Old” and “New” templates to provide information about the selected record types, record identification criteria and record selection criteria.

You can also specify key segment sequencing to create a multi-segment key that can be used with the Keyed Synchronization comparison option.

If a formatted comparison is performed, the record structure, field output width and field heading attributes in the “Old” and “New” templates are also used. Field mapping information is taken from the “New” template and only fields that have been mapped are compared. A field in the “Old” template can be mapped to the same field in the “New” template (this is the default), to a different field or unmapped.

"Old" and "New" templates (based on different copybook or dynamic template structures)
This allows you to exclude records from both the “Old” and “New” data sets and allows the “Old” and “New” data sets to have different record structures, according to the differences in their copybook or dynamic templates.

You may have existing templates for both data sets, or you might copy a template describing one of the data sets and edit it to describe the other data set.

The table below summarizes how the Compare Utility uses information in the “Old” and “New” templates:

This table has four columsn. The third heading, "In this template..." spans two columns, the subheadings "Old" and "New".

The Compare Utility determines… Using this information… In this template…
Old New
Which records are compared

Selected record types
Record identification criteria
Record selection criteria

Which fields are compared, and with what Field mapping

If a formatted comparison is performed then, by default, the fields in the “Old” template are mapped to fields in the “New” template that have the same name. You can edit the field mapping in the “New” template, and either delete the mapping for a field (so that it is not compared), or specify which field in the “Old” template is mapped to a field in the “New” template.

To perform a compare using templates:

  1. From the Primary Options menu, select Compare Utility (option 3.11).

    The Compare Utility - “Old” Data Set Entry panel is displayed.

  2. Specify the “Old” data set information and, optionally, the “Old” template information.
    • To use a template, choose any one of these methods:
      • Specify an existing dynamic template, an existing copybook template or an existing copybook on which you want to base a new template and choose 1. Above from the Processing Options.
      • Choose 2. Previous from the Processing Options. The template most recently associated with the “Old” data set is used and the contents of the “Old” template fields are ignored.
      • Choose 4. Create Dynamic from the Processing Options. The contents of the “Old” template fields are ignored and you are asked to create the new template when Enter is pressed.
    • If you want to map fields from the “Old” to the “New” data set, you must specify an “Old” template.
    • If you want to edit the “Old” template information before using it, select the Edit template option.
    • Press Enter.
      • If Processing Option 1 or 2 was selected AND the Edit template option was NOT selected, the Compare Utility - “New” Data Set Entry panel is displayed.
      • If Processing Option 1 or 2 was selected AND the Edit template option WAS selected, the panel appropriate for editing the template is displayed. Make your record identification, record selection, field attribute and key sequencing choices and press the Exit function key (F3) to return to the “Old” data set panel. Press Enter again to move to the “New” data set panel using the modified template.
      • If Processing Option 4 was selected, the Dynamic Template panel is displayed. Create and save your new dynamic template. If you want to include key sequence information, select option 1 Edit template field attributes and selection and make your selections in the Field Selection/Edit panel. When you have finished creating your template, press the Exit function key (F3) to move to the “New” data set panel.
      Note: If you do not want to save the changes to your template, you can use the RunTemp function key (F6) in place of the Exit function key (F3).
    • In the Compare Utility - “New” Data Set Entry panel, specify the “New” data set information and, optionally, the “New” template information.
      • If you want to map fields from the “Old” to the “New” data set, you must specify an “New” template.
      • If you want to edit the “New” template information before using it, select the Edit template option.
    • Press Enter.
      • If Processing Options 1 or 2 were selected and the Edit template option was NOT selected, the Compare Utility - Options panel is displayed.
      • If Processing Options 1 or 2 were selected and the Edit template option WAS selected, the appropriate panel for editing the template is displayed. Make your record identification, record selection, field attribute and key sequencing choices, and press the Exit function key (F3) to return to the “New” data set panel. Press Enter again to move to the Options panel using the modified template.
      • If Processing Option 4 was selected, the Dynamic Template panel is displayed. Create and save your new dynamic template. If you want to include key sequence information, select option 1 Edit template field attributes and selection and make your selections in the Field Selection/Edit panel. When you have finished creating your template, press the Exit function key (F3) to move to the Options panel.
      Note: If you do not want to save the changes to your template, you can use the RunTemp function key (F6) in place of the Exit function key (F3).
    • Select a combination of Compare, Processing and Listing options. These options apply whether the comparison type is record or formatted, except that for formatted comparisons the word "record" refers only to those parts of the record specified in the mapping.
      • If you want to use the field mapping information within the “New” template, you must choose the Formatted Compare Type.
      • If you want to edit the field mapping information within the “New” template, select the Edit template mapping option.
      • If you select Keyed synchronization, you can:
        • Specify the location, length and data type of your key segments in the Keyed Synchronization Settings panel that is displayed after the Compare Options panel. If a data type is not explicitly specified, type AN is used.
        • Use a template to specify fields to be included in the key and the sequence in which they are concatenated (known as key sequence information). If you want to use an intrinsic key as well as your own key sequence information, you must start the key sequence at 2 or higher. If your key sequence information starts at 1, any intrinsic key information is ignored for that data set.
    • Select your Template Reporting Options from the list:
      Show template layouts
      Select this option to report template layout information. You must also have set the Compare type to 2. Formatted.
      Show template criteria
      Select this option to report template criteria information. A terse layout report is also generated, containing only the fields referred to in the criteria expressions.
      Show mapped fields
      Select this option to report mapped template fields. You must also have set the Compare type to 2. Formatted.
      Show unmapped fields
      Select this option to report unmapped template fields. You must also have set the Compare type to 2. Formatted.
      Show array elements
      If field information is reported (that is, if you have selected any of the first four Template Reporting Options), select this option to report all occurrences of any array elements. Note that for COBOL OCCURS DEPENDING ON tables, the maximum occurrences are reported, and for PL/1 REFER arrays, the minimum occurrences are reported.
      Show start/end as hex offset
      If field information is reported (that is, if you have selected any of the first four Template Reporting Options), select this option to report all field start and end positions as hexadecimal offsets.
      Show length in hex
      If field information is reported (that is, if you have selected any of the first four Template Reporting Options), select this option to report all field lengths in hexadecimal.
      Show field statistics
      This option produces the field statistics report showing the number and percentage of mismatches by field. This option only applies when the synchronization option is One-to-one or Keyed.
    • Press Enter.
      • If you have not selected the Edit template mapping option, the comparison operation is performed, using the current settings and template information. The result is either a Compare Report or a batch job (displayed in the Edit panel).
        Note: If no fields are selected in the saved or default-generated field mapping, the Edit template mapping option is forced.
      • If you have selected the Edit template mapping option, the appropriate panel for editing the field mapping is displayed. Make mapping choices and press the Exit function key (F3) to return to the Options panel. Press Enter again to perform the compare with the modified template.
    • When you have finished viewing the report or editing the batch JCL, press the Exit function key (F3) to return to the “Old” data panel.

Related topics