Ted Holt is the senior technical editor at The Four Hundred and editor of the former Four Hundred Guru newsletter at Guild Companies. Holt is Senior Software Developer with Profound Logic, a maker of application development tools for the IBM i platform, and contributes to the development of new and existing products with a team that includes fellow IBM i luminaries Scott Klement and Brian May. In addition to developing products, Holt supports Profound Logic with customer training and technical documentation.
October 3, 2022 Ted Holt
One of the first things I learned about programming in the RPG II language was that field and variable names had to be six characters or less and they did not have to be pronounceable. I accepted this without question, as I was new to computers and figured that everything that had to do with computers was arcane and other-worldly. It wasn’t until I began work toward my computer science degree and was privileged to learn Pascal that I came to appreciate the value of longer identifier names, and of clarity of source code in general.
You don’t have to …Read more
September 26, 2022 Ted Holt
In a famous Henny Youngman joke, a patient says, “Doctor, it hurts when I do this,” to which the doctor replies, “Then don’t do that.” Corny jokes aside, I have spent decades trying to identify programming practices that hurt when I do them, and having identified them, cease to do them. A case in point is the misuse of the variables that the SQL precompiler defines in my RPG programs, variables such as SQLCODE, SQLSTATE, and SQLER3.
“So what,” I hear you ask, “is the problem with these variables? ” Well, they’re global, and global variables are evil. Global …Read more
September 12, 2022 Ted Holt
If you’re one of the many IBM i programmers who still writes green-screen applications, think about how your programs communicate with the users. How do you tell a user that a value that he’s just entered is invalid, or that he needs to press a command key to proceed? I’ve seen several methods, but a common one — and my favorite — is to communicate through a message subfile.
The nice thing about message subfiles is that I can report two or more messages at one time. I like the computer to find as many errors as possible and let …Read more
June 20, 2022 Ted Holt
Christmas came to my house early this year. May 3, to be exact. Boy! Was Santa Claus good to me! IBM gave me two presents! The first was a CL enhancement that I had desired for years. The second was an improvement that, to my delight, almost obsoletes a utility I wrote years ago. Both have to do with the CL CALL command.
CALL is arguably the most used and most important command in CL, yet for all these years it has remained untouched. I’m glad that IBM has seen fit to devote time and resources to the enhancement of …Read more
December 13, 2021 Ted Holt
When I first learned to program computers (RPG II, COBOL 74), the only kind of variables I knew of were global variables. Any statement within a program was able to use any variable. It was not until I started my computer science degree that I found out about local variables, which are known to only part of a program. Since that time, it has been my practice to use local variables as much as possible and global variables only when necessary.
Ideally an RPG program, service program, module, or subprocedure would have no global variables at all, but I don’t …Read more
December 13, 2021 Ted Holt
This is the last issue of The Four Hundred for which I am serving as technical editor.
I have been editing the technical content of and writing articles for this august publication for 20 years. For most of that time, this has been a side job that I’ve done outside of normal working hours (i.e., nights and weekends). I’m ready for a change. Technical editing and writing are not easy and they take a lot of time, time that I had rather spend doing other things.
In the days ahead I plan to spend:
- Less time sitting and more time
November 8, 2021 Ted Holt
An abstract data type (ADT) is a type of data and a set of operations defined over that type of data. Using ADTs allows a programmer to work with data in terms of functionality rather than physical representation. The ADT is the basis of object-oriented programming. Does that mean that abstract data types don’t apply to procedural languages like RPG? Not at all. Quite the contrary.
Before I show you how you can use abstract data types in RPG-based applications, let me further illustrate abstract data types with another, non-OO object — the user profile. The user profile is a …Read more
November 1, 2021 Ted Holt
The details are murky, it’s been eons ago. Probably the mid-1990’s. I was working on an AS/400 that ran a mixture of System/36 and native applications. I needed to call a program that had been written in the latest version of RPG from both S/36 RPG II and native RPG III (a.k.a. RPG/400) programs. I hope I’m remembering this correctly. It’s been so long.
The problem I ran into was rooted in a numeric parameter. S/36 programs passed numeric parameters in zoned decimal format, whereas native RPG and CL programs used packed decimal. The called program defined the parameter as …Read more
October 25, 2021 Ted Holt
I am pleased today to revisit a topic I wrote about just over seven and a half years ago. I do so for two reasons. First, I’ve made a slight improvement to my routine. Second, I’d like to provide more examples of this routine in action. My previous article suffered from a paucity of examples. I can’t believe I let that happen.
I’m talking about the writeln subprocedure, a handy routine that I use to write unstructured text to a spooled file. I derived the inspiration for this routine from Pascal, a programming language I used heavily when I was …Read more
October 18, 2021 Ted Holt
Constant folding is a compiler-optimization technique, whereby the compiler replaces calculations that involve constants with the result values when possible. Constant folding is common in modern compilers, and according to the RPG reference, the RPG compiler uses this technique. (See the documentation of the %div and %rem functions, for example.)
But you and I don’t write compilers. We write business applications. Why then should we care about constant folding? That’s a question worth pondering.
Consider how I used to have to write RPG in the Dark Ages.
C MOVE CUSTNR CUSTSV 50
Here I’m copying the customer account number to …Read more