Saturday, November 17, 2012

File-Aid: Comparing Files



Chapter 5. Comparing Files

The File-AID Compare function compares any two similar files and produces reports showing any differences. Special features let you use existing keys or your own sort fields to synchronize the files. You can also supply record layouts to the Compare function that can be used for:
  • Reporting differences field by field
  • Specifying certain fields to be excluded from the compare
  • Specifying sync keys using field names.
You may optionally use standard File-AID selection criteria to select only a subset of records to be compared. Other features let you control the format and level of results reporting and to limit the number of records compared or the number of differences to report.
Like many other File-AID utilities, you can specify online or batch processing of your compare.

5.1 Accessing the Compare Function (Option 10)

The Compare function is located on the File-AID Primary Option Menu as option 10.
Steps:
  1. From the File-AID Primary Option Menu (not shown here), select File-AID option 10.
  2. Press <Enter>. File-AID displays the Compare Datasets Specification screen as illustrated in Figure 5-1.

5.2 Specifying the "Old" Dataset and "New" Dataset

This example illustrates the process of comparing two keyed VSAM (KSDS) clusters. It compares an updated file to a backup of the file saved before the file was changed. The training datasets ...FASAMP.COMPARE and ...FASAMP.EMPLOYEE contain the before and after records respectively.
You set processing options to produce a formatted report, excluding the EMP-DOB (birth date) fields. You use the existing KSDS VSAM keys to synchronize records.
Figure 5-1. Compare Datasets Specification Screen
+--------------------------------------------------------------------------------+
| File-AID -------------  Compare Datasets Specification  -----------------------|
| COMMAND ===>                                                                   |
|                                                                                |
| Specify OLD Compare Dataset Information:                                       |
|   Dataset name   ===> FASAMP.COMPARE                                           |
|   Member name    ===>                    (Blank or pattern for member list)    |
|   Volume serial  ===>                                                          |
|                                                                                |
| Specify NEW Compare Dataset Information:                                       |
|   Dataset name   ===> FASAMP.EMPLOYEE                                          |
|   Member name    ===>                    (Blank or pattern for member list)    |
|   Volume serial  ===>                                                          |
|                                                                                |
| Specify Execution Information:                                                 |
|   Process online or batch  ===> O        (O = Online; B = Batch)               |
|   Extended compare options ===> Y        (Y = Yes; N = No)                     |
|   Modify print defaults    ===> Y        (Y = Yes; N = No)                     |
|                                                                                |
| Specify Selection Criteria Information:  (E = Existing; T = Temporary;         |
|   Selection criteria usage ===> N         M = Modify; Q = Quick; N = None)     |
|   Selection dataset name   ===>                                                |
|   Member name              ===>          (Blank or pattern for member list)    |
|                                                                                |
+--------------------------------------------------------------------------------+
Steps:
  1. Type FASAMP.COMPARE in the "OLD" Dataset name field.
  2. Type FASAMP.EMPLOYEE in the "NEW" Dataset name field.
  3. Type an O in the Process online or batch field.
  4. Type a Y in the Use extended compare options field.
  5. Type a Y in the Modify print defaults field.
  6. Type an N in the Selection criteria usage field.
  7. Press <Enter>. File-AID displays the Compare Options Specification screen as illustrated in Figure 5-2.

5.3 Controlling Your Compare

The Compare Options Specification screen is displayed when you specify a value of Y in the "Extended compare options" field on the Compare Datasets Specification screen. This screen lets you control your compare processing by identifying sync keys, compare limits, and optional field comparison criteria.
Figure 5-2. Compare Options Specification Screen
+--------------------------------------------------------------------------------+
| File-AID -------------  Compare Options Specification  ------------------------|
| COMMAND ===>                                                                   |
|                                                                                |
| Specify Compare Options to be Applied to Selected Records:                     |
|                                                                                |
|    Sync key specification     ===> N     (F = Specify key in formatted mode;   |
|                                           U = Specify key in unformatted mode; |
|                                           N = Do not specify or alter key)     |
|                                                                                |
|    Files sorted on sync key   ===> Y     (Y = Pre-sorted or keyed files;       |
|                                           N = Non-sorted, uses read-ahead cnt) |
|                                                                                |
|    Read-ahead record count    ===> 100   (Number of records to read-ahead to   |
|                                           sync non-keyed or non-sorted files)  |
|                                                                                |
|    Compare criteria option    ===> R     (F = Formatted field compare;         |
|                                           U = Unformatted compare specification|
|                                           R = Compare entire record)           |
|                                                                                |
|    Records to compare         ===> ALL   (All or maximum number of records)    |
|    Differences to compare     ===> ALL   (All or maximum number of differences)|
+--------------------------------------------------------------------------------+
Specifying Sync Keys
File-AID needs to know which field or fields to use to keep the old and new files in sync during the compare.
Note: If comparing keyed files, File-AID automatically knows where the key field is and you do not need to specify any sync key information.
Sync key information is used to more precisely detect when new records have been added and old records deleted.
When files are not keyed or sorted on a key field, File-AID uses a "read-ahead" method to attempt to find exact record matches to re-sync the files.
You can specify any field(s) to be used as the key field(s). You can identify the sync key(s) using a record layout (F - Formatted) or without a layout (U - Unformatted).
Controlling Compare Format
By default, File-AID compares all bytes of each record (Compare Criteria "R" - Compare Entire Record). You can choose to compare selected portions of your data records. The subset of fields to compare can be specified with a record layout (F - Formatted) or without (U - Unformatted).
If your file contains multiple record types, and you have defined an XREF for formatting the different record types, File-AID lets you define different compare field subsets for each record type.
Controlling Processing Limits
You can control the number of records to compare and the number of differences to report before stopping the compare.
By default, all records are compared and all differences are reported. Use a number (1-999) to specify the maximum number of records to process.

5.4 Defining Compare Options

You now request formatted compare criteria to mark certain field as excluded from compare processing.
Figure 5-3. Compare Options Specification Screen
+--------------------------------------------------------------------------------+
| File-AID -------------  Compare Options Specification  ------------------------|
| COMMAND ===>                                                                   |
|                                                                                |
| Specify Compare Options to be Applied to Selected Records:                     |
|                                                                                |
|    Sync key specification     ===> N     (F = Specify key in formatted mode)   |
|                                           U = Specify key in unformatted mode) |
|                                           N = Do not specify or alter key)     |
|                                                                                |
|    Files sorted on sync key   ===> Y     (Y = Pre-sorted or keyed files)       |
|                                          (N = Non-sorted; uses read-ahead cnt) |
|                                                                                |
|    Read-ahead record count    ===> 100   (Number of records to read-ahead to   |
|                                           sync non-keyed or non-sorted files)  |
|                                                                                |
|    Compare criteria option    ===> F     (F = Formatted field compare)         |
|                                           U = Unformatted compare specification|
|                                           R = Compare entire record)           |
|                                                                                |
|    Records to compare         ===> ALL   (All or maximum number of records)    |
|    Differences to compare     ===> ALL   (All or maximum number of differences)|
|                                                                                |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+
Steps:
  1. Type an N in the Sync key specification field.
  2. Type a Y in the Files sorted on sync key field.
  3. Type an F in the Compare criteria option field.
  4. Type ALL in the Records to compare field.
  5. Type ALL in the Differences to compare field.
  6. Press <Enter>.

5.5 Specifying Print Options

The Compare Print Options screen is displayed when you specify a Y in the "Modify print defaults" field on the Compare Datasets Specification screen. The Compare Print Options screen (Figure 5-4) lets you control your compare report.
Specifying Report Format
File-AID has three different formats available to report differences in records:
F (Formatted) Uses record layouts to show differences field by field. Old fields are printed next to new fields in two side by side columns.
H (Hex) Prints each differing record showing character and vertical hexadecimal values for each byte of data. Differences are underlined.
C (Character) Prints each differing record showing only printable characters (default).
Specifying a Reporting Limit
The Max differences to report field (default ALL) is used to limit the size of the report when a large number of differences are expected.
Specifying the Level of Information to Report
The Record level report format field is used to control the type of report to produce. Options provided include:
LONG Print all records in "old" file with differing records in "new" file.
DIFF Print differing records from both "old" and "new" files (the default).
SUMM Print summary information only.
In this example, you request a formatted report of the records that are different between the OLD and NEW datasets.
Figure 5-4. Compare Print Options Screen. Requesting a Formatted Report.
+--------------------------------------------------------------------------------+
| File-AID ------------------  Compare Print Options ----------------------------|
| COMMAND ===>                                                                   |
|                                                                                |
|                                                                                |
| Print format               ===> F          (F = Formatted; H = Hex; C = Char)  |
| Max differences to report  ===> ALL        (All or maximum number to report)   |
| Record level report format ===> DIFF       (LONG, DIFF or SUMM)                |
|                                                                                |
|  Valid Record Level Report Formats:                                            |
|                                                                                |
|     LONG - Print all records in "old" file with differing records in "new" file|
|     DIFF - Print differing records from both "old" and "new" files             |
|     SUMM - Print summary information only                                      |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+
Steps:
  1. Type an F in the Print format field.
  2. Type ALL in the Max difference to report field.
  3. Type DIFF in the Record level report format field.
  4. Press <Enter>.

5.6 Identifying the Record Layout to Use

Since you requested formatted field comparison (and formatted reporting), File-AID displays the Record Layout Specification screen as illustrated in Figure 5-5.
This screen is displayed whenever a layout is needed to satisfy your request for any of the following:
  • Formatted sync key
  • Formatted compare criteria
  • Formatted differences report.
You use the single layout EMPLOYEE in the sample LAYOUTS dataset.
Figure 5-5. Record Layout Specification Screen
+--------------------------------------------------------------------------------+
| File-AID ---------------- Record Layout Specification -------------------------|
| COMMAND ===>                                                                   |
|                                                                                |
| Specify Record Layout and XREF Information:                                    |
|    Record layout usage      ===> S          (S = Single; X = XREF; N = None)   |
|                                                                                |
|                                                                                |
|    Record layout dataset    ===> FASAMP.LAYOUTS                                |
|    Member name              ===> EMPLOYEE   (Blank or pattern for member list) |
|                                                                                |
|    XREF dataset name        ===>                                               |
|    Member name              ===>            (Blank or pattern for member list) |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+
Steps:
  1. Type an S in the Record layout usage field.
  2. Verify Record layout dataset is FASAMP.LAYOUTS.
  3. Type EMPLOYEE in the Member name field.
  4. Press <Enter>.

5.7 Specifying Formatted Field Compare Criteria

The formatted Compare Criteria screen is displayed (Figure 5-6) when you specify an F (formatted) in the Compare criteria option field on the Compare Options Specification screen.
Note: If all fields are to be compared, you can skip this screen by specifying an R (Compare entire record, the default) in the Compare criteria option field.
Using formatted Compare Criteria lets you control your compare processing by defining optional field comparison criteria. By default, all fields are compared, but you can specify that some fields are to be excluded from the comparison.
Usually you exclude fields that you expect to be different, such as dates or times.
In this example, you exclude the EMP-DATE-OF-BIRTH and EMP-DOB date fields.
Steps:
  1. Type an XX (block exclude) in the line command input area to the left of the EMP-DOB-MM field near the lower portion of the screen.
  2. Type an XX (block exclude) in the line command input area to the left of the EMP-DOB-YY field near the lower portion of the screen.
  3. Press <Enter>. The Field Comment changes from COMPARISON FIELD to NOT COMPARED for each excluded field as shown in Figure 5-7.

Figure 5-6. Formatted Compare Criteria Screen. Excluding Fields from the Compare.
+--------------------------------------------------------------------------------+
| File-AID  --- Compare Criteria - ------------------------------- ROW 001 OF 036|
| COMMAND ===>                                                  SCROLL ===> CSR  |
|                                                                                |
|                                                Data                            |
|           -------Level Number/Data Name------- Type -------Field Comment-------|
|           01  EMPLOYEE-MASTER-FILE              C                              |
|             05  EMP-NUMBER                      C   ASCENDING KEY              |
|   ____      05  EMP-LAST-NAME                   C   COMPARISON FIELD           |
|   ____      05  EMP-FIRST-NAME                  C   COMPARISON FIELD           |
|   ____      05  EMP-MID-INIT                    C   COMPARISON FIELD           |
|   ____      05  FILLER                          C   COMPARISON FIELD           |
|   ____      05  EMP-TITLE                       C   COMPARISON FIELD           |
|             05  EMP-PERSONAL-INFO               C                              |
|   ____        10  EMP-NATL-ID-NUMBER            Z   COMPARISON FIELD           |
|   ____        10  FILLER                        C   COMPARISON FIELD           |
|   XX__        10  EMP-DATE-OF-BIRTH             C   COMPARISON FIELD           |
|   ____        10  EMP-DOB-REDEF          REDEF  C   EMP-DATE-OF-BIRTH          |
|   ____          15  EMP-DOB-MM                  Z   COMPARISON FIELD           |
|   ____          15  EMP-DOB-DD                  Z   COMPARISON FIELD           |
|   XX__          15  EMP-DOB-YY                  Z   COMPARISON FIELD           |
| Use X to exclude or S to respecify fields for comparison.                      |
| Use END command to continue, use CANCEL command to return to main screen.      |
|                                                                                |
+--------------------------------------------------------------------------------+

5.8 Completing Field Compare Criteria Entry

Each field you exclude with an X (Exclude) or XX (Exclude block) line command is marked as NOT COMPARED. To reset any field, use the S (Select) line command to return a field status to COMPARISON FIELD.
In this example, you are done with Compare Criteria and are ready to continue. Use the END command to signify that you have completed field criteria specification.
Figure 5-7. Formatted Compare Criteria Screen. Invoking the END Command to Continue.
+--------------------------------------------------------------------------------+
| File-AID  --- Compare Criteria - ------------------------------- ROW 001 OF 036|
| COMMAND ===> END                                              SCROLL ===> CSR  |
|                                                                                |
|                                                Data                            |
|           -------Level Number/Data Name------- Type -------Field Comment-------|
|           01  EMPLOYEE-MASTER-FILE              C                              |
|             05  EMP-NUMBER                      C   ASCENDING KEY              |
|   ____      05  EMP-LAST-NAME                   C   COMPARISON FIELD           |
|   ____      05  EMP-FIRST-NAME                  C   COMPARISON FIELD           |
|   ____      05  EMP-MID-INIT                    C   COMPARISON FIELD           |
|   ____      05  FILLER                          C   COMPARISON FIELD           |
|   ____      05  EMP-TITLE                       C   COMPARISON FIELD           |
|             05  EMP-PERSONAL-INFO               C                              |
|   ____        10  EMP-NATL-ID-NUMBER            Z   COMPARISON FIELD           |
|   ____        10  FILLER                        C   COMPARISON FIELD           |
|   ____        10  EMP-DATE-OF-BIRTH             C   NOT COMPARED               |
|               10  EMP-DOB-REDEF          REDEF  C   EMP-DATE-OF-BIRTH          |
|   ____          15  EMP-DOB-MM                  Z   NOT COMPARED               |
|   ____          15  EMP-DOB-DD                  Z   NOT COMPARED               |
|   ____          15  EMP-DOB-YY                  Z   NOT COMPARED               |
| Use X to exclude or S to respecify fields for comparison.                      |
| Use END command to continue, use CANCEL command to return to main screen.      |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+
Steps:
  1. Type END in the COMMAND field. END signifies that you have completed excluding fields and are now ready to start your compare.
  2. Press <Enter>.

5.9 Analyzing the Compare Report

When online processing is requested and you complete specification of any Extended Compare options or Print Options, compare processing occurs in the foreground at your terminal. The compare report is written to a temporary dataset and upon completion, File-AID displays the temporary dataset in an ISPF Browse session as shown in Figure 5-8.
You may need to scroll the report to the right to see information beyond column 80. All Browse commands are active including the FIND primary command.
If batch processing was specified, File-AID displays the JCL Specification screen (not shown here) from which you can enter the SUBMIT command to run the Compare function in the background. Use standard batch output review facilities to browse and print your compare report.
In the figure below, the screen is scrolled right to show both the "OLD" and "NEW" field values. Notice that only changed fields are displayed in the "NEW" file column.
Figure 5-8. Formatted Compare Report. Sample of Changed Records.
+--------------------------------------------------------------------------------+
| BROWSE -- USERID9.FACPLIST.D940609.T152715 --------- LINE 00000455 COL 012 091 |
| COMMAND ===>                                                  SCROLL ===> CSR  |
|                                                                                |
|ORD                                   "OLD" FILE RECORD:        32    "NEW" FILE|
|L NUMBER/DATA-NAME          FORMAT            FIELD VALUES                    FI|
|------------------------   --------  ------------------------------  -----------|
|E-MASTER-FILE                                                                   |
|UMBER                      C   5     81032                                      |
|AST-NAME                   C  15     JOHNSON                         MORAGA     |
|IRST-NAME                  C  10     BETTY JO                                   |
|ID-INIT                    C   1                                                |
|R                          C   2                                                |
|ITLE                       C  30     BASEBALL ANNOUNCER                         |
|ERSONAL-INFO                                                                    |
|-NATL-ID-NUMBER            Z   9     704722155                                  |
|LER                        C   1                                                |
|-DATE-OF-BIRTH             C   6     091443                                     |
|-DOB-REDEF                 RDEFINES                                             |
|MP-DOB-MM                  Z   2     09                                         |
|MP-DOB-DD                  Z   2     14                                         |
|MP-DOB-YY                  Z   2     43                                         |
|-HIRE-DATE                 C   6     921111                                     |
|-MARITAL-STATUS            C   1     M                               S          |
|ERSONAL-INFO                                                                    |
+--------------------------------------------------------------------------------+
Steps:
  1. Use scroll commands RIGHT, LEFT and DOWN to review the compare output.
  2. Enter DOWN MAX and LEFT MAX to display the last page of the report, which shows the COMPARE SUMMARY REPORT (see Figure 5-9).

5.10 Viewing the Compare Summary Report

At the end of the Compare output, a summary report of the results of the compare is produced as shown in Figure 5-9.
Also shown are the results of selection criteria and any special compare criteria specified.
After reviewing the summary report, use the END command to exit the Compare function and return to the File-AID Primary Option Menu.
Figure 5-9. Compare Report - Summary
+--------------------------------------------------------------------------------+
| BROWSE -- USERID9.FACPLIST.D940609.T152715 --------- LINE 00000543 COL 001 080 |
| COMMAND ===>                                                  SCROLL ===> CSR  |
|File-AID 8.0                                       COMPARE SUMMARY REPORT       |
|                                                                                |
|            "OLD" DSN: HFHSLC2.FASAMP.COMPARE                                   |
|            "NEW" DSN: HFHSLC2.FASAMP.EMPLOYEE                                  |
|                                                                                |
|    PRINT COMPARE CRITERIA:                                                     |
|            PRINT FORMAT:                               FORMATTED               |
|            COBOL LAYOUT USAGE:                         SINGLE                  |
|            COBOL DATASET NAME:                         USERID9.FASAMP.LAYOUTS(E|
|                                                                                |
|    REPORT FORMAT PARAMETERS:                                                   |
|            MAX NUMBER OF DIFFERENCES TO REPORT:        0  (0 = NO LIMIT)       |
|            RECORD LEVEL REPORT FORMAT:              DIFF  (Print differing reco|
|                                                                                |
|    COMPARE STATISTICS:                                                         |
|            "OLD" DATASET RECORDS READ:                49                       |
|            "NEW" DATASET RECORDS READ:                50                       |
|            "OLD" DATASET RECORDS COMPARED:            49                       |
|            "NEW" DATASET RECORDS COMPARED:            50                       |
|            NUMBER OF RECORDS MATCHED:                 42                       |
|            NUMBER OF RECORDS CHANGED:                  5                       |
|            NUMBER OF RECORDS INSERTED:                 3                       |
|            NUMBER OF RECORDS DELETED:                  2                       |
+--------------------------------------------------------------------------------+
Steps:
  1. Enter the END command (press PF3) SEVERAL TIMES to redisplay the File-AID Primary Option Menu.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.