How can I learn modern RPG using ILE or Free Form? 

 September 2, 2017

By  NickLitten

If there was a quick and easy solution to “how to quickly become a productive RPG IV and ILE programmer” then all of us old AS400, iSeries and IBM I developers would have gobbled up that solution in double quick time.

Upgrading your programming skills from RPG OPM (Original Programming Model) to RPG ILE (Integrated Language Environment) can seem daunting.

But, it really is much easier than it seems.

Modern RPG is just old RPG with some bells and whistles – if you know old style RPG then you already have the building blocks to expand into the shiny modern world of ILE RPG.

How can I learn modern RPG using ILE or Free Form? 1

So, if you are an experienced legacy RPG Programmer but havent kept abreast with the huge changes to RPG over recent years, dont be put off. It’s not as daunting as it seems. You can easily become more familiar with ILE RPG (also confusingly called RPG4, RPG5 or RPG /Free) just by running older RPG source through IBM’s CVTRPGSRC command. Comparing the new source members with the originals lets you easily compare the source code layouts and the general formatting differences. For 99.9% of source members, the resulting source should compile as a program that works the same as the original.

If you have read any of my waffling programming blogs you will know that I am a big fan of IBM Rational Developer for i. This programming tool will automatically upgrade old RPG column based code into free format. Well… kind off….. All that really does is a reformat of the source. In some detail areas, you might need to make minor changes to the converted source. Basically, just fix any errors noted in a compiler listing.

One thing it does not do is replace old op-codes with new ones that you should use in ILE RPG. Essentially every op-code in RPG III still works in RPG400 and most fo them work in new ILE RPG. But you really don’t want to be putting op-codes such as MOVE, ZADD, SETON and maybe others into any new RPG programs – If you are thinking about using unstructured coding techniques with GOTO, CABEQ and TAG’s then slap yourself around the face. Right now. Seriously.

You really should be learning how the new D-specs can enable so many new ways of doing things simply by data definitions. And you don’t ever want to condition any statements with an indicator. In fact, you should assume that you won’t use any numbered indicators in your C-specs at all. (You can if you really want to; things will simply be a lot cleaner and easier if you don’t.)

With some converted source to review, you should scan through the RPG IV Language Reference manual index to see what new op-codes are available. There’s no need to look at any old op-codes. Just look to see new ones to recognize what they are.

The ones you really want to learn are those few that are listed in the Extended-Factor 2 Operation Codestopic. Except for the file I/O op-codes, the few listed in that topic should be the majority of all op-codes you’ll ever use in new RPG IV coding.

The most important will be the new CALLP op-code. That one is essentially what changes everything into ILE. However, you should mostly ignore it until you’re comfortable with RPG IV. If you get RPG IV out of your way, you can then focus on ILE. Trying to learn the new language structure at the same time you’re trying to learn the new run-time environment will just make both of them harder.

One big reason that you won’t need most of the other old op-codes is that the ‘extended factor 2’ op-codes can make a lot of use of the new Built-in Functions. Look at the list of functions, and you’ll see ones like %CHECK(), %LOOKUP() and %SUBST(). You use those in expressions in the extended factor 2, and they can eliminate the need for many (usually all) of the old numbered indicators. They help make the C-specs much shorter and clearer.

After learning to recognize the names of new op-codes and of new functions, learn the structure of theILE RPG Programmer’s Guide. You can read parts that interest you or simply use it as a reference when you get stuck. But it has good information about how to program with ILE RPG.

Along with the Programmer’s Guide, you will want to read the ILE Concepts manual. That will be your reference for ILE itself. Along with it, you can use the ILE Application Development Example manual.

Those are all mostly ‘reference’ manuals. For actually learning how to use ILE RPG, the best ‘book’ might be Who Knew You Could Do That with RPG IV? A Sorcerer’s Guide to System Access and More. That IBM Redbook has been the standard for learning advanced programming with ILE RPG since OS/400 version 3. It’s been updated to keep up with language changes. When you download the book, make sure that you review the options under the title of the download page. The ‘Additional materials’ link lets you download all of the source code that’s developed in the text of the book.

These links will give you a good launchpad to get started.

Modern RPG is a fun, easy to understand programming language. Once you graps it’s basics you will quickly branch out in to other similar modern languages..

It’s sitting there begging to get introduced to you. #upgradeyourmind


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"cff50":{"name":"Main Accent","parent":-1},"a344d":{"name":"Accent Transparent","parent":"cff50"}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"cff50":{"val":"var(--tcb-skin-color-0)"},"a344d":{"val":"rgba(46, 138, 229, 0.85)","hsl_parent_dependency":{"h":210,"l":0.54,"s":0.78}}},"gradients":[]},"original":{"colors":{"cff50":{"val":"rgb(0, 178, 255)","hsl":{"h":198,"s":1,"l":0.5}},"a344d":{"val":"rgba(0, 178, 255, 0.85)","hsl_parent_dependency":{"h":198,"s":1,"l":0.5}}},"gradients":[]}}]}__CONFIG_colors_palette__

Get In Touch

Iā€™m always looking for awesome input, feedback and critique!