Visual 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?
- Create or open a member (or streamfile!) with the .sql extension
- Write an SQL statement:
select * from sample.org
- Highlight the statement in the editor and press Control+R (or Command+R on Mac)
- The result should appear in a new tab in a pretty table
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’.
- Chose the first source you want to compare. Right-click on it and choose ‘Select for Comparison’
- Chose the source you want to compare it with. Right-click on it and choose ‘Compare with Selected’
- The diff will appear
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!
- Right-click on a source file you want to search in from the Member Browser
- A box will appear where you can enter your search term. Enter the term and press enter
- 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
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.