View Full Version : AG and Triggers
01-01-1995, 02:00 AM
We are wanting to add triggers over a few files that will write/update records to other files. The question is this, if the trigger program has 5 other files in it, what library will the trigger program find them in if those files are in multiple libraries? Is this determined by the AG of the program that caused the event on the PF? We will from time to time want to test on the same box with those triggers and we would only want them to update in test files.
06-13-2000, 03:28 PM
Wes, This is a fairly complex subject. The files will be opened based on the library list at the time of the open unless you have applied an overide. The activation group will determine whether the open is shared. If you specify *caller for your activation group on the trigger program and set the activation group when you enter your test or production environment, you will cover most cases but it probably won't be good enough. The real problems come out when you use an interface like SQL, FTP, or a utility like DBU. These will cause a *CALLER trigger to open in the default activation group and could cause test and production file opens to become mixed. For that reason, if you can get away with it, use a single named activation group for your trigger and do a rclactgrp(namedgroup) when you switch between test and production environments. That is how I set our system up to run here and it worked great until we decided to support multiple library file opens seperated by activation group. This was to facilitate moving data between the test and production environments. It took quite a bit of work and cause some unexpected problems, especially with the SQL, FTP, etc. interfaces. It is back to working with no problems but I spent as much time getting that part to work as implementing the system in the first place. David Morris
06-14-2000, 05:02 AM
Thanks, I'll give it a try and keep in mind your advice.
06-14-2000, 08:46 AM
..... use a single named activation group for your trigger and do a rclactgrp(namedgroup) when you switch between test and production environments. Sorry for the stupid questions but do I need to create 2 trigger pgms if I use the single named activation group? For example would I create the trigger for production and set the AG to a specific name then dup the trigger to the development library and change the program to use a different AG? Thanks for the help
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.