One of the IBM i operators and I were talking about the contents on one of the little use Power server partitions and the following question came up: When was the last time an IPL was performed on this partition?
I know I could find that information in Service Tools. But how would I do so if I am not authorized to use the Service Tools menu?
Fortunately SQL comes to my rescue.
When an IPL starts a job with the following job number is always the first to start: 000000/QSYS/SCPF
I can use the JOBLOG_INFO to get the first entry from the job log for that job:
01 SELECT MESSAGE_TIMESTAMP 02 FROM TABLE(QSYS2.JOBLOG_INFO('000000/QSYS/SCPF')) 03 LIMIT 1 |
Line 1: This is the only column I need in my results.
Line 2: I pass the table function the job name of the first job on the system.
Line 3: I only want the first row from the results as that will be first message executed on the IPL-ing system.
My results are:
MESSAGE_TIMESTAMP -------------------------- 2021-12-16 12:20:48.734963 |
What if I wanted to know what kind of IPL was being performed?
There are four kinds of IPLs that I can track:
- Attended IPL
- Attended IPL after abnormal system ending
- Unattended IPL
- Unattended IPL in progress after abnormal system end
Fortunately there are message ids for those types of IPLs, and I can find them using the MESSAGE_FILE_DATA SQL view.
I first searched for any message that contained "IPL" in the message text column, and from those results I found the four message ids I need:
01 SELECT MESSAGE_ID,MESSAGE_TEXT 02 FROM QSYS2.MESSAGE_FILE_DATA 03 WHERE MESSAGE_FILE_LIBRARY = 'QSYS' 04 AND MESSAGE_FILE = 'QCPFMSG' 05 AND MESSAGE_ID IN ('CPF0903','CPF0905','CPF0997','CPF0998') |
Line 1: These are the only two columns I need in my results.
Lines 3 and 4: The messages I am after are in IBM's message file QCPFMSG, which is found in the library QSYS.
Line 5: These are the messages I identified earlier.
My results are:
MESSAGE_ID MESSAGE_TEXT ---------- ----------------------------------------------------- CPF0903 Unattended IPL in progress. CPF0905 Attended IPL in progress. CPF0997 Attended IPL after abnormal system ending. CPF0998 Unattended IPL in progress after abnormal system end. |
IBM does have a set of instructions on how to find this information on your partition, the link is at the bottom of this post. I have taken their instructions, and "modernizing" it to use SQL to find the data we want rather than have to scroll through pages of the system history log.
First step is to call the program QWCCRTEC:
CALL QSYS/QWCCRTEC |
In my experience you will need call this with a profile that has at least *SECADM authority.
The program generates a spool file, QPSRVDMP. I open the spool file and scan for the string "PWRDWN", like the last line shown below.
5770SS1 V7R4M0 190621 DUMP OBJECT TYPE- SPACE *QTSP NAME- QWCSRCDATAOUTPUT TYPE- 19 SUBTYPE- EF CREATION- 01/05/22 07:50:05 SIZE- 0000006000 ATTRIBUTES- 0000 ADDRESS- F8F6B58255 000000 SPACE ATTRIBUTES- 000000 00FFF000 00000074 D6E4E3D7 E4E34040 40404040 * 0 È ÕQWCSRCDATAOUTPUT * 000020 40404040 40404040 00100000 00000000 00000000 * & * 000040 00000000 00000000 00000000 00000000 00000000 * * 000060 00000000 00000000 * 0 * SPACE- 000000 E7D7C640 D7E6D9C4 61F2F140 F1F27AF1 F87AF1F9 *XPF PWRDWN 12/16/21 12:18:19* |
I record the date, 12/16/21, and the time, 12:18:19, as I will need this in the next step. This is not the time and date the IPL started, but the time and date of the power down before the IPL started.
Rather than scrolling through the history log I am going to use one of my favorite SQL table functions HISTORY_LOG_INFO. This table function allows me to search the history log for a range of timestamps.
01 SELECT MESSAGE_TIMESTAMP,MESSAGE_ID,FROM_JOB,MESSAGE_TEXT 02 FROM TABLE(QSYS2.HISTORY_LOG_INFO('2021-12-16-12.17.00.000000', 03 '2021-12-16-12.30.00.000000')) 04 WHERE MESSAGE_ID IN ('CPF0903','CPF0905','CPF0997','CPF0998') |
Line 1: I am only interested in these columns for my results.
Lines 2 and 3: I need to pass HISTORY_LOG_INFO a start and end time stamp for the results. In this case my start time is a second before the time I recorded from the spool file. The end time is just 10 minutes after the time. This range will ensure I capture the information I want.
Line 4: The list of message ids for the types of IPL.
MESSAGE_TIMESTAMP MESSAGE_ID FROM_JOB MESSAGE_TEXT -------------------------- ---------- ---------------- --------------------------- 2021-12-16 12:20:48.734963 CPF0903 000000/QSYS/SCPF Unattended IPL in progress. |
The results show the same timestamp as I received when I use the JOBLOG_INFO table function. But here I know that this IPL was an unattended one.
You can learn more about this from the IBM website:
This article was written for IBM i 7.4, and should work for some earlier releases too.
This is very handy. I always do a WRKACTJOB SBS(QCTL) then option 5 on the subsystem and then option 1 to see when the QCTL subsystem job started. The SQL statement is much easier.
ReplyDelete