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.
-
Redirecting a List of Qshell Commands
September 20, 2006 Hey, Ted
… Read moreI need a little help with a Qshell script. I retrieve a list of IFS files that have a certain extension (a suffix precede by a period) and pipe the list into another process. Now I have to also include other files that have a completely different extension. I do not want to run the command twice, processing each type of file in turn. How do I redirect the output of more than one command into one output stream?
–Brad
OK, let’s set up the problem for the benefit of the readers. Suppose Brad’s script currently processes files with the
-
Include Comments in Query/400 Queries
September 20, 2006 Hey, Ted
… Read moreOK, I’ll bite. In your article Query/400 Handles Zero Dates (Sort Of), from Four Hundred Guru Volume 6, Number 25, you said, “This is one way to include comments in a query.” Does that mean there are other ways I can include comments in queries?
–Paul
I know of one other way to comment result fields other than the one I used in that example. First, let’s review that method. Here’s the first result field in that article.
Field Expression Column Heading Len Dec SDNOT0 shipdt/(shipdt-0.0000001) 0=Ship date is zero 1 0 1=ship date is not zeroIn this
-
Unusual But Logical SQL Sorting
September 13, 2006 Hey, Ted
… Read moreA physical file that I’ve loaded with data from another system has a department field that I would like to use for sorting. The department field contains a description, rather than a code. I need to sort the data on the description, but not in alphabetical order. That is, I want a certain department to appear first, then a certain department to appear next, and so on. The only way I know to pull this off is to create a little table that lists the departments and the order each one appears in the sort, but I do not like
-
Undocumented Debugger Function
August 30, 2006 Hey, Ted
… Read moreHere’s a tip for those readers who, like me, still have to use the full-screen, green-screen debugger. I accidentally discovered that RPG supports a debugging option that is not documented in either the help text or the RPG programmer’s guide.
If you want to break a program or procedure when a variable has a certain value, you can use a conditional breakpoint. In the following example, the program breaks at statement 12 if variable STATE has the value TX.
break 12 when state = 'TX'
Suppose you want to stop when part of a field contains a certain value? The
-
EDTF and End-of-Line Delimiters, Take Two
August 30, 2006 Hey, Ted
… Read moreIn EDTF and End-of-Line Delimiters, you demonstrated a method for removing carriage-return characters from end-of-line delimiters in stream files. Unfortunately, your method only works in interactive jobs. I need to do the same operation on a file that I need to FTP. Do you have a way to remove these characters in batch?
–Chuck
You have pointed out yet another violation of Holt’s Law of Interactive Programs, which states: “The problem with interactive programs is that you can’t run them in batch.” I have a few methods for you, Chuck. First, here’s one from Shalom Carmel, a really sharp
-
Print PC Documents to iSeries Printers
August 2, 2006 Hey, Ted
… Read moreI have access through the Internet to a client’s iSeries machine, which has a Hewlett-Packard LaserJet printer attached to it. Is it possible for me to print a PC document (for example, a Word processing document or a spreadsheet) to the LaserJet?
–Jim
Here’s how I’ve done just that from my Windows XP machine. First, create an ASCII printer file on the iSeries. Place the name and library of the LaserJet’s output queue in the OUTQ parameter.
CRTPRTF FILE(QGPL/LASERJET) DEVTYPE(*USERASCII) TEXT('Print PC documents to Laserjet') OUTQ(outqlib/outqname)Second, install the proper printer driver on your PC. Create the printer as a
-
EDTF and End-of-Line Delimiters
July 26, 2006 Hey, Ted
… Read moreI have an IFS file whose lines are terminated with a carriage-return and line-feed combination. I need them to have a line-feed character only. Is there a quick way to strip out those carriage-return characters?
–Bob
Here’s an easy way that has worked for me.
First, make a backup copy of the file, in case something goes wrong. Now, use the Edit File (EDTF) command from a CL command line to open the file.
EDTF STMF('somefile.txt')Press F15 to display the EDTF options screen. Key 5 in the Selection blank (the first entry field on the display). Tab to the
-
Don’t Depend on Arrival Sequence
July 19, 2006 Hey, Ted
… Read moreWe have a sequential (i.e., unkeyed) database file that contains several years of shipment transactions. We’ve built a lot of indexes over it, and we slice and dice it daily, all day long, from both programs and queries. We have two problems that surface occasionally.
The first problem is that sometimes we are not always able to see shipments in chronological order. Since we only store a shipment date, but not a time, we depend on the order in which shipments are loaded into the file to tell us which shipment occurred before another. Depending on the order in which
-
Unix Calls from OCL
July 12, 2006 Hey, Ted
… Read moreOur shop runs a System/36 emulation environment on an RS/6000 AIX machine. We want to move this environment to an i5. In our current situation, we issue a ton of Unix calls within our OCL procedures. We have over 5,500 of these calls. We’re trying to wrap our arms around understanding the impact/feasibility of the move to the i5. If we can’t continue the Unix calls “as is,” going to the i5 probably will not happen.
We plan to keep the RS/6000 along with the i5. So, in a nutshell, is there a way to issue the Unix calls from
-
Query/400 Handles Zero Dates (Sort Of)
June 28, 2006 Hey, Ted
… Read moreI have a file that has two dates that are stored in eight-digit numeric fields in YYYYMMDD format. Using Query/400, I wish to find the difference in days between the two dates. However, one of the date fields may contain values of zero. When I view the resulting data from the query on my display, Query/400 fills the difference field with plus signs if a date is zero. But when I direct the query’s output to a disk file, the query ends abnormally. Is there a way to replace the zero date with some other value, such as the current
