PowerWire.eu

Independent IBM i, AIX and Linux news and tech tips for Europe and beyond

  • Home
  • News
  • Technical Articles
    • IBM i
    • AIX
    • Linux
    • VIOS
  • Subscribe
  • About Us
  • Contact Us
  • Advertise with PowerWire.eu

Should we strive to improve our code?

February 16, 2021 by Terry Bartlett 1 Comment


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)”.

Comparison

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

Related Posts

  • IBM i Exit Points – The Power To Control and AuditIBM i Exit Points – The Power To Control and Audit
  • 7.2 things I love about IBM i 7.2 (part 1)7.2 things I love about IBM i 7.2 (part 1)
  • Masterclass: VIO Server networking tips and techniquesMasterclass: VIO Server networking tips and techniques
  • Tim Rowe, from IBM i Development Lab, Rochester USA,  chats to PowerWire.euTim Rowe, from IBM i Development Lab, Rochester USA, chats to PowerWire.eu
  • SQLite – What is that?SQLite – What is that?
  • Convert Spool File To PDF or Text FileConvert Spool File To PDF or Text File

Filed Under: IBM i, Technical Articles Tagged With: IBM i, IBM Power System

Comments

  1. Steve Bradshaw says

    February 16, 2021 at 4:57 pm

    Great first article Tez, please write more.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Free monthly newsletter signup

News

IBM Power Systems Enhances Hybrid Cloud Capabilities with Red Hat

New pre-configured private cloud platform, innovative cloud-consumption payment model, and more Red Hat … [Read More...]

Remain Software Milestone

NIEUWEGEIN, Netherlands — Remain Software released today the second Milestone of TD/OMS V13, Gravity V6, … [Read More...]

Version 4 of the well-known “Flash for i” product: to enhance the usage of External Storage with IBM i

Available for 5 years, installed in more than 200 LPARs in 12 countries, you certainly already know the ‘Flash … [Read More...]

More articles from this section

Quick Links

  • Advertise
  • Subscribe

Follow Us…

  • Email
  • LinkedIn
  • Twitter

Search This Website

Copyright © 2021 · Cue Communications · All Rights Reserved · RED NOISE MEDIA

Copyright © 2021 · Magazine Pro Theme on Genesis Framework · WordPress · Log in

This site uses cookies More info