Trigger program to validate data and notify interactive program of errors before insert or update action

10 pts.
Tags:
AS400 RPGLE
RPGLE
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.

Software/Hardware used:
RPGLE V5R3

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
     I have tried to use the QMHSNDPM API to achieve this but can't get it to work.   The StoredProcs/Triggers/UDFs Redbook has examples, and at least one example is in the Information Center. Other examples are around the internet. Providing examples doesn't seem useful.   What should be useful is if you showed us your code that calls the QMHSNDPM API, and we see if we can tell what's wrong. Your own code will be the best example you can get.   Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following