Problem solve Get help with specific problems with your technologies, process and projects.

Squeezing more information out of DSPPTF

There's more to the OS/400 Display PTF (DSPPTF) command than you may be aware of.

If you're like me, you probably use the OS/400 Display PTF (DSPPTF) command to check the status of your PTFs before or after a PTF installation. When you run the following configuration, DSPPTF presents a screen display of all the PTFs that have been applied against all of your iSeries or AS/400's licensed programs.


DSPPTF can also be used to display PTF information for one individual product. However, with 10 to 20 OS/400 products and features installed on a typical iSeries or AS/400 system, it can be a real headache paging through every product using LICPGM(*ALL) if you're looking for system PTF information in the following situations:

  • When IBM or a midrange computer publication recommends you install a PTF but doesn't tell you which product that PTF is installed under and you want to see if the PTF has already been applied on your system.
  • You want to see if there are unapplied PTFs on your system.
  • You want to see if there are any downloaded PTFs that IBM has automatically retrieved via the Service Director.

For those situations, you want something a little faster that you can use to search for a specific PTF number, PTF status indicators or certain information strings. That can be accomplished by modifying the output of the DSPPTF command so that it downloads the results into a printer file or a database file that's a lot easier to search. To that end, here are two variations on DSPPTF that could make PTF hunting a little easier.

1. Search for PTFs in a printout -- The key to simplifying PTF searching is the OUTPUT parameter that I used in the first DSPPTF example. When set to '*' (its default setting), this parameter directs the output of the command back to the screen. But if I change my DSPPTF statement to use OUTPUT(*PRINT), as shown below, my PTF information is redirected to a printer spool file that I can easily search for a target PTF or a search string.


This configuration creates a spool file where I can type in the PTF number or other information I'm looking for on the Find line of the output display, and press F16 (search) to locate the first occurrence of that information. If the search function finds a target PTF number, I know I've installed the PTF and can easily double-check its installation information (including the product it installed under, which is included in the page header on the page where the PTF is listed). If the search doesn't find the PTF, it isn't installed and I can download it from IBM or check to see why it isn't loaded.

2. More sophisticated PTF searching through database output -- Although scrolling a PTF printout is an easy trick, I can run more sophisticated PTF searches by saving the DSPPTF information to a database file and then using the Run Query (RUNQRY) command to search for a particular PTF or a group of PTFs. In this case, I modify my DSPPTF command syntax to redirect the results to an output file, as shown here:


For both OS/400 V5R1 and V4R5, the new file that's created is modeled on system file QADSPPTF in library QSYS, and the file uses the QSCPTF format for its fields.

Once I have the PTF information file, I can use the RUNQRY command to query the file in the following way:


By specifying Record Selection through the RCDSLT(*YES) parameter, RUNQRY brings up a Select Records screen that allows you to do field testing on any particular PTF information field. You can select records by using EQ, NE, LE, GE, LT, GT, RANGE, and a number of other operators. RUNQRY also displays the QSCPTF field names on the Select Records screen. If you're unsure which field to select, you can use the Display File Field Description (DSPFFD) on the QADSPPTF file to find out what information each PTF output field contains. To select records based on different PTF values, you may want to search on some of these QSCPTF fields:

SCPTFID -- PTF number
SCIPLACT -- IPL action to be taken for this PTF on the next IPL
SCXPFID -- System licensed program the PTF is applied against

Again, view the SCPTF file format in QADSPPTF for a complete list of fields and their contents.

Using RUNQRY takes slightly longer than searching a PTF spool file listing, but it gives you more flexibility in locating PTF information. For example, if you're looking for all PTFs that are going to be applied on the next IPL, RUNQRY could search for PTF records where the SCIPLACT field equals 'Yes'. And if you wanted to, you could also send the results of your results out to another spool printer file or database by changing the Report Output Type(OUTTYPE) parameter on your RUNQRY statement to either *PRINTER or *OUTFILE.

The point is that these are relatively simple tricks that can help you gather information about your PTFs more quickly than you might otherwise be able to get by just displaying your PTFs directly to the screen. However, the advantage that DSPPTF screen display has over searching a spool printer file or outputting PTF information to a database file is that you can also display PTF details, print a PTF cover letter or display a PTF cover letter using the interactive screen. So you have three good DSPPTF options for working with PTF information, depending on what level of information you're looking for, how fast you want to find it and whether you want to display a subset of your loaded PTFs.

About the author: Joe Hertvik is an IT professional and freelance writer who has been working with OS/400 since the days of the System/38 in the mid-1980s. Joe can be reached at


Dig Deeper on PTFs

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.