Compare Source Between Two Partitions using VS Code for IBM i

Comparing source code between IBM i partitions has been a desired feature of Code for i. Although connecting to two systems within one Code for i window is not yet supported, comparing source from two systems IS possible.

Patrick Behr recently posted a comparison technique using Git that works for multiple files. Another technique, which seems well suited for comparing single files rather than multiples, was provided by Christian Jorgensen in the Code for i Github repository. We share both versions below.

Patrick Behr’s comparison technique

Thanks to Patrick for offering a growing library of how-to videos to the Code for i community.

Christian Jorgensen’s comparison technique

  1. Connect to an IBM i system, which we will call “System A,” using Code for IBM i.
  2. Open a source member or file on System A.
  3. Press Shift-Ctrl-N to open a second instance of VS Code.
  4. Within that second instance, connect to System B.
  5. Press Ctrl-Alt-O to browse for the source on System B.
  6. Choose the source you want. Open for read-only if possible.
  7. Press Ctrl-A Ctrl-C to select all source content and copy it to the clipboard.
  8. Press Alt-Tab to switch to the first instance of VS Code: System A.
  9. Press Ctrl-K C to compare your source on system A to the clipboard (source on System B) – or press F1 and select File: Compare Active File with Clipboard.
  10. The diff is now opened in a new tab. (Example below.)

The image below is an example of comparing the QSTRUP program on two systems, using the clipboard technique. (Blurring added for confidentiality.) Red indicates code removed. Bright green indicates code added.

VS Code's "Compare with Clipboard" makes it easier to compare source on one system to another.

VS Code’s “Compare with Clipboard” makes it easier to compare source on one system to another.

Thank you to Christian Jorgensen for this convenient tip. Christian is an IBM Champion, member of CEAC, and a contributor to the Code for i project.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.