Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The IBM i has some built-in facilities to allow you to understand that an 'out of storage' condition exists. Here are some example SQL techniques for managing this alert mechanism.
-- Check the configuration of:
-- Maximum system disk pool usage (QSTGLOWACN and QSTGLOWLMT) system values
select current_character_value from qsys2.system_value_info
where system_value_name = 'QSTGLOWACN';
-- Review the ASP consumption vs limit
with sysval(raw_QSTGLOWLMT, low_limit) as (
select current_numeric_value,
current_numeric_value/10000.0 as QSTGLOWLMT
from qsys2.system_value_info
where system_value_name = 'QSTGLOWLMT'
DEC((100.00 - low_limit),4,2) as SYSTEM_ASP_LIMIT,
from sysval, qsys2.SYSTEM_STATUS_INFO ;
-- Review recent history when the storage utilization rose too high
select message_id, message_timestamp,
interpret((substr(message_tokens, 63, 8)) as decimal(15, 6)) as threshold_percent,
100.0 - interpret((substr(message_tokens, 71, 8)) as decimal(15, 6)) as consumed_percent,
interpret((substr(message_tokens, 71, 8)) as decimal(15, 6)) as available_percent,
bigint(substr(message_tokens, 1, 31)),
'999G999G999G999G999G999G999G999G999G999G999') as storage_capacity,
bigint(substr(message_tokens, 32, 31)),
'999G999G999G999G999G999G999G999G999G999G999') as storage_used,
substr(message_second_level_text, 184, 105) as cpf0907_first_level_text,
substr(message_second_level_text, 290, 89) as cpf0907_second_level_text
from table (
start_time => current date - 1 day) -- <=== today and yesterday
where message_id = 'CPF0907'
order by message_timestamp desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.