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.
-
Prompt and Submit CL Commands
May 19, 2010 Ted Holt
I am a blessed man. Among the niceties of life that I enjoy are hot and cold running water, central heat and air conditioning, abundant food, and the CL command prompter. Many people are not so fortunate.
The CL command prompter provides a functional way to pass properly formatted data to a program so the program can do what it was made to do. Developers who work on other systems can only dream of such a facility.
To prompt a command from a CL command line is simple: type the command name and press F4. I doubt this is news
-
Yet Another Super-Easy Way to Copy a Spooled File from One Partition to Another
April 21, 2010 Hey, Ted
I saw the tip Another Super-Easy Way to Copy a Spooled File from One Machine to Another and wanted to add to the discussion.
In our shop, we have one machine with two partitions–one for production, one for testing and development. On the production system, we have a TEST outq. On the test system, we have a PROD outq. Sending spooled files from one machine to the other is a simple matter of using the CHGSPLF command (option 2 from panels that display spool files) to change the outq name. The CL we used to create the output queues is
-
How to Replace Display Files While They Are In Use
March 3, 2010 Hey, Ted
If you recompile a program while someone’s running it, it’s no big deal. The system moves the old object into library QRPLOBJ and the user never knows the difference. However, creating a display file is a different situation. You can’t replace a display while someone has a lock on it. Here’s a way to replace a display file, even while people are using it.
To illustrate, assume a high-level program, MYHLLPGM, that uses display file MYDSPF. Most likely MYHLLPGM would be written in RPG or maybe COBOL. A user takes a menu option that calls MYHLLPGM, and the system locks
-
How To Use the Inhibit Write Keyword?
February 24, 2010 Hey, Ted
I stumbled upon the Inhibit Write (INHWRT) keyword parameter of the Override with Database File (OVRDBF) command recently while I was looking through the help text for something else. How long has the parameter been there? I can think of some ways to put it to work. Can you tell me something about INHWRT and how to go about using it?
–Bill
That parameter has been there forever, Bill, but I don’t think a lot of people know about it. I see it mentioned occasionally in online forums. I don’t consider it a terribly useful feature of i5/OS.
When you
-
CPYTOIMPF Doesn’t Create Column Headers, But You Can
February 17, 2010 Hey, Ted
If I use Copy to Import File to build a CSV file in the IFS from a database file, I get data, but no column headings. Lack of column headings confuses the poor soul that opens the file in Excel. Do you have an easy yet effective way to address this omission?
–Robert
What you need is an easy way to stuff column headings into the stream file before you add the data. Here’s one method:
- Create a one-record table.
- Use a file editor–even DFU will suffice–to key in the quote-delimited, comma-separated headings.
- Use CPYTOIMPF, specifying MBROPT(*REPLACE), to copy the
-
Read a Save File
February 3, 2010 Hey, Ted
I had an unusual experience recently and thought other readers of Four Hundred Guru might also find it of interest. A physical file had no active records and three deleted records. We were trouble-shooting a problem and needed to know what data was in the three deleted records. We have two third-party products that are supposed to retrieve deleted records, but they failed us. Here’s what we did.
First, we saved the file to a save file that we keep on hand.
SAVOBJ OBJ(IBLOCK) LIB($$DATA) DEV(*SAVF) OBJTYPE(*FILE) SAVF(MYLIB/MYSAVF)
Next, we ran Display File Description to find the save file’s record
-
Creating Yes/No Fields in SQL Queries
January 27, 2010 Hey, Ted
I want to retrieve a list of customers using SQL. I know how to select the customers I want. What I don’t know how to do is create some columns that are not stored in the database, but must be built from information in other files. For example, I want a column that tells whether or not the customer has an open (unfulfilled) order. I’d also like a column that tells if he has ever bought a certain line of product. There are no fields in the customer master file that store this information. Can you help?
–Rick
Good question,
-
Can a Function Return More Than One Value?
January 20, 2010 Hey, Ted
Is it possible for an RPG subprocedure to return more than one value? (I assume it isn’t; the RETURN opcode only allows for one argument.) I want to write a function subprocedure that will return a data structure of information taken from various database files. However, the subprocedure will also need to return a status code to indicate whether or not the I/O was successful. Do you have any suggestions?
–Travis
What you want to do is something like this:
eval (MyDataStructure: Status) = GetData (KeyValue)
No, that won’t work. But I can show you two other ways that will.
-
Joining Incompatible Data
January 13, 2010 Hey, Ted
A physical file contains a nine-byte character acknowledgement number field that consists of a single letter followed by eight digits. I would like to change this field to two fields: a one-byte character and an eight-byte numeric field so that I could join the file to other files that have only the eight-digit numeric value. I realize that I could do a conversion to redefine the field, but that would require extensive changes to our applications. Is there an easier method to redefine the field, such as in a logical file?
–David
You probably don’t have to redefine the field,
-
Let’s Start Over With a New Beginning
January 6, 2010 Hey, Ted
I’m writing in response to your article Let’s Start Over from the Beginning. Neither specifying CLOSQLCSR(*ENDMOD) nor running your program in a activation group *NEW (which is not even possible if your procedure is located in a service program and repeatedly called) is a good solution.
In both situations the open data path (ODP) will be deleted after execution and cannot be reused. That means each time you execute your query, the system performs a full open, which is a time-consuming process.
A full open is always necessary the first and second time a query is executed within the