Skip to content

Instantly share code, notes, and snippets.

@robberendt
robberendt / gist:d7c43c92cd9c95ea855fdfef4cb1b466
Created March 27, 2020 19:09
Just in case you were curious as to what 5250 sessions are getting data sent back and forth and those where the user is asleep...
-- Used to see if a session is inactive
-- Run one capture
create or replace table rob.slot_one as (
select
current time as initial_time,
j.authorization_name,
j.remote_address,
j.job_type,
j.remote_port,
@robberendt
robberendt / gist:9d02465861d3578ed1fbccf7b03c4eec
Created March 18, 2020 17:55
Using IBM i supplied Services go through and purge deleted rows out of members.
-- Cycle through a list of partitions (members) in a table with numerous deleted rows and submit
-- a job to RGZPFM those deleted rows out, if there are no locks on that member.
-- Cautions:
-- One: If you rely upon relative record number (RRN) then you should not use RGZPFM on that table.
-- Not normally a technique often used anymore.
-- Two: If someone tries to access the file while it is being reorganized it will be locked.
-- Three: There are ways to "reorg while active" but it has side effects you need to understand.
-- I did not try reorg while active for this procedure.
-- Getting the list of members from syspartitionstat is pretty efficient.