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.
-
Qshell Logout Script
November 3, 2004 Hey, Ted
I 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
As 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
When 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
I 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
These 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
We 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
In “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
-
Define Compile-Time Array Data in D-Specs
September 8, 2004 Hey, Ted
For performance reasons there are certain tables that I would prefer to implement as compile-time arrays rather than as physical files. But I don’t want to hard-code the compile-time array definitions in each RPG program that uses them, since that would require manual modification of each program if an array’s definition or data changes. Loading each array from a file at program startup is also an option, but I’d prefer to avoid the unnecessary I/O. I came up with a method to store compile-time array definitions in a copyable source member, but it has one little problem.
Here’s my idea.
-
CRTDUPOBJ and Logical Files
September 8, 2004 Hey, Ted
I want to build some test libraries from my production libraries. I am having trouble duplicating logical files that are stored in one library but point to physical files in another library. I thought Create Duplicate Object (CRTDUPOBJ) would create a logical in one test library but point it to another test library if the library list was set correctly. What is the best method to copy logical files and point them to the correct physical files?
–David
You have to be careful when using CRTDUPOBJ with logical files. Which physical file the new logical file is based on depends
-
Optional Parameters and CL Procedures
August 11, 2004 Hey, Ted
In “Adding New Parameters to RPG Programs,” you stated that CL programs require that the exact number of expected parameters be passed to them. That’s not entirely true.
If you use ILE CL (source type CLLE), you do not have to pass in the same number of parameters as expected. You can use the same technique you described in the RPG example. You would assign the parameter to the work field with CHGVAR, but monitor the assignment for message MCH3601 (“pointer not set for location referenced”). If that message is sent, you assign the default value to the work field.