Tuesday, March 17, 2026

Limiting the amount of data SELF retains

While I love the amount of information that the IBM i will retain for us, there are times where it can become overwhelming, or redundant. An example of this is how much SELF, SQL Error Logging Facility, data do I wish to retain.

Prior to the latest Technology Refreshes, IBM i 7.6 TR1 and 7.5 TR7, I was responsible for purging the SELF error log table, QSYS2/SQL_ERRORT. As part of these TRs a new Global variable was introduced.

This Global variable is called QIBM_SELF_BY_DAYS, and is found in the library SYSIBMADM. It contains an integer for the number of days to retain the SELF data for. The default is 365, in my opinion, that is far too long a period of time. If there is an error or significant warning I will have fixed it before that time period has passed.

I can view the number inside QIBM_SELF_BY_DAYS using the following SQL statement:

01  VALUES SYSIBMADM.QIBM_SELF_BY_DAYS

Which will return the following:

00001
------
   365

I could change the value within the Global variable, but that will not help, as the change is only for this job.

To make a permanent change I need to re-create the Global variable with a new default. I want to limit the results to 90 days. Therefore, I need to execute the following SQL statement:

01  CREATE OR REPLACE VARIABLE SYSIBMADM.QIBM_SELF_BY_DAYS 
02        INTEGER DEFAULT 90

I can check that if the change was successful by using the VALUES statment again:

01  VALUES SYSIBMADM.QIBM_SELF_BY_DAYS

Which shows the following:

00001
------
    90

If I want to extend or decrease the time period I can execute the CREATE OR REPLACE VARIABLE statement again with a different integer value.

 

You can learn more about the QIBM_SELF_BY_DAYS Global variable from the IBM website here.

 

This article was written for IBM i 7.6 TR1 and 7.5 TR7.

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.