Ted Holt
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.
-
Guru: Flexible Interfaces
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 -
Guru: Quick And Handy RPG Output, Take 2
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 -
Guru: What Is Constant Folding And Why Should I Care About It?
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 -
Guru: Alternate SQL Row-Selection Criteria Revisited Revisited
September 27, 2021 Ted Holt
I am not a “do as I say and not as I do” kind of person. After I wrote the article Guru: Alternate SQL Row-Selection Criteria Revisited, I got serious about using dynamic SQL in my RPG programs instead of enabling and disabling logical expressions in the WHERE clause. I’m reliving the days when OPNQRYF was my best friend, trying to make apostrophes play nice with string concatenation.
Overall, I’m happy with the change. When I have converted the switch-laden version to dynamic SQL, I have seen a noticeable performance improvement in some cases, and at least a slight …
Read more -
Guru: Another Red Flag – Joining On Expressions
August 30, 2021 Ted Holt
One would think that a given datum, for example a sales order number, would be defined identically in the various database tables in which it is found within an organization, but one might be wrong. I have on many occasions faced the challenge of joining two or more tables on unmatched data types.
But it gets worse than that. Sometimes joins involve expressions, which may consist of mathematical operations and/or invocations of functions, both intrinsic and user-written. As with the word DISTINCT in a SELECT, the presence of expression in a join sends up a little red flag that …
Read more -
Guru: Set Beats A Loop
August 23, 2021 Ted Holt
Hey, Ted:
I’m sending you some RPG source code that I put into one of our inquiry programs and would like to have your insight. Instead of using the SETLL, DOW and READE opcodes to loop through a group of selected records, I used the SQL SET statement. This seems to me much easier for someone else to understand and follow. Is this good practice?
— Mike
I was glad to see Mike’s email in my inbox, as always. He and I met in person at the RPG & DB2 Summit a few years ago, and I’ve enjoyed getting to …
Read more -
Guru: Odds and Ends
August 16, 2021 Ted Holt
I really appreciate the comments that readers add to the end of articles or send to me in email. The more you share, the more all of us are better off. I know that you don’t have time to go back through articles we have published to see if anyone has commented, so this week I do that for you. Please keep the feedback coming!
Several people posted responses to Paul Tuohy’s article Getting Meaningful Audit Information from a Journal. You can read them for yourself, but I wanted to thank Emanuele, who mentioned a tool that is similar …
Read more -
Guru: The Deception of Fractional Labeled Durations
August 9, 2021 Ted Holt
Hey, Ted:
We measure certain processes in tenths of an hour. For whatever reason, we cannot make date/time arithmetic work properly when dealing with this data. There must be something that we don’t understand — what we’re doing seems simple and straightforward. Can you help?
— One Confused Reader
What this reader wants to do makes perfect sense. He wants to take a value like 8:00 AM, add a fractional number of hours to it, let’s say 1.1, and come up with 9:06 AM. Let’s try an example.
declare global temporary table StampData ( Stamp timestamp ); insert into session.StampData
… Read more -
Guru: Elapsed Time For Human Beings
August 2, 2021 Ted Holt
Quick! Think of a weird animal! Perhaps you thought of the platypus, a duck-billed mammal that lays eggs. Maybe Dr. Doolittle’s pushmi-pullyu jumped to mind. Maybe you thought of a politician or a musician or your next-door neighbor. I know a weird animal that you probably didn’t think of.
The weird animal I have in mind is called the duration. This animal is found in SQL queries. There are three species: timestamp, date, and time. Today I write about the challenges of interacting with this strange entity. I’ll use the timestamp duration as an example. Interacting with date …
Read more -
Guru: One-Shot Requests and Quoted Column Names
July 19, 2021 Ted Holt
If I had a dollar for every time someone has asked me to query data for them over the years, I could have retired already. (I did not say I would have, but that I could have.) It’s nice when the users can retrieve the information they need to do their jobs without help from IT, but when a request is too complex for them, I’m always glad to help.
I’ve used many tools over the years for one-shot requests for raw data. These days my tool of choice is the Run SQL Scripts tool, which is part of IBM …
Read more