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.
-
RPG IV Comment Blocks
December 8, 2004 Hey, Ted
… Read moreConditional compilation directives (/IF DEFINED) have two good uses that I have not seen mentioned in any of the midrange-oriented e-mail newsletters. Maybe you would like to tell your readers who work in RPG shops about them.
One good way to use a conditional compilation directive is to comment-out large sections of source code. Here’s an example.
/if defined(TheFollowingIsCommentedOut) C eval *in21 = *on C eval *in22 = *off C* eval *in23 = *on C if *in24 C exsr DoSomething C exsr DoSomethingElse C endif /endif
I prefer this technique to that of commenting out each line individually. For one
-
Let Me Out of Here!
November 10, 2004 Hey, Ted
… Read moreHaving read your article “Subprocedures: Better than Subroutines,” I have been inspired to use subroutines less and subprocedures more in RPG programs. However, I have come up against a problem that I can’t solve.
In many of my programs I include a clean-up subroutine that runs when the program ends, whether the program ends normally or abnormally. The subroutine includes various house-keeping tasks, sets on the LR indicator, and executes a RETURN operation. You probably know what happens when I implement such a routine in a subprocedure. Instead of returning to the calling program, control returns to the calling routine
-
More Conditional Sorting with SQL
November 10, 2004 Hey, Ted
… Read moreYour tip “Conditional Sorting with SQL” is one cool tip! May I add two more examples?
My examples are in RPG, but I assume they will work with any language. In both examples, I use host variables to control the sort.
Host variable SortOption controls the sort in the first example. If host variable SortOption has a value of 1, the data is retrieved in order by customer name. If two customers have the same name, they are retrieved in customer number sequence. If SortOption has any other value, the data is retrieved in customer number sequence.
D SortOption S
-
Qshell Logout Script
November 3, 2004 Hey, Ted
… Read moreI know about the special scripts that run automatically when I begin a Qshell session. Is there a way to make Qshell run a script when I end a session?
–Matt
Qshell does not support an automatic logout script, but you can tell Qshell to run a script when the session ends by trapping the EXIT pseudo signal.
Suppose you want to keep a log of your Qshell sessions. You might create an IFS file to contain the log information. The following command creates a file called qsh session history.
touch 'qsh session history'
Using the text editor of
-
Monitoring for System Request Menu Option 2
October 27, 2004 Hey, Ted
… Read moreAs part of our Sarbanes-Oxley compliance requirements, I have to write a CL program that temporarily changes the user’s user profile. (Adopted authority is not appropriate in this case.) One concern I have is that the program may end without executing the code that undoes the temporary change. I can use a global Monitor Message (MONMSG) command to trap unexpected errors and prevent an abnormal termination, but I also need to prevent the user from canceling the program by taking option 2 of the System Request menu. Is there a way to disable that option?
–Paul
The options that are
-
Prolong the FTP Experience
October 20, 2004 Hey, Ted
… Read moreWhen I log in to our iSeries system through an FTP client, a message informs me that my connection will close if it remains idle for more than five minutes. Sometimes I have several tasks to perform between FTP commands, and the system times me out. Can I increase the time-out setting?
–Doug
The FTP server controls the inactivity time-out. The default setting for this value is 300 seconds, but it can be changed with the Change FTP Attributes (CHGFTPA) command. Since you’re working from the client side, you can change the timeout interval for your session by running the
-
Presenting the CHGATR Command
October 20, 2004 Hey, Ted
… Read moreI had a similar problem to Jim’s in “Wanted: Qshell Output in ASCII.” Qshell was building EBCDIC files, but he wanted them in ASCII. In my case, a “Wintel” machine’s FTP client was putting ASCII files in the Integrated File System, but I preferred EBCDIC files. I found a CL command that solved my problem.
I used the Change Attributes (CHGATR) command. This command, which was introduced in V5R1, can change the CCSID of a file. I used commands like the following to change files from CCSID 819 (the CCSID they were assigned when they were created during an FTP
-
Handling Oversized Numbers Gracefully
October 13, 2004 Hey, Ted
… Read moreThese MCH1210 errors are driving me nuts. We run packaged software and a lot of the database fields are bigger than we need them to be. I often use smaller fields on displays and reports in order to save room. Then one day, for some reason, a field has a bigger value than I expected and an EVAL command blows up with MCH1210 (the target for a numeric operation is too small to hold the result). Is there any way in all this new-fangled RPG stuff to tell the system to print hash marks and keep on trucking?
–Dave
RPG
-
Conditional Sorting with SQL
October 6, 2004 Hey, Ted
… Read moreWe are a small business in Ohio. Most of the people we do business with are also in Ohio. Is there a way we can retrieve a list of clients with the Ohio clients listed first, followed by all others, in order by state?
–William
SQL/400 can handle this task for you. Use a CASE structure in the ORDER BY clause.
select custnbr, custname, ccity, cstate from customer order by case cstate when 'OH' then 0 else 1 end, cstate, ccity
The first sort field is a case expression. For records that have a state value of OH, this
-
Optional Parameters and CL Procedures: Valuable Info from IBM
September 22, 2004 Hey, Ted
… Read moreIn “Optional Parameters and CL procedures,” you said that ILE CL procedures can handle unpassed parameters by monitoring for message MCH3601. While it’s perfectly safe to test for omitted parameters (those for which the caller specified the special value *OMIT) by monitoring for MCH3601, it’s dangerous to depend on MCH3601 for unpassed parameters. RTV-type commands are also safe; they work like *OMIT parameters by passing null pointers.
It is possible for the system to fail to send MCH3601 when a parameter was not passed. This failure occurs when the system still has a pointer to a parameter from a







