A popular development guru, Jon is an IBM Champion and a frequent author, forum contributor, and speaker at User Group meetings and technical conferences around the world, holding a number of speaker excellence awards from COMMON. He is a partner at Partner400 and System i Developer, the organizers of the RPG & DB2 Summit conference. Paris cut his teeth on the System/38 way back when, and in 1987 he joined IBM's Toronto software lab to work on the COBOL compilers for the System/38 and System/36. He also worked on the creation of the COBOL/400 compilers for the original AS/400s back in 1988 and was one of the key developers behind RPG IV and the CODE/400 development tool. In 1998, he left IBM to develop and deliver education focused on enhancing IBM i application development skills with wife Susan Gantner, also an expert in IBM i programming.
October 12, 2020 Jon Paris
In my first two tips in this series I covered the basics of automatic sizing arrays and variable sized arrays. In this final part am going to discuss some of the current limitations in this support and the facilities IBM has put in place to help circumvent them.
IBM publishes an extensive list of the limitations, but in normal usage only a couple present “real” restrictions in practical terms. If you are curious though, you can find the full list here.
The first limitation to bear in mind is that, currently, only top-level variables can be defined …Read more
August 17, 2020 Jon Paris
In my first tip on this topic I covered the automatic sizing option (*AUTO) for the new dynamic arrays. In this tip I am going to look at the second option (*VAR), which allows the programmer to directly control the capacity of the array, growing and shrinking it as required. In addition I will also briefly cover the third option (*CTDTA) which, as you may have guessed, relates to compile time arrays.
Using A Varying Length Array
Let’s start with a brief example of using a variable sized array in conjunction with SQL. This approach answers the classic question of …Read more
July 20, 2020 Jon Paris
Some 12 months ago, when the 7.4 release was announced, I wrote the Guru Tip “7.4 Brings New RPG Goodies” describing the features of 7.4 that were also available on 7.3. I said at the time that I would return later to discuss the 7.4-only features. So now that a significant number of shops have access to 7.4 that time has arrived.
Dynamic arrays are the answer to the perennial programmer question: “Just how big do I need to make this array?” In my experience it doesn’t actually matter how big you make it, at some point down the road …Read more
March 4, 2020 Jon Paris
When I re-read this tip while looking for a “Classic” candidate, I was reminded that the underlying issue it addresses, namely how data is actually stored in an RPG program, is one that many RPG programmers don’t really have a firm grip on. That alone made it a good candidate. But perhaps even more important is demonstrating this topic to the many new programmers coming onto the platform. Unlike those of us who started off with assembly languages, C, RPG, or COBOL, modern programmers trained in C#, Python, or PHP have never had any need to understand the mechanics of …Read more
March 2, 2020 Jon Paris
In this tip I’m going to address a question that arises regularly on RPG-oriented Internet lists, namely: “Is there an easy way to convert a character string to its hexadecimal equivalent?”
One answer, of course, would be to write your own routine using lookup tables, but there is a far easier way. We can take advantage of the system’s hex MI APIs. These were originally surfaced for use by C and C++ but, thanks to the joys of ILE, can be used by any ILE language. Not only that, RPG’s prototyping support makes them really easy to use. In fact, …Read more
February 5, 2020 Jon Paris
In my previous tip I returned to the “Bevy” series to tell you about the latest addition to the family: %ScanRpl. Shortly after completing that tip I realized that there have been a number of more recent BIFs such as %SubArr and some enhancements to existing BIFs like %Trimx that seem to have escaped people’s notice. In this tip I attempt to fill those omissions.
%Trim: Specify Characters to Trim
Let’s start with a BIF that hopefully you are all familiar with: %Trim. Before going any further I should point out that when I say %Trim, I am referring to …Read more
January 8, 2020 Jon Paris
This gem of a BIF was introduced with the V7.1 release and so was not available some five years ago when I wrote my original Bevy series of tips. Now that most active development shops are running V7.1 and later it seems a good candidate for a “Classic” to remind readers of its capabilities. The intervening years have not dimmed its utility and it remains one of my all-time favorite BIFs.
Simply put, %ScanRpl will search a target string for a given character sequence and replace it with another. Not only that but it will then continue to search through …Read more
August 14, 2019 Jon Paris
Remember the bad old days when dinosaurs still roamed the earth and the only way to build strings in RPG involved playing silly games with arrays? Or worse still, obscure combinations of MOVE operations? Thankfully those days are far behind us — although sadly there are still a few RPG/400 dinosaurs coding away!
RPG IV introduced many powerful new string handling options, such as the %TRIMx family of BIFs, but even now there are capabilities in the language that few programmers fully exploit. One of my favorites is variable length fields. This lack of familiarity made this tip an obvious …Read more
July 17, 2019 Jon Paris
The history of indicators pre-dates even the earliest versions of RPG and takes us all the way back to the old tabulating machines, perhaps even earlier depending on how broad a definition one uses. What is without doubt, though, is that indicators in the sense of *INnn and *INLR were added to the RPG language as a vehicle for translating those old tabulator board programs.
RPG has grown a lot since those early days, and yet many people still write code using the old-style numbered indicators. LR? Well, we’re kind of stuck with that, but there hasn’t been a need …Read more
June 19, 2019 Jon Paris
Every time I teach some of the more recent additions to RPG, such as XML parsing or Open Access, I find that I need to include some “remedial” education on some of the data definition enhancements that have been made to the language over recent releases.
Most of these enhancements came into the language many years ago back in the days when D-specs were de rigueur, but if you had no immediate need for them, they may have passed you by. After all, even the most avid reader of this newsletter has probably forgotten most of what they read here …Read more