24
Tue, Dec
1 New Articles

Practical RDi: Exploring RDi 9.6, Part 3

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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.

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 1 

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:

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 2 

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.

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 3 

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.

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 4 

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:

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 5 

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.

Practical RDi: Exploring RDi 9.6, Part 3 - Figure 6 

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!

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: