Of course what we are most interested in, apart from the arrival on IBM i of Ruby on Rails, are the major changes that this TR brings to RPG. In fact they represent the biggest changes in the language since the V5 introduction of /Free form calculations specs. That said, it is likely that they will also be among the most controversial. No, it's not Object Oriented RPG--we're on record as saying we don't think that will ever happen. "It" is completely free form H, F D and P specs. That's right--with TR7 RPG becomes a completely free format language. Well, unless you still have a desire to use I and O specs, that is.
So why do we think it will be controversial? Well first of all there are always those who think that RPG enhancements are a waste of time because:
a) Fixed format was good enough for my grandfather, it is good enough for me or ...
b) If I want to write in a modern language I'll use Java/C++/PHP/whatever ...
c) Hardly anyone uses the "new" features like BIFs anyway so why add more ...
We expect those. It happens every time.
But this time there's an additional factor at play. The syntax. As you'll see from the short sample below it more closely resembles CL than (say) C or Java. But unlike those languages, that use curly braces to delimit blocks, RPG decided to stick with a declaration (dcl) based syntax, starting and terminating definitions with markers such as dcl-ds and end-ds. There were undoubtedly many reasons for doing this, not the least being that the compiler team did not want to add another syntactic construct to the language. Plus of course had they done so they would almost certainly have had to revisit the use of braces within the calc specs.
Yes, it may mean a bit more typing for some things, and RPGers as a general rule are famous (or is that infamous?) for their disdain for typing! But in return for the arduous task of keying dcl-f in place of F, for example, you don't have to concern yourself about what column to put the F or the E in (or else copy an F spec from the quickest program you can put your hands on É--come on, admit it, you've done it, right?)
For that matter, you can make up some of those keystrokes by the fact that you don't need to specify the F or E at all. The F (Full procedural) is the only option in this syntax and the E (Externally described) is the default.
And think of the number of keystrokes you'll save from doing away with all the iterations of /Free and /End-Free around your subprocedure logic!
Of course, the end result is potentially more readable code. And a less "lame-looking" syntax for the newest crop of RPGers coming along.
Here's a very short example of the new "/Free-less" RPG, which also illustrates the new relaxed rules about the relative positions of file and data structure declarations (F and D specs in the "old" language).
ctl-opt option(*srcstmt) dftactgrp(*No);
firstName char(16) Inz('James');
lastname char(30) Inz('Joyce');
salary packed(7:2) Inz(12500);
// Define printer file and associated DS
dcl-f qprint printer(80);
dcl-ds prtDs len(80) end-ds;
dsply ('Hello to our new employee');
dsply ( %TrimR(firstName) + ' ' + lastName );
// Also write out details to the printer file
prtDs = 'The name of our new employee is ' +
%TrimR(firstName) + ' ' + %TrimR(lastName) +
' his salary is $' + %Char(salary);
write qprint prtds;
*InLR = *On;
We'll be writing more about this new totally free RPG in EXTRA this month. We'll post a link to it in the comments when it's available. Until then, what do you think?