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
- Connect to an IBM i system, which we will call “System A,” using Code for IBM i.
- Open a source member or file on System A.
- Press
Shift-Ctrl-N
to open a second instance of VS Code. - Within that second instance, connect to System B.
- Press
Ctrl-Alt-O
to browse for the source on System B. - Choose the source you want. Open for read-only if possible.
- Press
Ctrl-A Ctrl-C
to select all source content and copy it to the clipboard. - Press
Alt-Tab
to switch to the first instance of VS Code: System A. - Press
Ctrl-K C
to compare your source on system A to the clipboard (source on System B) – or pressF1
and selectFile: Compare Active File with Clipboard
. - 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.
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.
Leave a Reply
Want to join the discussion?Feel free to contribute!