Annual Top Ten RPG IV Requirements

Article ID: 58530

Bob Cozzi's 2009 Top Ten List for RPG IV

Every year I put together a Top Ten list for RPG IV; this year the list is a little different. One major change has been in the way I've created the list. Normally I would come up with 15 to 20 nice-to-have features in RPG IV and then survey users of my RPGWorld.com website (allowing them to vote as well as make suggestions of their own), to refine the list. But this year I've decided to use a Benevolent Dictator approach and come up with my own list of great ideas. Oh yes, they are great indeed.

Remember, this list tends to fall into the "what every RPG Programmer needs" category, versus those that tend to represent more of the "What I want for my own specific needs" genre.

So let's get right into it, oh and feel free to post a comment at the bottom of this article if you have any feedback about these ideas. Now here's the list:

Top Ten Needed RPG IV Features

  1. %JOBLOG()--A built-in function that lets us easily write to the joblog. I'm constantly writing the joblog() subprocedure featured in my RPG TnT book in one shop at a time. This subprocedure (and the new built-in function) use the Qp0zLprintf() API. So why not just included it so everyone can write to the joblog without the need to understand C or C++? Oh, and don't forget to support the substitution values that are already built into Qp0zLprintf.
  2. %CONCAT()--A built-in function that does concatenation of mixed data-types easier. %CONCAT(string1 : string2: numValue1 : numValue2 : string3); And while we're at it a %BCONCAT (or %CONCATB) that does the identical task but inserts a single blank in between each value would be appreciated. I like these functions so much I've already written them and they work great (except the mixed-data parameter part which is not possible in RPG IV). I'll feature them in our next RPG Coder newsletter. There has also been some discussion of using symbols to indicate BCAT and TCAT functionality. Two different individuals independently came up with nearly identical suggestions, I was one of them. My suggestion was to use +> for BCAT and +< for TCAT. Today the plus sign is used to CAT and not trimming of blanks is performed unless you preemptively wrap the values in %TRIMR. But the more I think about it, the more I like a data-type neutral %CONCAT function that auto-converts numeric, date, and time values to character behind the scenes.
  3. %GETENV and %PUTENV--A built-in function to read from and write to the Environment. These are necessary for any kind of web development but can also be used to replace those goofy *LDA routines with something a bit easier and more universal in nature. I'd also like to see %GETENVINT (get environment variable as integer) and %GETENVDEC, well you get the idea.
  4. %STDOUT--A built-in function to write data to the standard output device and another for reading from standard-input (stdin). Again, web development is so complex that most people are actually advocating that non-System i computers be used, and hence, non-RPGIV programmers develop them. We'll this is just wrong. Everything we need to do to do web development is already on System i and available to RPG IV, however API accessibility is; at best convoluted on this system. The APIs started out with a good concept but somehow went crazy in recent years. I know very few who actually use APIs, even today, aside from the occasional call to QCMDEXC or QCLSCAN. We need simple interfaces for web development. And I am not a fan of the "make a SPECIAL" device file wrapper for Web Browser I/O". If SPECIAL devices are so great, why is it that in more than 30 years of RPG IV I've seen it used only in 1 shop, and that was a MainFrame shop, using mainframe RPGII in the 1970s. The funny thing is, the people that advocate using the SPECIAL device file are often the same ones that advocate moving to Embedded SQL for File I/O.; Does that make sense?
  5. %REGEX--A set of built-in functions that perform regular expression searches is long overdue. With web development being the number 1 new type of application being written, searching data is very important. Today's %SCAN is so slow and so limited that nearly 75 percent of the time I resort to using C functions, such as memchr and memcmp to perform scans. I also use the regular expression APIs, which are based on standard interfaces from Unix and C rather than those strange i5/OS API parameter standards. So while regex is complex, the REGEX APIs are actually easier to understand than things like QCLSCAN or any native OS API created in the last 10 years.
  6. %TOLOWER and %TOUPPER built-in functions--This is pretty much self explanatory and I can't understand why it isn't in there yet. Oh, and while we're at it, how about %SCANI (scan and ignore upper/lower case)? Yes please!
  7. Native Support for UTF8 (ASCII)--We need a keyword on the D spec that tells the compiler that a field contains ASCII (UTF8) data. If we move something into it, it is automatically converted to ASCII. If we move it to a non-ASCII field, it is automatically converted from ASCII to the target field's CCSID (for example to our job's CCSID). We also need a way to copy data already in ASCII but stored in an EBCDIC field, to an ASCII field without re-translation. The iconv API is well establish on this system and should be used whenever possible to simplify make transparent tasks such as ASCII to EBCDIC conversion.
  8. 3rd-party Add-On Library Support--The ability to control 3rd-party add-ons for RPG IV needs to exist. Today you either give away your code so that everyone can use it, or license it so that only those who pay a fee can use it. What if you want to sell an add-on library that 3rd party software vendors want to use and then distribute the resulting applications to their own customers--without paying a fee to the add-on library publisher? We need the ability to allow people to use a runtime version of a service program but be prohibited from compiling their own programs that link to that service program. This is available already on Windows and has been for decades.
  9. Reclamation; of columns 1 to 7 in free format syntax--I can't believe I have to start free format statements in column 8. Also, if I use the // comments syntax and if I start them in column 5, 6 or 7 or any column before column 8, I get a syntax error. Why? There's nothing on the line before the // and only comments after the //. Also, if I insert the // in columns 7 and 8 the editors accept it but then I get a cryptic compile-time error. Something like, preprocessor directive not valid. What's that? Oh, I simply need to move the // one column to the right and it'll be fine. How very disappointing. Is there a reason for this anomaly? Yes, it is because some fixed-format RPGII programmers might decide to carry-over their rather unique habit of inserting line-change comments in positions 1 to 5. Okay, I get that. But why procrastinate an obscure habit that doesn't help us train new RPG IV programmers, and only confuses them. Nobody should be using this feature. I'm sorry that we don't have a standardized way to track changes in source code on a line-by-line basis. But if you really want to do that, use the // comment syntax and you have more than 5 spaces into which you may enter your line-change commentary. How about this? "//;Bob Cozzi changed this line". Or better yet "//;Bob Cozzi changed the following block of code on 7-OCT-2009". I'd much rather see that than "RC" in columns 1 and 2.
  10. Port RPG IV to Windows 7 and Mac OS X and Linux--But this time, port RPG IV as RPG IV not some hybrid variant between a native Windows compiler and RPG IV. Just port RPG IV with the SQL pre-compiler. No DDS, no CL, no OPNQRYF. This has been tried and failed several times. What we need, what we want is a regular RPG IV compiler that will compile and run as a native Mac OS X, or Linux or Windows 7 application without adding a bunch of opcodes to make it seem like a native Windows compiler. Here's more on this idea:

IBM should port the compile and use their DB2 database as the externally described file support--no DDS, no CL no OPNQRYF, no OVRDBF commands. Then use DB2's SQL to define files, support both File specs as well as Embedded SQL. When a File spec is specified, look for a DB2 table and bring in its definition. Just like they do today with SQL-created tables on System i.

Any other features, such as Display File DDS, Database file DDS, OPNQRYF or OVRDBF could be implemented by third parties if there's a need/market for it. Native display interface would be performed by linking to the User Interface API libraries on those other platforms. Hopefully IBM would provide RPG IV prototypes of native interfaces for RPG IV programmers to use--unlike what they do or rather don't do on System i.

How's That?

That's all for this year's list. Let me know what you think by leaving a comment below, or visit me on RPGWorld.com's forum and post your feedback there.


Follow Bob Cozzi on Twitter at: Twitter.com/bobcozzi

Follow RPG World on Twitter: Twitter.com/rpgworld

iWeekly, Bob's weekly hour-long video show is aired live every Friday at Noon eastern on RPG World. iWeekly is where you'll learn things you didn't know, and some things you probably don't want to know.

Bob Cozzi is the author of Subprocedures and Service Programs. A 3-disc training series available on DVD that gives RPG IV programmers an easy way to learn RPG IV Subprocedures and Service Programs. It is available now atwww.RPGWorld.com/DVD. Bob's website www.RPGWorld.com is also the place to download the source code featured in RPG Coder and his Tuesday Tips video podcast along with additional examples he's created over the decades. Join Bob Cozzi & Friends in the Spring 2010 for "RPG World" The RPG Developers Conference, and Bob's weekly video podcastiWeekly is where you'll learn about everything from RPG IV to SQL, XML, PHP and even a few things you didn't want to know.

"At the keynote in this week's RPG and DB2 Summit, Ian Jarman did a brief open-kimono on upcoming RPG IV features..."

Really? Did you take notes that you can share, or did IBM make you sign some sort of NDA?

This is one thing I'll never get. Why are the upcoming features of RPG so hush, hush? IBM should be shouting upcoming features from the rooftop, getting the community excited, and generating buzz. I don't see many top 10 list like this for other languages, and when you do, usually they are asking for very specific, subjective features that no one agrees on. The fact that there is such a consensus that RPG needs certain things, but we see little action from IBM is telling. The RPG community is waiting for IBM to throw them a bone. I have a suspicion that the internal workings of IBM are making it very difficult for RPG to progress, and I also wonder if there are higher ups at IBM that just want to see RPG die off.

I hope some of these features that are suggested over and over again start to materialize, to restore some hope that IBM is listening and cares about the future of the language.

"It's my understanding from someone that just recently left IBM that there will be no more enhancements to RPG IV so while some of the items above would be nice to have, they just aren't going to happen."

You mean Bob Cancilla - and as several people have pointed out in various forums - at least as far as RPG is concerned he is talking out of his ...

At the keynote in this week's RPG and DB2 Summit, Ian Jarman did a brief open-kimono on upcoming RPG IV features and in particular the planned Open I/O for RPG which will go well beyond what SPECIAL files can do. Given this, I can't see them implementing Bob's suggestions for %StdOut for example - they have far more comprehensive plans. And from what I understand, Open I/O is only one of the features planned for the next release.
You could have all of these features today if you want them, just not in RPG. There are plenty of languages that already support these suggestions. It begs the question why bother at all with RPG? The only way I can see RPG drawing in new crowds would be to "do a Microsoft" and virtually create a new language, like VB's transformation to VB.net. Existing RPG developers are die hards so whilst they may not like it they probably would stick with it in the long run.
Excellent ideas Bob.

We need more built ins to standardize coding techniques. How many man hours have been lost to the task of all the programmers across the globe building there own API prototypes.

What about going FREE though. RPG needs to be entirely free form. No columns top to bottom. I totally agree with your point about starting in col 8. Also, why stop at the comment column at the end. Only free form comments should be used in free form. There should be no need to use /FREE and /END-FREE. Several of your points can be handled by going totally free and changing the source file layout to accommodate the needs as follows:

SRCSEQ 10.0 int
SRCDAT Date Time stamp
SRCUSR 10A
SRCTRK 10A (user project tracking field)
SRCDTA 1024A Varying

The source change date isn't imbedded in the source code, neither should any other change tracking data like changed by user name, or some kind of project code. It would be a simple task for both SEU and RDi to apply a user name to the changed lines just like it does the date. For simple project level tracking, SEU and RDi could also supply an input area for the programmer to supply a project/task code and apply it to the source file upon update. Other project tools (3rd party, home grown) could make use of the "standardized" built in tracking data.

Standardized tooling is part of the economic equation that made this platform such a success. Likewise, the lack of consistent standard programming methods and tools will be its downfall.

As you and I have stated many times, the splintering of the development on this platform is hurting it.

Most of the builtins you have in your list are things we all have to use. How many variations of these tools have been built by programmers across the globe. All different, with varying levels of completeness and scalability. What a waste. Each programmer in all the shops use to generate all of the programs using the same opcodes. In .NET everything you need in the way of system access (like our APIs) is built into the language. It is not necessary to research and write a prototype to use it, and your code is portable to another shop.

This brings me to the next major point. QUSRTOOLS became a defacto standard extension to the OS because it could be built with essentially no limits. What ever was needed could be built and then used in a standard way in all the shops. That and IBM shipped it with everysystem, but that didn't happen until lots of people wanted it. RPG could grow substantially if we had better ways to build and contribute to a central function library. This point is as much about RPG compiler extensions as some single central open source function library. But the latter is a discussion of its own.

If we had the ability to return variables like the way a builtin can, we could extend RPGs abilities greatly. Yes we can return variables, but essentially it is being treated like C on a unix box. Return a an integer or face pain. A builtin can return a variable length character and be used directly inside some other statement. I have tried to build procedures that return such items as this and talked to Barb Morris about it because the results were not pretty.

What if the compiler looked at the prototype for a procedure and saw that it accepted a pointer, while your code just had a character variable (no %addr) and the compiler converted that to pass the address just like it converts fixed and varying length mismatches.

What if the operational descriptor could pass an array of data that fully described a data structure that was the input parameter. This would enable all kinds of routines (like your export to CSV) to take a structure as an input parameter and read each subfield defined and use it to build something from the structure.

Right now many shops are using an adhoc combo of routines acquired from all over the place (inhouse, purchased, free code from mags). Lots of duplication of functionality with varying levels of success. All of the procedures a programmer codes with and is use to, won't work at another shop because it has a different mix of service programs. We have become splintered.

The splintering will resolve itself when a path appears that more people are willing to walk on. Just mull these over a bit. Have a good one, Shane.
It's my understanding from someone that just recently left IBM that there will be no more enhancements to RPG IV so while some of the items above would be nice to have, they just aren't going to happen. As far as item 10 goes, why bother? Nobody is learning RPG IV anymore and those who know it are in decline. It you want to develop code in Windows 7, use .NET. If you are a RPG diehard, then use ASNA/Blue Phoenix AVR.NET. I have written several .NET applications in AVR.NET for customers and definitely favor it over RPG IV.
I like 'em. I would like to add %GETENVIND and %PUTENVIND, which return an indicator rather than a value; this option would support a cleaner IF statement.
Some of these sound good, some of them not so much so. And that's fine, because we don't have to use language features that we don't want to. That sort of supports my point, though: what I'd most like to see in the RPG IV ecosystem would be a system for automatically extending RPG with user-created libraries. Bob, you've written the joblog procedure at how many shops? What if you could just run a command to download and install your service program, put your bnddir and /copy statements in, and use it? Simple, easy as pie for you to do, and you wouldn't have to petition IBM to do it. That way, some bright RPG coder could write and distribute, say a regex library in the same fashion, perhaps quicker than IBM can. And toupper/tolower? Piece of cake.

IBM's part in this would be to create the repository and commands to interact with it, and to publicize this as a new way of getting RPG features. This method (much like what's used in Rails) would allow us the power to enhance our language while greatly lowering the obstacle of finding and installing new features. It doesn't address everything on your list, but it makes it possible for us to address the first six.

ProVIP Sponsors

ProVIP Sponsors