I often need to find out if a particular PTF has been applied to the IBM i I work upon. Most of the time I can use the DSPPTF command to display the PTFs, but there is one instance of IBM i I am not authorized to that command. I think the head IBM i operator is tired of receiving emails from me asking him to check if a certain PTF has been loaded and applied. I needed to find another way I could display a PTF and whether it had been applied on my own.
Fortunately there is a SQL view I can search for this information. According to the IBM documentation this view has been available since IBM i 6.1. The only servers I have access to are running 7.1 and 7.2, so I cannot vouch for whether this will work in 6.1.
The view PTF_INFO in the library contains the following columns/fields:
|Field name||Alternative name|
If I am looking to see if a PTF has been installed I only need to check the following columns:
- PTFID / PTF_IDENTIFIER
- LOADSTAT / PTF_LOEADED_STATUS
I can then use the following SQL statements to check if the PTF I want has been installed on this IBM i:
SELECT PTF_IDENTIFIER,PTF_LOADED_STATUS FROM QSYS2/PTF_INFO WHERE PTF_IDENTIFIER = 'SI48504'
Rather than use the Alternative names I could just use the Field names:
SELECT PTFID,LOADSTAT FROM QSYS2/PTF_INFO WHERE PTFID = 'SI48504'
The output clearly shows that the PTF has been applied and I can use whatever was within it.
PTF_IDENTIFIER LOADSTAT SI48504 PERMANENTLY APPLIED
How does this compare to using the DSPPTF command?
When I type DSPPTF and press F4 to prompt it I am presented with:
Display Program Temporary Fix (DSPPTF) Type choices, press Enter. Product . . . . . . . . . . . . *ALL F4 for list PTF numbers to select . . . . . *ALL Character value, *ALL... Release . . . . . . . . . . . . *ALL *ALL, VxRxMx Cover letter only . . . . . . . *NO *NO, *YES Output . . . . . . . . . . . . . * *, *PRINT, *OUTFILE
I can never remember or do not know what the "Product" code is. I cannot just enter the PTF number and leave the "Product" code as "*ALL". So I have to enter "*ALL" and "*ALL" and then search for the PTF I am interested in.
By using the SQL view PTF_INFO I can just search for the PTF by its number and not need the "Product" code.
You can learn more about these on the IBM website:
This article was written for IBM i 7.2, and it should work with 6.1 and 7.1 too.