|
Keeping in mind that triggers may be called by any number of applications,
Excel, ODBC, UPDDTA, etc, and not just that one 5250 program brings up
some concerns.
First of all, there is nothing in the trigger parameters which indicate
whether or not the trigger ended successfully. In one of my trigger
programs (a Read trigger) I execute the following:
begsr fail;
// This user may not access this record. Abort the trigger.
CALLP QMHSNDPM('CPF9898':
'QCPFMSG QSYS ':
'Not authorized to record':
300:
'*ESCAPE':
'*':
1:
MsgKey:
errc0100);
endsr;
/end-free
Now it is up to the program which updated the record to handle the
message. Frankly I am just in the process of writing a 5250 program to
update this file and process this trigger.
Thinking in RPG terms (sorry if inappropriate), you might have the
following that can be checked with %error:
***************************************************************************
* File status codes *
***************************************************************************
D NoError C 0
D EndOfFile C 11
D RecordNotFound C 12
D DuplicateKey C 1021
D ReferentialErr C 1022
D TriggerErrBef C 1023
D TriggerErrAft C 1024
...
Then you would have to analyze further the message. And I am looking
forward to doing this.
Now if you accept the 5250 mantra that there is no other way to update
this file except the program called from this menu option, you might do
something tricky like have the trigger program update a data queue or some
such animal with more detail and then the updating program could process
this. However, I would think that once you get the message analyzing done
it would be more universal. After, all you may have to work with someone
else's trigger that doesn't use the data queue technique.
Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.