Last week, I was looking for “CPF2234 Invalid Password” messages, for a program I am writing. I assumed that I would find them in QSYSOPR, but there weren’t any.
So, I tried DSPLOG and there they were. “Oh no”, I hear you say, “Why are you using 5250 Green Screen?”. I will admit that I do, but less and less these days. I use SQL Services, now called “IBM i Services (SQL)”, and ACS “Run SQL Scripts” whenever I can. There is a good article by Andy Youens DB2 for i – Services.
Using QHST or sys2.history_log_info
As most people know there is a wonderful “Examples” section, in the “Edit” menu of ACS. I use that frequently as well. I entered “history” to search for relevant examples. I found one called “Message Handling – Abnormal IPL Predictor” and changed it to find CPF2234.
This seemed to take a long time, well 7 seconds seemed a long time seeing as the partition was IPLed 9 days before. The ACS messages tab showed that it took over 3 seconds to run.
I also like to create my programs to have the minimum performance impact that I can. I know nowadays that probably doesn’t matter as much as it used to, but I still believe it is like the dripping tap, each drop adds to a bucket full, over time.
Using QAUDJRN or qsys2.display_journal
As it happens there is a reference to the DISPLAY_JOURNAL table function in the HISTORY_LOG_INFO table function page. As you can guess, I decided to have a look. I changed the SQL example “Communications – Network Statistics Job Info (NETSTAT)”.
Believe it or not this took 300 milliseconds to run. In order to prove this with some numbers, I ran the above statements with count(*) in the place of * and removed the WHERE clause / journal_entry_types => ‘PW’, to get the number of records SQL was looking through. Then I ran the original statements 6 times in a row. Here are the results.
Records Min Time secs Max Time secs
QHST 35,243 3.208 3.408
QAUD 148,571 0.291 0.391
In case you are wondering whether the extra WITH clause adds to the execution time, I tried with and without and it seems to be about 100 Milliseconds fast with the extra clause, which surprised me.
I also changed the QHST statement to go back before the IPL. It took over 10,000 Milliseconds to find 11 results, out of over 113,000 records.
My conclusions are:
- Sometimes it is worth looking at alternatives, use ACS and SQL.
As a little extra tinkering can make things a whole lot faster.
- If you’re not using the Audit Journal then you should be.
As it’s a valuable source of additional information.
i-UG goes Hybrid
We are returning to the Mount Hotel in Wolverhampton for another Hybrid event on the 18th March, we hope to see you there.
For more details check out www.i-ug.co.uk
Steve Bradshaw says
Great first article Tez, please write more.
Sam Dix says
Good Article Terry, thanks for sharing