×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hello,
(1) You must ensure that the triggered program has all objects it requires in
the library list.
If at all possible, eliminate the need for other objects. (Aside from
those that are part of the OS and therefore in the system portion of the
library list.)
Personally, the triggers I've written don't use any other objects -- but I
guess it depends on what the trigger does.
The next question that comes to mind is, "what objects are you having
problems with?" Does your trigger need to call other programs? Make
printouts? Reference other databases? Data queues?
Perhaps the best solution is to stop using the library list to locate the
objects that your trigger depends on. If it needs a file, have it specify
the library. If it calls a program, have it specify the library... I
wouldn't recommend hard-coding the library, but you could create a
configuration file or data area that the program could load the libraries
from. Then, if you wanted to run on another library for some reason, you
could easily change it.
(2) What happens if someone use UPDDTA without file ABC being in the library
list, i.e. UPDDTA MYLIB/ABC.
As far as I can tell, this is the same question as (1).
(1) Placing the trigger program in the same library as the file it is
triggered from.
I don't see how that helps you. Sure, if you assume the database is always
accessed by library list, you'll be okay... but that's not always the
case.
(2) Using a generic trigger program that sets the correct library list using
either a job description or library list held in a common file linked to the
library/file/member/trigger type/trigger time.
Nononono! Don't change the library list in a trigger... that would be
really confusing for the user who sets her library list for a reason, and
it's suddenly, magically, reverted back to the default one.
Just code your RPG program so that it doesn't use the library list to
locate things! For example, on a program call, do this:
C eval Program = 'MYLIB/MYPGM'
C CALL Program
C PARM FOO
Or, with a prototype:
D Program s 21A
D MYPGM PR EXTPGM('MYLIB/MYPGM')
D Parm1 10A
/free
Program = 'MYLIB/MYPGM';
callp MYPGM('FOO');
/end-free
Or, with a file:
FMYFILE UF E K DISK EXTFILE(LibFile)
F USROPN
D LibFile s 21A
C eval LibFile = 'MYLIB/MYFILE'
C open MYFILE
(Except, of course, load the library names from a configuration file or
data area or something...)
That way, you don't have to change the library list (which affects other
things) your changes only affect the trigger. You'll probably want to put
the code that does this in your *INZSR so that you only have to do it
once when the trigger first loads... doing it on each call could be
expensive.
HTH
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.