During the latest round of IBM i Technology Refreshes, TR2 for version 7.3 and TR6 for version 7.2 enhancement, IBM also introduced three enrichments for RPG.
These changes will be released as individual PTFs, around the April 2017 timespan, as with the Technology Refreshes.
Let us take a look at these.
These are:
- Nested data-structures
- New %Max and %Min built in features
- Align(*Full) Keyword
Each of these new features came through the RFE (Request for Enhancement) route, which shows how worthwhile this process is. IBMs RFEs can be seen on the DeveloperWorks website, which can found here.
Let me go through each of these new changes.
Nested data-structures
The first one on the list, the nested data-structures is a very useful feature that allows many data-structures to be encompassed within another data-structure.
In the figure below, we can see that we can now hold customer details for both the billing and the shipping addresses all incorporated within the main customer data-structure.
We can see in the figure below how we populate these embedded fields.
New %Max and %Min built in features (BIFs)
These two new built in functions will return a value from a set of arguments.
The %Max function will return the maximum value from a set.
And to follow on, %Min will return the minimum value out of a set.
There is no maximum number of arguments it will test, but obviously there must be at least two.
How many of us have been coding this functionality in a subroutine, you are not alone, a useful addition IBM.
We can see both these built-in functions in use below to determine the oldest and youngest dates.
Align(*Full) Keyword
The new keyword option Align(*Full) for data-structures, is a requirement when calling certain C functions from within RPG.
Without this new keyword, RPG data-structures are smaller than the C structures, which can cause memory issues.
Conclusion
With all the euphoria about Open Source on our favourite server, its great to see IBM still looking to enhance their main programming language.
Thanks to Barbara Morris at IBM for the heads-up on these enhancements.
If you have any questions concerning RPG, please get in touch, I’m sure we can help.
I’m looking forward to the next round of the i-UG user group meetings this year in the UK. Hopefully we can meet up at the Rochdale and London events in March. Full details can be found on the iUG site here.
Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems.