Tip of the Month
I’m pleasantly surprised about how easy it has become to work with delimited strings in RPG with the recent enhancements from IBM. For splitting a delimited string into fields, they added the %SPLIT built-in function in April of 2021. It works like this:
In this example, record is a variable containing data from a delimited file (in this example, the data is delimited by the pipe character). The %SPLIT built-in breaks it up into fields and puts each one in a separate array element, in this case in an array named arr.
Now that it has been split, it’s easy to convert the data to something that you can use in a database!
As I write this, %CONCATARR has been announced but is not yet available. I expect to see PTFs to make it available in December 2022 – and I can’t wait!
Midrange Dynamics Development & Solutions Architect
Scott Klement is an IT professional with a passion for both programming and mentoring. He joined Midrange Dynamics at the beginning of October 2022. He formerly was the Director of Product Development and Support at Profound Logic and the IT Manager and Senior Programmer at Klement’s Sausage Co., Inc. Scott also serves on the Board of Directors of COMMON, where he represents the Education, Innovation, and Certification teams. He is an IBM Champion for Power Systems.
Subscribe to our newsletter and join us next month to see what is happening in Scott’s Corner. Add a great dad joke to your arsenal and gain an even better IT insight from this recognized industry expert as he continues his quest to educate and support the IBM i community.