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.
-
Determining the Value of Built-in I/O Functions
February 28, 2007 Hey, Ted
What follows is a question that I have paraphrased from the emails of various readers of this august publication, who all seem to be encountering a similar issue: “Is it possible to view the value returned by built-in functions, such as %EOF and %FOUND, when working in the green-screen, full-screen debugger?”
The short answer is “No.” The debugger will not show you the result of any function, built-in or user-defined, unless that function is defined to the debugger. (See Undocumented Debugger Function.) The reason for this behavior is that a function is not a variable. A variable is a
-
Sorting Arrays and Subfiles with a User Index
January 31, 2007 Hey, Ted
I’d like to suggest another method Jennifer can use for sorting arrays. Why not use a user index? I use user indexes so the user may sort subfiles umpteen different ways. Using a user index eliminates the need to be concerned with size (unless you have more than 4 GB of data). Maybe size would not be an issue in Jennifer’s daily run shipping application.
–Drew at BIC Graphic USA
Note: the code from this article is available for download
Drew sent me some illustrative code and a short write-up about the three API’s he uses–Create a User Index
-
Using APIs to Send Impromptu Messages, Take Two
January 17, 2007 Hey, Ted
The code for this story is available for download here.
In your article, Using APIs to Send Impromptu Messages, you show how to use a message subfile to display impromptu error messages from an RPG program. The logic works great if you call the message-handling APIs from the main logic. However, when I move the API calls into subprocedures, your technique breaks down. What do I need to do?
–Chris
The problem is that you are now sending messages from a different call stack entry. (I hesitate to use the terms “higher” and “lower” when talking about call
-
Gotcha Lurking in Datalink File Manager for DB2/400
January 17, 2007 Hey, Ted
I’ve grown quite fond of the convenience of the DB2 SQL support in QShell, and especially the ease with which it can be invoked within a CL program, by simply calling the underlying Datalink File Manager DB2 program, QZDFMDB2. Having said that, I must also admit to getting burned by a “gotcha” lurking in this otherwise handy tool.
Although I’ve never experienced a problem when providing QZDFMDB2 with an SQL statement in the form of a constant, I did walk straight into a real head-scratcher recently when building the parameter string for this program from variable data. I kept getting
-
Stuff I Didn’t Publish This Year
December 13, 2006 Hey, Ted
This is regarding your recent posting titled “Quick Query over a Database File” that was published on August 23, 2006. This is truly a useless utility. There already is a RUNQRY command. Why would you post this as something that someone might be interested in? I use to wait anxiously for the next Four Hundred Guru e-mail and get really good things out of it, but this and some of the other ones posted are really not Guru material in my opinion. Next time maybe you can show them something like this: RUNQRY and press F4.
–Greg
Greg is absolutely
-
Easily Calculating Statistical Functions
December 6, 2006 Hey, Ted
The code associated with this article is available for download.
Would you be interested in publishing a program that calculates statistical values, such as average, standard deviation, maximum value, and minimum value? I have such a program, which I use in to calculate average usage and standard deviation of the usage of the items we handle.
–Victor Pisman
Thanks to faithful reader Victor Pisman for an interesting program. When I think of calculating an average, I think in terms of accumulating an amount and counting before dividing. Victor took a different approach, and I like it.
Victor’s RPG program,
-
Create Database Files from SQL Queries
November 15, 2006 Hey, Ted
While using interactive SQL/400 from a green-screen session, I can direct the output of an SQL command to a database file. Is there a way to direct the output of a dynamically created SQL command to a database file from a batch job?
–Rich
Yes, you have a few options. First, let’s review the steps you use in your interactive session, for the benefit of the readers.
From the interactive session, press F13 to access the Services panel. From there select option 1 (change session attributes), and enter 3 at the SELECT output prompt. Fill in file name, library, and
-
Stream Files and End-of-Line Delimiters, Take Three
November 15, 2006 Hey, Ted
I do a bit of development in Cygwin under Windows and then move it to the iSeries using Qshell. It turns out that Qshell doesn’t like the carriage-return/linefeed combination (CRLF) in shell scripts, so I often need to change CRLF to LF–as you wrote about in two previous articles–in bulk. Here are some methods I use to convert end-of-line delimiters in stream files.
The first method is a simple Perl command.
perl -i.bak -pe 's/rn/n/g' *
This command adds the extension .bak to the end of the files and strips the CRLF, putting in LF instead. By using a wildcard,
-
Finding Large IFS Directories
November 8, 2006 Hey, Ted
The Integrated File System (IFS) continues to grow in importance in our shop. That means it also continues to grow in size. How can we determine which directories are largest when it comes time to clean them up?
–Dan
Use the Start Qshell (STRQSH or QSH) command to open Qshell. Use cd to navigate to any directory, then try this command.
ls -alsF | grep /$ | sort -r
Clear as mud, huh? Let’s look at it in detail. The ls command lists the files in a directory. In this case, the directory to be listed is the current directory.
-
Stuffing Five Digits Into Four, Take 2
October 25, 2006 Hey, Ted
Your recent article, Stuffing Five Digits into Four, is a trip in the way, way back machine for me. I had to do this very thing on System/3 in RPG II! I’m writing to let you know that there is a way to stuff those five digits into four using native I/O.
As you’ve discovered, RPG’s ‘B’ data type limits you to 4 digits; it’s in the manual, but that’s where data types ‘B’ and ‘I’ differ. ‘B’ is intended to preserve x digits, from 0000 to 9999 (including sign) but the newer ‘I’ is intended to emulate the