Wednesday, April 29, 2026

Checking if there are updates for your Group PTFs

One of the duties of a good System Administrator is to keep the group PTFs up to date on the IBM i partitions you are responsible for. To assist with this IBM has "Group PTF Currency". The first time I encountered this phrase I was confused as I could not equate how PTFs related to money. The confusion was cleared up when I found out the "currency" refers to how current your PTFs are.

In the past the System Administrator would have manually check IBM's Fix Central website and compare the version of the PTFs on their partitions to the ones shown.

To make life easier IBM created a SQL view, GROUP_PTF_CURRENCY, in IBM i 7.1 that would retrieve the latest information about the group PTFs from the IBM "Preventive Service Planning", PSP, website. This View shows the PTF group level installed and the latest group level available. By comparing the two the System Administrator can decide whether it is time to get and apply the latest PTF group.

We can see the data on the PSP website as is it an XML file and can be reached at:

https://public.dhe.ibm.com/services/us/igsc/PSP/xmldoc.xml

This is the file for the USA. IBM's documentation states that the URL may differ for other countries.

When I click on the link the XML is displayed. I have formatted it below to make it easier to understand. The first few entries in the file look like:

<all_psps>
  <psp>
    <release>R710</release>
    <number>SF99123</number>
    <title>SF99123 - 710 IBM Open Source Solutions for i</title>
    <level>6</level>
    <date>11/06/2017</date>
  </psp>
  <psp>
    <release>R710</release>
    <number>SF99145</number>
    <title>SF99145 - 710 Performance Tools</title>
    <level>13</level>
    <date>10/25/2017</date>
  </psp>

The release R710 is for IBM i 7.1.

The last data is for the most recent releases:

  <psp>
    <release>R760</release>
    <number>SF99968</number>
    <title>SF99968 - 760 Group Security</title>
    <level>13</level>
    <date>03/17/2026</date>
  </psp>
  <psp>
    <release>R760</release>
    <number>SF99969</number>
    <title>SF99969 - 760 Group Hiper</title>
    <level>22</level>
    <date>03/31/2026</date>
  </psp>
</all_psps>

IBM states that the information is usually updated weekly.

Fortunately we do not have to retrieve the data from the XML file and format it. The GET_PTF_CURRENCY does that for us. If you want to see how current your group PTFs are you can use the following:

01  SELECT * FROM SYSTOOLS.GROUP_PTF_CURRENCY

IBM's documentation does say that the job CCSID cannot be 65535 as the query will fail.

                         Additional Message Information

 Message ID . . . . . . :  SQL0332       Severity . . . . . . . :   30
 Message type . . . . . :  Diagnostic
 Date sent  . . . . . . :  DD/DD/DD      Time sent  . . . . . . :  TT:TT:TT

 Message . . . . :   Character conversion between CCSID 65535 and CCSID 1200
   not valid.
 Cause . . . . . :   Character or graphic conversion has been attempted for
   data that is not compatible. There is no conversion defined between CCSID
   65535 and CCSID 1200.
     If one CCSID is 65535, the other CCSID is a graphic CCSID. Conversion is
   not defined between 65535 and a graphic CCSID.

You will need to change the CCSID of your job to be something else, I always use CCSID 37, which is USA English.

The partition I am using for these examples is running IBM i 7.6, therefore, if you copy my examples your results could be different.

The first thing I wanted to know was what is the status of the group PTFs on this partition. The first column in the results, PTF_GROUP_CURRENCY displays the group's status. I can use the following to get a summary of the group PTFs with their status:

01  SELECT PTF_GROUP_CURRENCY,COUNT(*) AS "Count"
02    FROM SYSTOOLS.GROUP_PTF_CURRENCY
03   GROUP BY PTF_GROUP_CURRENCY
04   ORDER BY PTF_GROUP_CURRENCY

Line 1: I only want the status and the count of the number of groups that are that status.

Line 3: The GROUP BY allows me to subtotal the results by the status.

The results were:

PTF_GROUP_CURRENCY           Count  
--------------------------   -----
INSTALLED LEVEL IS CURRENT       8
UPDATE AVAILABLE                 3

If your results contain null then the information for those groups could not be retrieved from IBM. If they are all null it is likely that your partition cannot reach IBM's PSP website.

I am only interested in the groups where there is an update. I want to know those groups and how many releases I am behind. To retrieve that information, I can use the following:

01  SELECT (PTF_GROUP_LEVEL_AVAILABLE - PTF_GROUP_LEVEL_INSTALLED)
02           AS "Diff",
03         PTF_GROUP_TITLE,
04         PTF_GROUP_LEVEL_INSTALLED AS "Inst",
05         PTF_GROUP_LEVEL_AVAILABLE AS "Avail",
06         LAST_UPDATED_BY_IBM "Last updated"
07    FROM SYSTOOLS.GROUP_PTF_CURRENCY
08   WHERE PTF_GROUP_CURRENCY = 'UPDATE AVAILABLE'
09   ORDER BY (PTF_GROUP_LEVEL_AVAILABLE - PTF_GROUP_LEVEL_INSTALLED) DESC

Lines 1 and 2: I can determine how many releases a group is behind from the difference of the available group versus the installed group.

Line 3: The PTF group title includes the group number and its description.

Line 4: The group level installed on this partition.

Line 5: The group level available.

Line 6: The date of the latest update to the latest available group.

Line 8: I only want to include groups that have updates available.

Line 9: I want the results to be returned with the group that is most out of date displayed first.

The results were:

Diff  PTF_GROUP_TITLE                      Inst  Avail  Last updated
----  -----------------------------------  ----  -----  ------------
   4  SF99969 - 760 Group Hiper              18     22  2026-03-31
   3  SF99968 - 760 Group Security           10     13  2026-03-17
   1  SF99962 - 760 IBM HTTP Server for i     7      8  2026-02-20

I could now go to the System Administrator and start a discussion on when these groups could be installed.

For the future I could create a program to list this information and send it to myself and System Administrator so that we know when there are updates for the groups. Below is a RPG program I created that could do this:

01  **free                                                                     
02  ctl-opt main(Main) option(*srcstmt) ;

03  dcl-proc Main ;
04    dcl-s Command varchar(500) ;
05    dcl-s DltIFSfile varchar(150)
06            inz('RMVLNK OBJLNK(''/home/RPGPGM/group_ptf_currency.csv'')')
07            const ;
08    dcl-s ReturnCode int(3) ;

09    exec sql DROP TABLE IF EXISTS QTEMP.OUTFILE ;

10    exec sql CREATE TABLE QTEMP.OUTFILE
11             (DIFFERENCE,TITLE,INSTALLED,AVAILABLE,LAST_UPDATED)
12             AS
13             (SELECT (PTF_GROUP_LEVEL_AVAILABLE - PTF_GROUP_LEVEL_INSTALLED),
14                     CAST(PTF_GROUP_TITLE AS CHAR(50)),
15                     PTF_GROUP_LEVEL_INSTALLED,
16                     PTF_GROUP_LEVEL_AVAILABLE,
17                     LAST_UPDATED_BY_IBM
18                FROM SYSTOOLS.GROUP_PTF_CURRENCY
19               WHERE PTF_GROUP_CURRENCY = 'UPDATE AVAILABLE'
20               ORDER BY (PTF_GROUP_LEVEL_AVAILABLE
21                          - PTF_GROUP_LEVEL_INSTALLED) DESC)
22             WITH DATA ;

23    exec sql CALL QSYS2.QCMDEXC(:DltIFSfile) ;

24    Command = 'CPYTOIMPF FROMFILE(QTEMP/OUTFILE) +
25               TOSTMF(''/home/MyFolder/group_ptf_currency.csv'') +
26               FROMCCSID(37) STMFCCSID(*PCASCII) RCDDLM(*CRLF) +
27               ADDCOLNAM(*SQL)' ;
28    exec sql CALL QSYS2.QCMDEXC(:Command) ;

29    exec sql SET :ReturnCode = SYSTOOLS.SEND_EMAIL
30                                 (TO_EMAIL => 'simon@email.com',
31                                  SUBJECT => 'GROUP_PTF_CURRENCY',
32                                  BODY => 'See attachment',
33                                  ATTACHMENT => '/home/MyFolder/group_ptf_currency.csv') ;

34    exec sql CALL QSYS2.QCMDEXC(:DltIFSfile) ;
35  end-proc ;

Line 2: I am using a Main procedure, so that when my program is created it will not include all the code for the RPG cycle. I am also using the control option to use the source sequence number, rather than the compiler generated sequence number.

Line 3: Start of the Main procedure.

Line 4 – 8: I have defined these variables within the Main procedure, making them local to the procedure, and not global.

Line 7: The CONST on this line makes the variable, defined lines 5 – 7, a constant which cannot be changed.

Line 9: This DROP TABLE will not error if the file does not exist.

Lines 10 – 22: This SQL statement will create an output file, based upon the previous SQL statement I described. The file will be called OUTFILE in QTEMP, and will have the columns named on line 11.

Line 23: I am using the variable I defined as a constant as the statement to delete the file in the IFS.

Line 24 – 27: When using the QCMDEXC SQL procedure I always create the statement in a variable, and then use that. I do this as if the command causes an error I can answer the message with a "D" for a program dump. I can then look in the dump at the variable Command to help determine the cause of the error. I am using the CPYTOIMPF command to copy the file from QTEMP to be a CSV file in my personal IFS folder.

Line 28: Here is the call of the QCMDEXC SQL procedure, this statement performs the copy of the file to the IFS.

Lines 29 – 33: I am using the SQL scalar function https://www.rpgpgm.com/2024/03/send-email-with-sql.htmlSEND_EMAIL to send the file in the IFS as an email attachment. This scalar function returns a return, which I am capturing by using a SQL SET statement into the variable ReturnCode.

Line 34: Having sent the email I want to tidy up by deleting the IFS file.

I would add this to job scheduler to run once a week. That way I can always know if a new version of a group PTF is released.

 

You can learn more about the GROUP_PTF_CURRENCY command from the IBM website here.

 

This article was written for IBM i 7.6, and should work for some earlier releases too.

No comments:

Post a Comment

To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.