REPL Tool Gives RPG Developers Immediate Feedback
April 20, 2022 Alex Woodie
If you’ve ever wanted to quickly know what a small snippet of RPG code does but do not want to take the time to compile a test program and go through the debugging process, then you might be interested in rpgle-repl, a new open source Read-Evaluate-Print-Loop (REPL) utility that was recently shared with the IBM i community.
Tom Sharp, a senior developer at a financial software provider in the UK, says he created rpgle-repl after receiving numerous requests from his colleagues about what particular pieces of RPG code actually did.
“The first place to check would always be the IBM Redbooks (especially if it was a section with examples!), then a search for articles and forums with similar questions on sites such as IT Jungle and Code400 for a more detailed walkthrough,” Sharp tells IT Jungle.
If these resources didn’t provide an answer to his specific query, then he would ping his colleagues via his company’s Slack. Lastly, he would write a skeleton program to run the snippet in question, he says.
Now he has something better. Instead of taking the time to write a skeleton program and then compiling and debugging it to see how it impacts the values of local variables, he created rpgle-repl, which he thinks is a better way.
“This was something I created for our development team after realizing that our internal chat was full of questions like ‘What exactly do all these built-in functions do? How does this weird legacy code respond to these inputs? And is this the right free format equivalent to this old fixed format code I found?’” Sharp wrote in a post to Ryver, an online forum for discussions about open source IBM i software.
In his Ryver post, Sharp describes rpgle-repl as “a lightweight wrapper to compile and run a program containing on-screen code, with some crafty parsing to print out the values at runtime.”
The rpgle-repl offering, which can be downloaded from Sharp’s GitHub repository, speeds up the development process by allowing developers to quickly see what a snippet of code is doing. And not only does it automatically compile snippets of code, Sharp said, but it also dynamically records changed variables and displays the results on screen.
Sharp says rpgle-repl lets him quickly see what his colleagues are up to, and whether what they’re doing is working or not. And since the snippets created by users are automatically saved according to their session ID, rpgle-repl allows users to share their snippets with others.
The feedback among Sharp’s colleagues has been very positive, he says.
“I think our most common use case is users double-checking the right combination of keywords to turn a date into a UK format date string,” he says. “My colleagues have also really helped shape usability questions on saving snippets and navigating the screen, and I’m always really excited to see how people are using it — especially when they start using it in ways I hadn’t even considered! There’s a real feeling of joy in seeing that people have been able to use rpgle-repl to check in less than a minute something that would have previous taken five minutes to look up.”
The new tool also received a warm reception on Ryver. “Wow, that’s quite amazing,” wrote Kevin Adler, an IBM engineer based in Rochester, Minnesota. Others noted the potential of rpgle-repl to function as a training mechanism for new programmers, particularly with the ability the share snippets.
Sharp said rpgle-repl has settled down as a stable product. He is soliciting feedback, and is open to requests for additional features. “My slow-moving roadmap has supporting nested data structures, and resolving a variable name length limit up next,” he said.
For more information or to download rpgle-repl, see github.com/tom-writes-code/rpgle-repl.