VS Code for IBM i — Tips and Extras

Visual Studio Code 1.35 iconVisual Studio Code is a widely used IDE in the non-IBM i world. Recently we released Code for IBM i, a freely available extension for VS Code that supports RPGLE and COBOL development for IBM i. You can read about the basics of Code for IBM i and about code coverage functionality in my previous posts.

Today I’m going to cover three additional tips for using Code for IBM i. Of course, for any of this to work, you need to install Code for IBM i.

Tip #1: Viewing SQL results inline

This is such a nifty one. Did you know you can run SQL statements and view the results inline?

  1. Create or open a member (or streamfile!) with the .sql extension
  2. Write an SQL statement: select * from sample.org
  3. Highlight the statement in the editor and press Control+R (or Command+R on Mac)
  4. The result should appear in a new tab in a pretty table

Code for IBM i: View SQL results inline

Note: The library list is not used when running SQL statements when using this method. You should make sure you are specifying the schemas when accessing SQL objects.

Tip #2: Comparing two sources

It is possible to compare two different sources with Code for IBM i—no matter if they are members, stream files, or a mix.

When you right-click on a source member or a stream file, you will see options to ‘Select for Comparison’ and ‘Compare with Selected’.

  1. Chose the first source you want to compare. Right-click on it and choose ‘Select for Comparison’
  2. Chose the source you want to compare it with. Right-click on it and choose ‘Compare with Selected’
  3. The diff will appear

Code for IBM i: Comparing Sources

Note: This works on any source/text documents. Whether it’s RPGLE, COBOL, PHP, JavaScript, etc… it works!

Tip #3: Search contents of source files

Are you looking for something in your source code but forget where it is? Why not search for it with Code for IBM i!

  1. Right-click on a source file you want to search in from the Member Browser
  2. A box will appear where you can enter your search term. Enter the term and press enter
  3. Results will appear when the search is done. The results appear in a new text document with hyperlinks to the member, which when control+clicked on, will open the member in a new tab

Code for IBM i: Search contents

Note: This also works for IFS directories.

These are just three ways that Code for IBM i helps you boost your productivity. Watch this space for additional tips on this free extension to Visual Studio Code.

As always, for training related to this or any other IBM i development technology, contact us.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.

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