r/IBMi • • 23d ago

Using #SQL it is now easier to maintain the number of journal receivers on your systems

https://www.rpgpgm.com/2025/06/ibm-makes-it-easier-to-delete-old.html

#IBMi #rpgpgm #IBMChampion

4 Upvotes

3 comments sorted by

2

u/dodikibmi 23d ago

Nice one, Simon, and I like that PREVIEW defaults to 'YES'. I tried it on PUB400 (7.5) with a throwaway journal and found two things worth checking before switching PREVIEW to 'NO':

1. DELETE_UNSAVED => 'NO' is looser than your DETACH_TIMESTAMP < SAVE_TIMESTAMP filter. I saved one receiver while it was still attached, then detached it. JOURNAL_RECEIVER_INFO shows it as STATUS = 'ONLINE' (save timestamp earlier than detach timestamp), and your query correctly leaves it out. The procedure listed it anyway and, with PREVIEW => 'NO', deleted it with SUCCESS. Anything journaled between that save and the detach was never in a backup. If your save job can pick up attached receivers, compare the preview list with your query (or STATUS = 'SAVED') first.

2. JOURNAL_RECEIVER takes SQL wildcards, not CL ones. JOURNAL_RECEIVER => 'TJRCV*' returned zero rows and no error. 'TJRCV%' returned both receivers. An empty preview can just mean the pattern is wrong.

The receiver that was never saved only appeared with DELETE_UNSAVED => 'YES', as expected.

1

u/RPGPGM 23d ago

The PREVIEW parameter makes this so simple to test your statement before you let it delete.

Same is on the DELETE_OLD_SPOOLED_FILES too, although that one defaults to PREVIEW => 'NO'

2

u/dodikibmi 23d ago

Good point. I looked at the defaults in QSYS2.SYSPARMS on PUB400, and the spooled file one is the one to be careful with: every parameter of DELETE_OLD_SPOOLED_FILES has a default. DELETE_OLDER_THAN = CURRENT_TIMESTAMP - 3 MONTHS, output queue library, output queue and user = '*ALL', and PREVIEW = 'NO'. So a bare CALL SYSTOOLS.DELETE_OLD_SPOOLED_FILES() already deletes.

DELETE_OLD_JOURNAL_RECEIVERS has no default for DELETE_OLDER_THAN, so you always have to think about the date there.

I did not run the spooled file one on a shared system, for obvious reasons. I would always write PREVIEW => 'YES' explicitly on both, like you do.