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.
-
Have Your Cake and Eat It, Too
April 18, 2012 Hey, Ted
… Read moreI did not take your suggestion to write a subprocedure and embed it in a service program. It seemed like too much trouble to me. I wrote a program instead. It does the trick and it’s a lot less complicated than all those hoops you told me to jump through. I guess ILE isn’t all it’s cracked up to be.
–Chuck
Chuck presented me with a problem. I suggested he write a subprocedure to solve it. He didn’t like the idea of creating a module, writing binder language, creating a service program from the module, adding the service program to
-
Cut the Gordian Knot
April 4, 2012 Hey, Ted
… Read moreI just love those BIFs that IBM added to RPG. I can’t understand why anybody would use old RPG op codes instead of the BIFs. But I’ve run into a brick wall with %SUBST. Help!
–Vince
Allow me to explain Vince’s situation. He was assigned to revise a program someone else had written. The program reads a list of the file names in a certain directory on their network, and has to do other processing depending on file name extension (the part of the name following the last period).
Here’s a program similar to the one that Vince had to
-
*NOMAX Does Not Mean Infinite Capacity
March 21, 2012 Hey, Ted
… Read moreThe practice in our shop has been to set the initial size of physical files to what seems to be a reasonable value. In many cases, we leave the size at the default value of 10,000 records with three increments of 1,000 records each. Sometimes we change one or more of these values, usually the first one. Someone has suggested that we stop the guesswork and create all files with SIZE(*NOMAX). However, someone else is afraid that a program will go into a loop and fill up the disk space with output operations. Who’s right?
–Flora
I agree with the
-
Interpreted CL Members
March 7, 2012 Hey, Ted
… Read moreI am thinking of writing a program that will read a source member of CL commands, interpreting them and running them dynamically one at a time. I can think of several situations in which such a utility would be more suitable than compiled CL programs. Before I re-invent the wheel, I want to know if IBM i already has something like that.
–Tom
Yes, there’s something like that. You can do this sort of thing with input spooling. I’ve only used input spooling on occasion, so I’m not an expert, but I can show you how it works.
Create a
-
I Was Just Wondering. . .
December 14, 2011 Hey, Ted
… Read moreNote: The code accompanying this article is available for download here.
I was wondering if you have come across any techniques using subprocedures to simulate associative arrays in RPG IV. I’ve just started experimenting with the idea. I’d like to create dynamic associative arrays using service programs and user indexes.
–Steve
As a matter of fact, I had thought about implementing associative arrays in RPG, Steve. I’ll share my thoughts on that topic. But first, let me talk about wondering.
I do a lot of wondering. You’ve seen the results of many of my wonderings in previous issues of
-
SQL Finds a Delta
December 7, 2011 Hey, Ted
… Read moreIs there a way using SQL to calculate the amount a numeric column changes from one row to the next?
–Ken
Yes. Here’s how it’s done.
First, you need a table to use for an example.
create table mydata ( Name char(8), Qty dec(3,0)) insert into mydata values ('Bob', 25), ('Bill', 85), ('Sue', 17), ('Bob', 28), ('Bob', 32), ('Bill', 105), ('Sue', 45)To pull this off, the data must be stored in the order in which it is to be retrieved. If necessary, create a temporary table to hold the sorted data.
declare global temporary table SortedData as (select name,
-
VALUES: A Truly Useless DDS Keyword
October 26, 2011 Hey, Ted
… Read moreWe had a recent crisis in our shop. When we dug to the root of the problem, we found that one of our files had an invalid value in one of the fields. I don’t understand why this was the case, because the programmer who wrote the DDS used the VALUES keyword on the field in question. Does the VALUES keyword not prevent invalid data from entering the database?
–Paul
No, Paul. One would think it does, but use of the VALUES keyword only applies to the workstation controller. That is, only the green-screen interface is restricted by the VALUES
-
Asserting the Ostensibly Unassertable
May 25, 2011 Hey, Ted
… Read moreAssertions are great for validating conditions that can be tested with IF, DOW, SELECT, etc., but what about other types of conditions? For instance, can I use an assertion to test that a variable contains valid decimal data?
–A Nice Lady
(I’m sorry. A nice lady asked me this question in person and I forgot her name.)
Yes, it is possible to check for conditions that one cannot test with conditional OPCODES such as IF, but you must use a different method.
When something goes amiss, the system loads a five-digit, zoned-decimal status code with a non-zero value. You can
-
Updating Through a Join with SQL, Take Two
April 27, 2011 Hey, Ted
… Read moreI am studying your tip Updating through a Join with SQL, and something escapes me. I do not understand the redundancy in the first code example. Do all updates that involve joins have to have redundant code?
–Ron
I know it’s confusing, Ron. I can go into more detail for you.
This is the example to which you refer:
update customer as c set region = (select newregion from fixes where oldregion = c.region) where exists (select * from fixes where oldregion = c.region)You’re right that there is some redundancy. Both the SET and WHERE clauses of the
-
SQL Bar Charts
April 13, 2011 Hey, Ted
… Read moreA while back I had a problem that appears to be quite common, but just rare enough that it’s a little challenging when it hits you. Often in our roles as database administrators we need to determine various figures, such as how many key values in a table are used up in case we need to extend the field. Or sometimes we just to provide a statistical representation of data. What I needed was to produce a histogram using SQL.
Let’s say you have an array of sample statistics and you want to break them into groups of an arbitrary
