I have an interactive program that writes (Inventory Management) transactions to a file. I do not have the source for this program. I need to ensure that field content which is not currently validated by the program can be validated and corrected BEFORE the transaction being INSERTed or UPDATEd is written to the file.
I need to develop a trigger program to catch the BEFORE image, validate field content and send a message back to the interactive program to tell the operator about the invalid fields. If there is a validation FAIL, the transaction must not be written/updated to the file until the field content is valid.
I have tried to use the QMHSNDPM API to achieve this but can't get it to work. The problem is more than likely around using the correct Call Stack information, and to terminate the action that caused the trigger.
If possible, the trigger must only be activated in an Interactive session.
I also need to be able to validate the same data if the file is accessed outside the Transaction Entry program, e.g. by DFU.
The "Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for iSeries" Red Book, in section 11.3 (Trigger feedback to application programs), implies that this can be accomplished, but I am unable to get my program to work.
Does anyone have a sample program that I can use to copy to achieve this?
Unfortunately, I am under huge pressure to get this function working; I'm sure that it can be done and that some clever programmer out there has the precise knowledge to assist me with my issue.