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.
July 12, 2021 Jon Paris
In this tip I’m going to discuss some of the options used with DATA-GEN and DATA-INTO to deal with the fact that element names in JSON and XML frequently contain characters that are not legal in RPG names.
This is important because RPG’s -INTO and -GEN operations rely on names to map elements. So if the document we are processing uses names that are not legal in RPG how can we handle that? As you will see, when dealing with -INTO operations they are quite easily handled. DATA-GEN, on the other hand, presents a different problem and we will get …Read more
April 12, 2021 Jon Paris
In Part 1 of this series I discussed the use of DATA-GEN and DATA-INTO to create “blog entries” via a web service. This time I am going to focus on using the GET HTTP method to retrieve blog entries. As you will see the basic process is very similar.
I am going to start by retrieving a single blog post, but rather than retrieve all of the data associated with the post I will show you how to restrict processing to specific elements. I will then move on to look at two approaches to processing multiple posts. The first processes …Read more
April 5, 2021 Jon Paris
Many of the “Can you help me with. . . ” communications that cross my desk these days include reference to JSON. Sometimes the questioner is receiving JSON in a file, or has to retrieve it from a web service, or needs to generate JSON in response to a query. While there are many ways to handle these requirements, RPG’s built-in DATA-INTO and DATA-GEN can do a lot of the heavy lifting for you and are quite simple once you understand the basics.
In this series of tips, I am going to start with a basic example that uses both …Read more
January 18, 2021 Jon Paris
In my previous tips (see Related Stories below), I covered the new BIFs and op-code options added with this release. This time I’m going to discuss a couple of new compiler options that focus on the conversion of character data to numeric.
While you may not have needed these capabilities to date, it is highly likely that you will in the near future. Why? Because of the rapid growth in the use of web services in the IBM i world. I don’t think I have talked to a single client in the last 12 months who was not already providing …Read more
January 11, 2021 Jon Paris
In my previous tip I outlined some of the new features added to RPG with the Fall 2020 release. In this and the following tip I will be covering the features that I ran out of space for in that first one.
This time I will cover the new FOR-EACH loop construct. I have wanted this in RPG ever since encountering it in PHP. Simply put, it automatically iterates through an array, “serving up” one element at a time. When I say “an array” I mean any kind of array, including data structure arrays, dynamic arrays and even the new …Read more
December 7, 2020 Jon Paris
In this time of pandemic we could all do with a little cheering up. So “Santa” Barbara (a.k.a. Barbara Morris) and the elves at the IBM Toronto Lab have delivered an early Christmas present. Available now via PTF for 7.3 and 7.4, there are some real gems in these latest RPG enhancements.
For the most part, these enhancements assist in improving code readability. That is to say that they are not giving us completely new functionality in the way that (say) Open Access or DATA-INTO did. Rather they give us better, clearer ways of doing things. They have an additional …Read more
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