The Utilities That Developers Forgot
RPG on the iSeries. Throughout the incarnations of the first RPG based midrange machine to today’s iSeries, RPG for many has been the language of choice. Even now with RPGIV and Free Format RPG, it remains as one of those languages that surpasses all others, in terms of functionality and clarity.
And yet the development tool with which we write our code remains pretty much the same beast that it was 20 years ago. I am talking about IBM’s SEU.
Maybe we have ourselves to blame. Few people actually take the time to explore the wonders of SEU commands, and many actually spend time writing RPGIV programs that mirror the same RPGIII programs that they are used to. And why does this continue? Basically, because it can! Another factor is that the work environment does not always allow for experimentation, which means that personal development can sometimes become stagnant.
Alas, fear not my little code monkey friends…Thunderbird2 (the big green one with all the good bits in its belly) is leaving Tracey Island….
International Rescue arrives in the form of Linoma Software who has packaged together a full suite of utilities into a product called Linoma’s RPG Toolbox. This product is the bigger brother of an application originally called CVTILERPG. This function initially allowed the user to pipe in RPG source code, crank the handle, and the result would be a work of modern art, with new opcodes and fancy upper/lower case combinations. This was a significant enhancement over the IBM supplied command (CVTRPGSRC), but, unlike its counterpart did not stay static.
Today, this RPG modernization feature is now known as the command RPGWIZ, and forms a major part of the Toolbox.
Down through the years, since the IBM supplied CVTRPGSRC command was first launched, the compiler has gone through significant changes. New opcodes, built in functions and even free format, to name but a few. To someone still using RPG400, the possibilities are know but the path to conversion may seem a little daunting.
The Toolbox’s RPGWIZ command gets down to the root of the problem by supplying a simple command that will take in RPG code and magically transform it into shiny new code that has:
- Older opcodes, such as “moves”, “z-adds”, “mults” and “divs” replaced with new “eval” statements
- Program defined fields (and/or *LIKE DEFN) transformed into D Specs
- Lines of code in configurable lower, mixed or upper case
- Subroutines replaced with sub procedures
- Fixed format statements replaced with free format coding (for OS/400 V5R1 and higher)
- Data structures redefined to make use of easier notation and the overlay keyword.
- Left hand indicator groups replaced with IF structures
- Operation codes translated to Built In Functions (BIFs) where applicable
- Comment highlighting
- Free format nesting
In fact, everything that the manuals tell you you should do, to produce modern RPG, is contained within a single conversion routine. RPGWIZ is completely configurable, so you can choose the level of code modernization you desire. For instance, if you’re not yet ready for the free format style of RPG, you can configure RPGWIZ to keep your code in fixed format while taking advantage of much of the new RPG IV syntax available for your OS/400 release.
I had great fun with this product for the simple reason that it works in cleaning up even the most badly formed RPGIV imaginable. Although I do not write any RPG400 anymore, I sometimes fall in the trap of writing RPGIV from the viewpoint of the RPG400 programmer.
Running my code through RPGWIZ shows me the error of my ways and exorcises my bad habits whilst producing stylish, modern code.
The ability to convert old code to new, safely and using all the latest functions, is not to be sniffed at, but Linoma’s RPG ToolBox contains even more features.
A module named SEUPlus gives SEU functionality which boarders on the outer edge of imaginable limits.
As standard, SEU is packaged with various line commands that give the programmer a certain amount of functionality that for editing source with the same degree as a very early word processor. Essentially, SEU allows the coder to copy, insert, delete, move, overlay and even hide, single or multiple lines of code. The programmer can mix this with a few templates and prompts that aid the editing of code. And every RPG programmer will use a mixture of these repeatedly during the working day.
This works well, but IBM’s SEU has not been significantly updated or enhanced for as long as I can remember.
Linoma’s SEUPlus gives the programmer further options and shortcuts by providing over 70 additional line commands. With these at your fingertips, there will be no excuse for not producing stylised, easy to read code.
Some examples of the uses of SEUPLus are:
- Developing and maintaining source code faster and easier
- Inserting Snippets of source code
- Modernizing RPG source with the latest syntax available
- Colouring, highlighting and underlining source
- Converting source to upper or lower case
- Examining variables and copy books
- Saving and retrieving source from Toolbox Memory
- Documenting nested logic
- Nesting free-form logic
- Executing OS/400 commands
So what does this mean and how do we benefit?
This is best described with an example. Let us imagine that you normally colour lines of comments in white so that they will easily stand out. In a particular example, you decide the comments you are adding need to leap out at the reader, and want to colour them in red. No problem, just type CD in the sequence number and press enter. The selected line is coloured RED. To colour a block of code, specify CCD on the starting and ending sequence numbers, and you have a block of RED comments.
But SEUPLus is not just about changing the colour. SEUPlus can be used to do all the pretty stuff, but also removes lots of repetitive functions. For instance, specifying the start and end of a section of code to be “commented out” is achieved in a snap.
But it is the more modern functions that this product provides that gives it the gold star.
Because SEUPlus provides hooks into RPGWIZ, sections of code can be rejuvenated by line. This means that individual sections of code can be converted to free format or sub-procedures as easily as copying a section of code.
It also has the ability to expand or compress a section of code. As an example, when I code a prototyped call in RPGIV, my personal style is to put all the parameters over the least number of lines. A coder friend of mine prefers to spread his code with one parameter per line. Using SEUPLus, I can compress his statements into the fewest lines possible to make it more readable to me, whilst he can expand my lines to make it better for him. Of course, this doesn’t alter actual functionality of the code, but allows us both to toggle easily between our preferred styles.
And we are still scratching the surface.
SEUPlus provides snippets of predefined source code which can quickly be found and used from within SEU. By using these pre-tested and proven source code, the development cycle can be greatly shortened with less coding and testing time. Using Snippets can also help ensure programming standards are being followed.
Over 140 pre-defined snippets are included with the Toolbox, including:
- All RPG IV built-in functions (BIF) available up to V5R1.
- All RPG IV free-format operations.
- The program data structure (SDS) and the file information data structure (INFDS).
- File I/O operations with indicators or with BIFs (%found, %error, %eof, etc.).
- Templates for CL programs, Physical files and Logical files.
- Standard header comments for starting out most source member types.
- Miscellaneous snippets (insert /Free block, comment block, etc.)
You can also easily create your own custom snippets of source code using the Toolbox-supplied Snippets as template examples.
Access to the snippet collection can be achieved in a number of ways, by using defined line commands or by pressing a defined command key. Commonly used snippets can also be retrieved auto-magically by creating your own SEU Line Commands. For instance, using line command I* will include three comment lines into your source code, as this command is predefined within the Toolbox.
When selecting a snippet to include, most of them will intelligently prompt for values to fill into the snippet. For instance, the RPG CHAIN operation Snippet will prompt for the key list name, file name and other related values. Linoma’s Toolbox will then merge those values with the snippet before inserting into your current source member.
Although there are many features to list, one other significant addition is the memory function. Toolbox allows you to submit store source lines into “memory”, which can be reviewed, retrieved and added to other source members. This function works in the same way as a PC style clipboard, and remains persistent throughout your interactive job. This does not require split browsing or searching for members and significantly decreases the amount of time to insert code into other members.
Linoma’s RPG Toolbox is easy to install and just creates a single product library to run. Once installed you have a couple of choices. Access to the SEUPlus functions can be added at an individual level by modifying SEU session defaults or by adding a global exit point to make it available for everyone.
Documentation for Linoma’s Toolbox is first class, and gives highly detailed information about each of the functions involved, and the fold-up and keep Cheat Sheet (quick reference card) is essential to keep handy to remind yourself that you now have a easier way to get things done.
It is easy to fall foul to the 80/20 rule (twenty percent of functions used eighty percent of the time), but just 20% of Linoma’s Toolbox is worth 100% of unaided SEU!
A 30 day of Linoma’s Toolbox is available by visiting http://www.linomasoftware.com/home.html