Our continuing series on RDi 9.6 focuses on some of the new and exciting changes to the editor itself.
OK, "exciting" may be stretching it just a little, but "helpful" and "appreciated" definitely come to mind when looking at some of the new features in the editor. Many of the things I've written about in my previous articles in the series are rather flashy; these other new features provide more meat-and-potatoes functionality that may actually be more productive than some of the glitzier enhancements we've already seen. Let's take a look at some of them.
Exciting Isn't Always Good
I've found that exciting isn't always good in software tools. While there are certainly times when programming is exciting (at least to me, although I am a true geek, so take that how you will), it should never be while I'm actually typing in my source code. Exciting source code entry is usually problematic source code entry. For example, one of the ways entering code is exciting is when a keystroke acts differently depending on where you are, especially when that difference is somewhat arbitrary.
The Enter key in RDi's LPEX editor for ILE RPG was just such a case. In case the term is unfamiliar, LPEX is just the collective name given to the SEU replacement editors in RDi. While at first glance they look very much like the editors in other IDEs (such as Microsoft's Visual Studio), up until this most recent version, they had some very distinct differences unique to the IBM i. For example, in what was perhaps a nod to the fixed-column nature of old RPG code, hitting Enter on a source line didn't split the line; it just added a new, blank line after the original line. This is entirely counter to what most other languages do, and it really causes some shifting of the mental gears for those who program both in the traditional IBM i world and in the greater world of C-like languages.
Even the "sort of" replacement for the Enter key, the split line command (Alt+S), doesn't do a good job; the default behavior is to simply create a blank line and move the "split" portion to the next line but starting at the same position as it was in the previous line with no attempt at word wrapping. While it wasn't a real problem in fixed-format coding, this behavior became more annoying as we moved to the world of free-format RPG. Let's take an example, using a key expression to get a record from a database file.
Figure 1: This is a CHAIN operation that fits on one line.
Here's my CHAIN operation. Let's say, though, that I need to add an additional key field. As I type in the additional field, it becomes clear that the line is too long, so I want to split it. As noted, hitting Enter just adds a blank line, so that's no help. The default behavior for the alternative, the split line command, is to move the end of the line down, like so:
Figure 2: This is the same CHAIN operation with an additional keyword after hitting Alt+S to split it.
Well, that wasn't particularly helpful, either. Now I have an unfinished line with an error. At this point, I have to hit backspace a bunch of times to format the line nicely. However, the new behavior of the Enter key is much more similar to what programmers have come to expect from modern editors.
Figure 3: This is the result of hitting Enter after the closing parenthesis in the new release.
There we go. The editor moves the overflow to the next line and indents it nicely. Yes, this is a very simple thing, but as you continue to do more editing, particularly if you're working in multiple operating systems and languages, the consistency is nice to have.
More Indenting Fun!
Another simple enhancement that I really appreciate is the way that you can indent blocks of code. If you've worked in just about any other editor, you know that you can mark a block of code and just move it right and left using Tab and Shift+Tab. Until now, that wasn't so easy in the LPEX editor. Take a look at a loop.
Figure 4: This is a simple loop to process the lines in an order.
Now I want to condition that entire loop. I add a simple IF condition as so:
Figure 5: The loop now needs to be indented within the IF construct.
If you've done any editing in free-format RPG, you've probably dealt with this. The brute force method is just to position the cursor to the beginning of the first line, type however many spaces you use to indent, drop to the next line, hit Home to get to the beginning, and repeat. Tedious and annoying, especially with more than a few lines.
Figure 6: With the new editor, just mark the block of code and press Tab.
This is much easier. Mark the code, press Tab and the code bounces to the right. Shift+Tab moves it back. The technique is simple, and perhaps just as important, it's familiar to non-IBM i programmers; it's just one less hurdle for them to overcome as you try to make RPG programmers out of them.
So Why Is the Embedded SQL RPG Editor Left out in the Cold?
Unfortunately, some of the best additions to the system just don't make it to the SQLRPGLE editor. It's too bad, really, because the enhancements in the embedded SQL syntax and the continuing functional improvements in the SQL support make it easy to go with SQL in more of my programs these days. It's just that I rely on some of the new features in RDi...and when they don't work in SQL, it's really disappointing.
Some of the features work inconsistently; others are just missing. For example, the context-sensitive suggestions from Ctrl+Space sometimes get lost, particularly when it comes to field definitions. I've found in the past that complex data structures can cause the situation, but other times there is no obvious reason. Ctrl+Space just stops working, and that's really a problem when you start creating well-structured RPG programs using named constants.
A real annoyance - as in something that annoys me but doesn't cause any real pain - is the fact that the wonderful Ctrl+Click hyperlinking doesn't work in the SQLRPGLE editor. I believe it was version 9.5 that added this capability; if you hover over an artifact in your source code while holding down the Ctrl key, the artifact turns into a hyperlink that you can then click, taking you to the artifact's definition, such as the line where a field is defined, or the beginning of a subroutine or procedure. While not as fundamental a part of my toolkit as the Ctrl+Space, it's just jarring that Ctrl+Click is unavailable in SQLRPGLE. These inconsistencies are enough to make me hesitate when deciding whether to add SQL to an existing RPGLE program, and that's the last thing you want from your editor.
Still, RDi Continues to Be the Most Productive Editor Available
Yes, you might argue that there aren't all that many editors out there, period, but RDi is light years ahead of anything else. I can't imagine developing without it, even with its quirks, and if you haven't had a chance to dive into RDi, then I recommend you do so whenever you can.
Have fun!
LATEST COMMENTS
MC Press Online