RPG gets a facelift with IBM i 7.1 TR7 

 October 11, 2013

By  NickLitten

I’m loving the new changes to RPGLE with IBM i 7.1 TR7 (that is Technology Release 7). Not to be confused with the awesome Triumph TR7, the sexy pop-up headlight car from the eighties, but I digress…

  • Removal of many unnecessary specifications like F, or P
  • /free /endfree is gone
  • the long procedure and variable names are gone and replaced by dcl-pr instead

Looking at RPG code in the editor, and it actually looks like a modern language *shock*

RPG upgrade with ibmi 71

IBM, quite predictably, is pushing the use of Rational Developer for i (RDi) as all the new coding functions are not available from SEU, PDM or SDA etc. Green screen is dying, get with the program. RDi (Rational Developer for IBM i) is supposedly solid and has been rewritten from the ground up to be smooth and error free. IMHO – it needs to be to be an explosive success. Can you hear me IBM?

Rational Developer for i V9: RPG & Cobol Tools + Modernization Tools + Java Tools

A one stop software solution for editing, maintaining, creating and upgrading old legacy code to the new RPGLE /Free layouts. It has Rational Team Concert as an addon, which allows a fully integrated software change management solution. Nice!

Sadly, most of us poor old freelancers are stuck with WDSC because until IBM will let us buy 7.1 with RDi for less than the price of a family car…. Mrs Freelance will not let it slide šŸ˜‰

Meanwhile, over at the IBM RPG Cafe:

As part of IBM i 7.1 Technology Refresh 7, a major enhancement to RPG IV is being announced: Free-form control, file-declaration, data-declaration, and procedure statements.

Read the announcement here:

PTF information:

RPG Compiler support: This enhancement will be available for the RPG compiler with 7.1 RPG Compiler PTF SI51094. It is planned for November 15, 2013; however this is subject to change.

You will be able to use this compiler PTF even if you don’t have TR7. Programs compiled with this PTF will be able to be run on a 7.1 system that does not have either this PTF or TR7.

SQL Precompiler support: DB2 PTF Group SF99701 level 26 is the delivery vehicle for TR7 timed DB2 for i enhancements.

Look here to discover detail about those enhancements: DB2 for i TR7 timed enhancements
Look here for schedule information: DB2 for IBM i 2013 Group PTF Schedule


Here’s a little example that illustrates each of the new free-form statement types.

ctl-opt dftactgrp(*no);

dcl-pi *n;
caller_name char(10) const;

dcl-c RECORD_LEN 80;

dcl-f qprint printer(RECORD_LEN);

dcl-ds prtDs len(RECORD_LEN) qualified;
*n char(6) inz(‘Hello’);
name char(50);

prtDs.name = transform(caller_name);
write qprint prtDs;

*inlr = ‘1’;

dcl-proc transform;
dcl-pi *n varchar(50);
name varchar(10) const options(*trim);

return ‘*** ‘ + name + ‘ ***’;

A few things to notice about the example:

Each statement (except for parameter and subfield declarations) starts with an opcode, either CTL-OPT for control statements, or DCL-x for declarations, and ends with a semicolon. Subfield and parameter declarations also start with an opcode, DCL-SUBF or DCL-PARM, but just like the EVAL and CALLP opcodes, you can omit the opcode for subfields and parameters.
The parameter for the “transform” procedure is defined as VARCHAR(10). The VARYING keyword isn’t used in free-form. When you look at the full list of data-type keywords, you’ll notice that several of them combine the fixed-form data-type value of A, C, D, O, T etc with a fixed-form keyword like VARYING, DATFMT, CLASS, TIMFMT etc.
A named constant is used for the record length of the printer file and the length of the data structure.
There’s no /FREE at the beginning of the code. /FREE and /END-FREE are no longer needed. The compiler will just ignore them.
The procedure interface (PI) is coded before the file declaration in the main procedure. You can mix F and D specs even in fixed form.

Unfortunately, while RPG is a lot freer, it still isn’t completely free. There are still some restrictions:

Free-form code still has to be coded between columns 8 – 80
I and O specs are still only fixed-form.
There is no target-release support – it is only for TGTRLS(*CURRENT) on 7.1.

Full documentation on the new free-form support

It’s not possible to explain all the details here. You can read all about the new syntax in an extra PDF,http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/books/sc092508a.pdf, that has been added to the 7.1 Info Center. I recommend that you start with the “What’s New Since 7.1” section. From there you can navigate to the detailed information about all the new features.

Some frequently asked questions:

Q: Can I still code fixed form code mixed with the free-form code?
A: Yes, but now you don’t need /FREE and /END-FREE if you want to do that.

Q: Will the RPG PTF be part of a PTF group?
A: No, it will be a separate PTF.

Q: What about the SQL precompiler?
A: TheSQL precompiler will have full support for the new free-form syntax. DB2 for i TR7 timed enhancements

Q: Do I just need to get TR7 to get this support?
A: No, you need to get an RPG compiler PTF and the DB2 Group PTF. See “PTF Information” above.


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!