I need some tips to finalize the implementation of a *BEFORE Trigger program for *INSERT, *UPDATE and *DELETE. The TRIGGER Program transfers the updates made to file MASTER into file SLAVE. The SLAVE file is manually opened when TRIGGER is called the first time the job updates MASTER. The TRIGGER program remains active, RETURN after each call, until TRIGGER is called without parameters. Therefore SLAVE file is opened and locked for...
some operation. TRIGGER is halted (SETON LR) when called without parameters.
My questions are: According to the fact that TRIGGER is implicitly called by every job updating MASTER file, how is it possible to halt TRIGGER program at demand/when required to get back full access to SLAVE file, considering the fact that I'd like to leave the SLAVE file opened between updates to improve performances? What is the normal way to clear/reorganize SLAVE file considering that it may be locked at every moment by a job updating MASTER? I've read that command CHGPFTRG may disable or enable trigger programs when special operation are required (INZPFM, CLRPFM,....). My OS is V4R5. I don't find this command. Is it another way? Is it possible to force every running trigger program for a specific file, anywhere they run in any job, to stop to free the access to triggered file for special operations. In the discussion forum, you will find the actual version of my TRIGGER program.
You may only add or remove a trigger program in V4R5. There is no way that I know of to free every job that has a lock on the slave file through the method you are using. I would change my trigger program to write the trigger events to a Data Queue. A second program would pick up the entries from the data queue and write/update SLAVE. When backup is required, you place an entry on the data queue to tell program 2 to release locks on SLAVE. Program 2 could then wait on a second data queue to restart processing, or terminate entirely. Any updates that occur to MASTER would still be written to the data queue, and when SLAVE is available, program 2 would begin processing the data queue.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.
Dig deeper on RPG iSeries programming
Related Q&A from John Brandt
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.