Can VS Code—the free, popular, extensible editor—replace the venerable SEU, which hasn't been updated since 2008? Check out the Code for IBM i extension.
Nearly all IBM i users are familiar with SEU, the Source Entry Utility. It has been around "forever," but it hasn't been updated since 2008 and remains frozen at the V6R1 level. RPG has had significant enhancements since then, and SEU doesn't understand the new syntax.
IBM's replacement for SEU is Rational Developer for i (RDi). It has context-sensitive help, content assist, an outline, a verify option, and lots more. As far as I am concerned, RDi is the gold standard for IBM i development, but unfortunately it is priced similarly to gold and is out of the reach of some developers.
Virtual Studio Code (VS Code) is a free, open-source, GUI editor first released in 2015. It’s very popular, and it's extensible. This article focuses on the Code for IBM i extension, which I think is the extension that integrates best with the IBM i. I'll give you a feel for what it can do and then conclude with some wrap-up thoughts.
Code for IBM i: Overview
Code for IBM i is not easy to describe. It is a bit like green-screen PDM, SEU, WRKLNK, and EDTF combined, with elements of RDi thrown in, all in a GUI interface. It allows you to browse, edit, and compile both traditional source files and source files in the IFS. It highlights compilation errors and shows them in the source, a super productivity feature that RDi also provides. You can have connections to multiple machines and multiple named connections to each machine. And more.
This article is not intended to be a tutorial on Code for IBM i but rather to introduce you to some of the capabilities a typical IBM i developer would use. When you install the Code for IBM i extension, a Quick Start Guide is included, and it has a link to more detailed documentation on using and customizing the extension.
Probably the best way to describe Code for IBM i is to show some screen shots of what it looks like for an IBM i coder.
Code for IBM i: Browsers
When you first connect to an IBM i, the Code for IBM i screen will look something like Figure 1 below. Note that, at the bottom of the screen, you can see the IBM i host (here it's ipublic.online). At the left is the sidebar showing the available browsers and the library list from your user profile. (If you have tweaked your VS Code layout, you may see something a little different.)
Figure 1: First-time Code for IBM i display
You can easily close or expand a browser by clicking on it, and you can add or remove items from it. Figure 2 below shows my adjusted browsers, where I have added several source physical files to the Member Browser and have expanded QPRGLESRC.
Figure 2: Member browser expanded
In Figure 3 below, I have closed the Library List, expanded the IFS Browser, and drilled down a couple of folders to see the contents of the DATE_UDF folder. If I hover over DATECRTFN.SQL I can see the complete path, showing I'm several directories down.
Figure 3: IFS browser expanded
The browser is the standard VS Code approach and is like RDi and other GUI code editors.
Code for IBM i: Editing and Compiling
Back in the member browser, I have expanded the DATE_UDF source file and clicked several members to open them. Figure 4 shows the results.
Figure 4: Multiple members in the DATE_UDF source file open for editing
The leftmost tab is the one with the focus and is a /FREE RPG module that is nicely colored. The multiple tabs feature for open files is a standard VS Code feature.
Ctrl+E is the shortcut that compiles the code in the tab with the focus. Since this is an RPGLE member, there can be several compile options, as shown in Figure 5.
Figure 5: Compile prompt for RPGLE source
This source is going to be made into a service program, and I want to create an RPG module, so I cursor down to, or click on, Create RPG Module and press Enter. Figure 6 shows the results.
Figure 6: Prompt for additional compile changes
I could change CRTRPGMOD here to add or remove parameters.
Compile commands, or "Actions" (discussed later), can execute immediately or prompt you for additional input, as in this case. (This is analogous to the "?command" syntax you can use in interactive CLP programs or in PDM User-Defined Options.) In this case, the default is what I want, so I just press Enter.
The code is compiled, and the success or failure is listed in the bottom right corner of my screen, as in Figure 7.
Figure 7: Compile results reported
If you look again at Figure 7, you will notice 9 problems reported and listed in the Problems tab. If I click one of the problem lines, the cursor is positioned to the source line in question, line 103 in Figure 8 below.
Figure 8: Positioning the cursor to the line in error
This feature makes finding and fixing errors a whole lot easier than in SEU.
Alternatively, you can just scroll through the source, looking for the squiggly lines underneath the errors. If I hover, the error message is shown. In Figure 9 below, the cursor is hovering over line 107.
Figure 9: Hovering over a squiggly, annotated line
Astute readers may notice that this compile was successful and may wonder why VS Code is reporting problems. I can control which problems are reported in the Problems tab by clicking the little "filter" icon and choosing what level of problems I want to see, as in Figure 10, where I have filtered out the Info messages. (It still has a problem count of 9, but that's the way VS Code works.)
Figure 10: Info messages filtered out
Want to see the compile listing? I can find that by clicking on the Output tab. I have to make sure I have IBM i Output selected in the dropdown on the right. See Figure 11.
Figure 11: Compile listing
Code for IBM i: Actions
An action is something that is applied to the tab that has the focus. Ctrl+E to compile, as shown earlier, invoked the CRTRPGMOD action. An action can also be applied to an object in a browser by right-clicking it.
Code for IBM i comes with a set of standard actions. Clicking on Actions down at the bottom brings up the Work with Actions tab. Figure 12 show the currently supplied standard actions.
Figure 12: Work with Actions tab
You can add a new action by clicking on New Action. You can change an existing action by clicking on it. Figure 13 shows the CRTRPGMOD action used earlier.
Figure 13: The CRTRPGMOD action
Code for IBM i: Conclusion
I've given you a feel for some of what VS Code with Code for IBM i can do. There are other capabilities, but I don't have space here to show them.
Is this a viable option for IBM i developers? Definitely.
Honestly, Code for IBM i is not RDi, but RDi is currently in a class and price point of its own.
Code for IBM i is free, it is open source, and it offers much that SEU does not provide and never will provide. Code for IBM i is also being improved and enhanced.
VS Code loads quickly, is also regularly improved, and is an all-around extremely competent editor for all kinds of files.
I Recommend That You Give It a Try
If you are already using VS Code, you'll quickly come up to speed with Code for IBM i. It you haven't used VS Code, it is easy to install and comes with a number of tutorials. You will need a little time to become familiar with it, but once you do, you may find you use it for editing lots of file types.
Plaudits and Acknowledgements
Code for IBM i is largely the work of Liam Allan, who is well-known in the IBM i world and recognized as an IBM Champion. He is committed to extending and improving Code for IBM i and keeping it open source. So far, 13 others have contributed to the project, and the functionality is increasing. You can follow the development, raise issues, ask questions, or contribute on GitHub.
LATEST COMMENTS
MC Press Online