Skip to content

Instantly share code, notes, and snippets.

@forstie
Created October 23, 2019 14:18
Show Gist options
  • Save forstie/28cd25a2494b2c1f0d9c7ecb73896dba to your computer and use it in GitHub Desktop.
Save forstie/28cd25a2494b2c1f0d9c7ecb73896dba to your computer and use it in GitHub Desktop.
I was asked to provide a way to find journal receivers and discern whether or not they are attached or detached.
--
-- description: Which journal receivers are currently attached?
--
select attached_journal_receiver_library, attached_journal_receiver_name
from qsys2.journal_info
where journal_library = 'PRODLIB'
order by 1,2;
--
-- description: Which journal receivers are detached?
--
with attached(jl, jrcv) as (
select attached_journal_receiver_library, attached_journal_receiver_name
from qsys2.journal_info
where journal_library = 'PRODLIB'
order by 1,2
)
select objname as detached_jrnrcv, a.*
from table (
qsys2.object_statistics('PRODLIB', '*JRNRCV')
) as a
where objname not in (select jrcv from attached) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment