My Favorite IBM i 7.3 Enhancements for Developers

IBM i (OS/400, i5/OS)
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

IBM has officially announced IBM i 7.3. Here are some additions that interest me.

 

It is that time again. IBM has lifted the veil on the new version of the IBM i operating system. IBM i 7.3 is full of enhancements of all sizes. There is certainly a lot to read up on, and I have not been able to kick the tires on some of these enhancements yet. I plan to do just that in the near future.

 

In the meantime, I thought I would point out the enhancements that, in my opinion, are useful or interesting to me as a developer. These features may help you make the case to your management to start planning your upgrade.

 

Limitless Free-Format RPG Support

This enhancement is not entirely new, but it ships with 7.3 and I have not written about it yet. The last piece is finally in place for RPG’s new full free-form syntax. By placing **FREE in the very first line of your  RPG source, your code will no longer be limited to columns 7 through 80. That’s right! Your code can begin in column 1 and continue to the maximum width of your source member. If your RPG source is stored in an IFS file instead of a traditional source file, there’s no limit for line length. With regard to using IFS files for RPG source, another enhancement makes this even more interesting, but we’ll get to that in a moment.

 

Another effect of the **FREE directive is that your source may contain only free-format code. There can be no mixing older syntax with new. I personally like this. I’m not a fan of mixing syntax in a program, but some may not agree with that sentiment. Regardless, it’s an important point to note.

 

New %SCAN Functionality

There are two new enhancements in this area. The first is the ability to specify the length of the string to be scanned. This situation has not come up often for me, but when it has I have used %SUBST() in conjunction with %SCAN() to achieve the desired result. Any time I can simplify my code, I’m on board. The length for the scan is specified as the fourth parameter of the built-in function (BIF).

 

position = %Scan( String_To_Search_In : String_To_Search_For : Start_Position : Length_To_Search );

 

The second is a new BIF, %SCANR(). This new function is like the %SCAN() function, but it searches from right to left. This is very useful when looking for the last occurrence of something in a string. Is it something I’ll use every day? No, but it will be handy when I do need it.

 

Improved Data Structure Support for File I/O

If you’re going to use record-level access for your file operations in RPG, I have always recommended using data structures for those I/O operations for many reasons. The part that was always overly complicated, in my opinion, was the need to use different data structures for input and output operations. There may be times when using separate data structures is beneficial, but the developer shouldn’t be forced to use them.

 

This limitation was lifted for operations involving display files some time ago and has now been lifted for all files. In order to use the same externally defined data structure for input and output operations, it should be defined as follows:

 

Dcl-DS MyDataStructure ExtName(‘MYFILE’ : *ALL);

 

It seems if you create your data structure using the LIKEREC keyword, the compiler will default to using the *ALL format if the input and output buffers match.

 

Easier Use of ALIAS Keyword on Files

We have had the ability to use longer field names from files in RPG for a little while now. The ALIAS keyword was one of my favorite additions to the language in recent years. If the database supports field names longer than 10 characters, so should the system’s primary programming language! The only caveat to using the ALIAS keyword was that you had to use data structures for all file I/O. This wasn’t an issue for me, as I used data structures for I/O anyway. For others, this wasn’t the case.

 

With the latest enhancements for RPG, you can specify the ALIAS keyword on a file and it will use the longer field names, if defined, without the use of data structures for file I/O. This enhancement eliminates the only barrier to using ALIAS in your programs. Give it try. Future developers will thank you for it.

 

More Open-Source Technologies

As a developer, you should be paying attention to IBM’s trend of adding open-source tools to the IBM i operating system. The following is a partial list of open-source tools available to developers as of the latest release.

  • Node.js—Node.js provides an environment for running JavaScript code on the server instead of in the browser. This project is gaining popularity in the development world as JavaScript is one of the most commonly known programming languages in use. The idea of having the same programming language on the server side and in the browser is very attractive to many developers.
  • Python—IBM i now has both Python 2.7 and Python 3.0 available. I am no Python expert, but my understanding is that there are many differences in these two versions of Python, and the Python community is divided on which version is best. Having both versions gives us flexibility in the open-source projects we can bring to IBM i.
  • Git—Git is a source-control management tool commonly used in the open-source world. It can track changes to code, merge changes from multiple developers, and manage code versions. It’s not platform- or programming language-specific. I mentioned earlier that the removal of source-length limits for RPG source in IFS files was particularly interesting. Git can be used to manage the IFS-based RPG source files! I’ll do an article on this subject in the near future as I believe it could be very interesting to smaller shops with no source control products.
  • Orion—Orion is a web-based IDE used for developing in Node.js, Python, and other open-source languages. I even see that IBM has added an RPG syntax verifier to the shipped version. That’s very cool! I haven’t tried it yet, but it’s likely a step up from SEU when maintaining RPG code. My understanding is that your RPG source will need to be stored in IFS files, but it could be a real option for shops that are still not willing to spend the money for RDi. Orion will obviously not be as feature-rich as RDi, but it could have its uses in certain situations.

 

DB2 Enhancements

There were numerous enhancements on the database side of IBM i in this release. I am not fully versed in all these enhancements, but here’s one thing that piqued my interest.

 

DB2 temporal support will allow shops to run queries to see what their data looked like at a point in history. So you can get an answer to questions like, “What were our on-hand inventory and open orders for item X at this time last year?” Sure, you could build a program to try to calculate that, but wouldn’t it be easier to just run a simple SQL statement to get the answer?

 

This particular enhancement won’t be useful immediately. You need to set up your table as a temporal table. You should be able to do this using ALTER TABLE, and the table will start tracking history from that point forward. So it could take months or years before the benefits are fully realized. Also, you’ll have increased disk requirements for tables set up this way. There will be the actual table plus a history table with all previous versions of the rows of that table. This could grow very rapidly for frequently changed data, so keep a close eye on disk usage when setting this up for the first time.

 

Editor’s note: IBM’s Scott Forstie will reveal all DB2 for i enhancements in a series of TechTips, starting with this one.

 

That’s All for Now

That does it for my initial overview of the new announcement from a developer’s point of view. There’s of course much more in the release, but I couldn’t possibly cover it all in this article. I hope that my observations are helpful to you in your adoption of IBM i 7.3. This release will likely keep me busy with content for future articles for a few months. If there are enhancements that you think I missed, please put them in the comments. I enjoy discussing content with my readers and will take your input into consideration when planning future articles. It looks like we all have some reading and experimenting to do. Let’s get started!

BLOG COMMENTS POWERED BY DISQUS