Can somebody send me or point me to a CL Trigger example? Or can you use CL for this?
A trigger is just a program that gets called and has parameters passed. You can theoretically write a trigger in any language that will output a *PGM object, including CL.
However, one of the parameters is made up of lots and lots of fields, some of them are at variable positions. For that reason, this is very difficult to do in CL. It's possible -- I'm sure I could do it -- but it seems like a bad idea simply because the program would be so complicated that it'd be difficult to follow.
If you implement the trigger incorrectly (hard-coding offsets that are intended to be variable) then it wouldn't be nearly as difficult -- but of course, you run the risk of your program working today and failing tomorrow.
In the next release (V5R4?) this may be easier, as I know IBM has proposed that pointers and defined-on variables will be part of the CL language. In that case, triggers will be much easier to implement.
Until then, I really recommend that you stick to writing your triggers in SQL or in an HLL like ILE RPG.
Is there a good reason why you want to do this in CL?
This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact