Exercise 3.12: Comparing file differences from the Remote Systems view

Before you begin, you must complete Exercise 3.11: Searching multiple files.

If your product undergoes many changes, you will find the Compare utility useful. It allows you to compare different versions of a program and find the differences. There are two ways to do a compare: use the Compare utility in the workbench or use the Compare utility in the CODE tool. The compare in the CODE tool is more intuitive but requires you to start the CODE Editor outside of the workbench.

Using the compare utility in the workbench you can view the differences between two files by comparing them. You can compare different files, and you can compare versions in the Workbench with versions in the repository or with the local edit history.

After a comparison is carried out, the Compare Editor opens in the editor area. In the compare Editor, you can browse through all the differences and copy highlighted differences between the compared resources. You can save changes to resources that are made in the comparison editor.

Using the compare utility in CODE you can also view the differences between two files by comparing them. You enter a name of a file to compare against the file in the CODE Editor view. You can type the name of a file, or you can select one from the list of files already open in the editor. If you type the name of the file that is not already open in the editor, it is loaded into the editor. If no file is specified, the current file is compared against a new, untitled file. The current file appears on the left side of the Compare view, and the specified file on the right. You use the Compare menu to view the next and previous mismatch and to select options such as ignore case, font, protect view and show mismatches only.

Note:
Make sure all lines show in the source before starting the Compare tool.

To compare files in the workbench:

  1. Click Window > Preferences from the workbench menu.

    The Preferences window opens.

  2. In the left pane of the Preferences window, expand LPEX Editor.
    LPEX Preference
  3. Click Compare under LPEX Editor.

    In the right pane of the Preferences window make sure that the Ignore blanks check boxes are selected.

  4. Click OK in the Preferences window.
  5. Back in the Editor window of the PAYROLLC member double-click the PAYROLLC tab.
  6. Click Edit > Compare > Compare to file on the workbench menu.
    Compare

    The Compare window opens.

  7. Expand your connection.
  8. Expand *LIBL.
  9. Expand RSELABXX.
  10. Expand QCBLLESRC.
  11. Select member PAYROLLC2
  12. Click OK.
    Compare window

    The editor now will show the differences of these two members PAYROLLC and PAYROLLC2 .

    You can move from mismatch to mismatch by using the Compare menu under the Edit menu.

    Mismatches in PAYROLLC and PAYROLLC2 are highlighted in different colors so that you know where the mismatched lines are in each file.
    Compare results

  13. Click Ctrl + Shift + N to find the next mismatch.

    Next, end the compare session.

  14. Click Edit > Compare > Clear from the workbench menu.
  15. Double-click the PAYROLLC tab to return the Editor window to its original size.

You have compared different versions of the program and found the differences and now you are ready to begin Exercise 3.13: Comparing files in the CODE Editor (optional).