Skip to content

Instantly share code, notes, and snippets.

@forstie
Last active March 9, 2022 01:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save forstie/2b74a28b5598c243315d0bf516d66b90 to your computer and use it in GitHub Desktop.
Save forstie/2b74a28b5598c243315d0bf516d66b90 to your computer and use it in GitHub Desktop.
This example shows how to use the ALLOW_DDL_CHANGES_WHILE_OPEN QAQQINI option within a specific job to avoid the requirement of needing an exlusive lock for the *FILE object, before making a change to a trigger program.
--
-- Create, Replace, Delete, or Disable trigger programs
-- without acquiring an exclusive lock over the file
-- =======
--
-- Resource: ibmsystemsmag.com/blogs/i-can/august-2017/manage-trigger-programs-in-productions
-- Prepare to break the rules
call qsys2.override_qaqqini(1, '', '');
-- Rules broken
call qsys2.override_qaqqini(2,
'ALLOW_DDL_CHANGES_WHILE_OPEN',
'*YES');
CREATE OR REPLACE TRIGGER toystore.new_hire
AFTER INSERT ON toystore.employee
FOR EACH ROW MODE DB2SQL
UPDATE toystore.company_stats
SET Number_of_employees = Number_of_employees + 1;
-- Done breaking the rules
call qsys2.override_qaqqini(3, '', '');
@forstie
Copy link
Author

forstie commented Oct 19, 2019

@dev-indb
Copy link

You welcome
Thank you for all these interesting things !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment