Compare is used to logically compare record and image data across two x9 files. The currently loaded x9 file is compared against a secondary x9 file which is user selected. This is an excellent regression testing tool since it can confirm that an x9 file created by a new or modified application process is equal to another file which has been previously confirmed to be correct.
Compare requires that the items within the x9 file be structured in the same logical order to allow the matching process to remain aligned within the two files. Positioning is internally maintained using record types and then additionally on the item amounts and item sequence numbers from record types 25, 31, 61, or 62. There are no other assumptions or requirements for the matching process.
The compare process reports on field level difference by field name when there are individual records that are aligned by the matching process. This makes it easier to identify the actual differences between two records that have been matched. The compare process also reports on records determined to be inserted on one side or the other of the matching process. These records are present on file one but are not present on file two.
The compare process is invoked as follows:
- Use the ‘select’ button to select the secondary file to be used for the compare. Once a file is selected, it will be located and summary information will be provided which helps you determine if you want to continue with the compare.
- After statistics are confirmed, then use the ‘compare’ button to initiate the actual file compare process. Differences will be displayed as identified. The progress bar will be updated as the compare continues. A text file will be written to the TEMP folder and can be used (as needed) when you require a log of the identified differences.
- Once the compare has been completed, the “view’ button can be used to obtain a summary of all fields across all record types which were determined to be different.
- The “launch’ button can be used to invoke a more detailed file comparison (at the x9 record level) when a compare tool is available for your environment. This process can be very informative since it provides a better visual comparison of the differences between the two files. This comparison includes image lengths but not the actual image data. The compare tool itself is pluggable and can be modified based on your specific requirements.
- Use the ‘reset’ button to reset and allow the currently loaded x9 file to be compared to another secondary file.
The default is to compare all fields within all x9 record types. There are times when that is not appropriate. For example, you may have modified an application that creates x9 files and you know that as a result of that change you are expecting a certain field to have different contents. In this situation, it is very helpful to explicitly exclude that one field from the comparison so you can then easily determine that all other fields within the x9 file are equal as expected. This exclusion is accomplished by using the selection panel on the right. One or more fields can be excluded from the compare process. You should indicate the fields to be excluded before you select the secondary x9 file to be compared.
Implementing an External Compare Tool
The x9 file compare process can be further enhanced by adding an external compare tool. This compare can then be launched after the x9 file compare has been completed and allows you to do further analysis of any differences which may exist. This is an optional process to add value to your environment. This is a text-to-text comparison of two text files which are created during the compare process. Launch of the external compare tool allows you to visually explore the differences between the two x9 files that have been compared. This is possible due to the powerful string matching capabilities of the text compare tools that are available in the industry today.
X9Assist is not hard-wired to a specific external comparison tool. You can implement the preferred external comparison tool of your choice through the “comparex9.bat” batch script. This single batch script is used to both identify and launch the comparison tool. This batch script allows the compare tool to be generic and external to our comparison process. Our distribution by default supports the following external compare tools:
- WinMerge: a freeware alternative.
- UltraCompare: a powerful file edit / compare tool and an industry leader which is installed by many organizations on a world wide basis.
Batch file “comparex9.bat” is located in the program launch folder. A parameter of “-isDefined” is initially invoked to determine if the compare tool exists. This pre-launch must return an exit code of 10 when the compare tool exists. The compare is then launched using this same batch file, using two parameters which represent the two files to be compared. The comparex9.bat file can be modified to invoke the preferred tool for your environment.
The following options should be set to maximize your usage.
- View from the menu bar
- Enable line differences
- Enable line numbers
- Enable margins
- Options (wrench) from the tool bar
- General – enable compare white space
- General – enable ignore case
- Editor – enable view line differences at character level
The “up arrow” and “down arrow” on the tool bar can be used to skip to each identified difference with the compare.