|
The procedure is part of Stack functions service program that I have. I
would be happy to send entire program if you are interested.
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//* XVCSTK_GetTriggerProgram
//* Get name of program causing trigger to fired.
//* Function send a message to the database program used for the
//* insert or update. When it find it, it knows that the previous
//* program is the program that caused the insert or update.
//* In - Trigger Event.
//* Out - None
//* Returns - Name of program
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dcl-proc XVCSTK_GetTriggerProgram Export;
dcl-pi *N VarChar(10);
InTriggerEvent Char(1) Value;
end-pi;
dcl-s PtrReturnMessage Pointer Inz(%Addr(MessageBuffer));
dcl-ds ReturnMessage LikeDs(TD_ReturnMessage) Based(ptrReturnMessage);
dcl-ds ErrorReturn LikeDs(TD_StdErrorModel) Inz(*LikeDs);
dcl-c INSERT_PROGRAM 'QDBPUT';
dcl-c UPDATE_DELETE_PROGRAM 'QDBUDR';
dcl-s MessageBuffer Char(8192);
dcl-s MessageBackLength Int(10) Inz(%Size(MessageBuffer));
dcl-s ReturnMessageKey Char(4);
dcl-s CallStackEntry Char(10);
dcl-s Msg Char(1024);
If Not (InTriggerEvent = XVCSTK_TRIGGER_EVENT_INSERT Or
InTriggerEvent = XVCSTK_TRIGGER_EVENT_DELETE Or
InTriggerEvent = XVCSTK_TRIGGER_EVENT_UPDATE Or
InTriggerEvent = XVCSTK_TRIGGER_EVENT_READ);
Msg = 'Trigger event is not valid event. Must a XVCSTK_TRIGGER_EVENT
value';
XVERRH_Throw('CPF9898':
CPF_MESSAGE_FILE_NAME:
Msg);
EndIf;
If InTriggerEvent = XVCSTK_TRIGGER_EVENT_INSERT;
CallStackEntry = INSERT_PROGRAM;
Else;
CallStackEntry = UPDATE_DELETE_PROGRAM;
EndIf;
SendProgramMessage('CPF9898':
CPF_MESSAGE_FILE_NAME:
'Test': // Message to send
4: // Length of message
'*INFO': // Type of message
CallStackEntry: // Program name to search for
1: // Stack counter to go back
ReturnMessageKey: // Message key returned
ErrorReturn);
If ErrorReturn.BytesAvailable > 0;
Msg = 'Unknown error in Send Message API. Message Id = ' +
ErrorReturn.MessageId;
XVERRH_Throw('CPF9898':
CPF_MESSAGE_FILE_NAME:
Msg);
EndIf;
ReceiveProgramMessage(MessageBuffer: // Buffer to receive message
into
MessageBackLength: // Length of buffer
'RCVM0200': // Message format
'*': // Use the current pgm queue
0: // Call stack counter
'*INFO': // Program type to receive
ReturnMessageKey: // Message key returned
0: // Wait Time
'*REMOVE': // How to handle message
ErrorReturn);
If ErrorReturn.BytesAvailable > 0;
Msg = 'Unknown error in Send Message API. Message Id = ' +
ErrorReturn.MessageId;
XVERRH_Throw('CPF9898':
CPF_MESSAGE_FILE_NAME:
Msg);
EndIf;
Return %Trim(ReturnMessage.ReceivingProgramName);
end-proc;
On Tue, Oct 5, 2021 at 8:47 AM Mark Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:
Rob,directly.
It's just more "overhead" ... versus just calling any needed APIs
I have similar concerns about using normal "native" I/O from a trigger.like
Mark
On Tuesday, October 5, 2021, 11:45:00 AM EDT, Rob Berendt <
rob@xxxxxxxxx> wrote:
Basically this sql is just a wrapper for the system API's. It's not
it's updating databases, etc.:-/
What is the foundation for your concern?
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Mark Waterbury
Sent: Tuesday, October 5, 2021 11:37 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Get trigger caller program
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.
Al,
I don't think it is a good idea to use embedded SQL in a "trigger" ...
Markhttps://www.ibm.com/docs/en/i/7.4?topic=services-stack-info-table-function
On Tuesday, October 5, 2021, 11:33:31 AM EDT, Art Tostaine, Jr. <
atostaine@xxxxxxxxx> wrote:
Yes I had tried that IIRC. I think what I'm going to try is use this SQL
and eliminate Q* programs. Thanks
On Tue, Oct 5, 2021 at 11:03 AM Rob Berendt <rob@xxxxxxxxx> wrote:
Does this help?
ORD500
Test it with your usual interfaces. For example, I expect program
midrange-l@xxxxxxxxxxxxxxxxxxto update this.Art
Then test it with stuff like iACS Run SQL Scripts doing the update.
Or UPDDTA
Or ...
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Tostaine, Jr.
Sent: Tuesday, October 5, 2021 10:49 AM
To: Midrange Systems Technical Discussion <
know
Subject: Get trigger caller program
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and
trigger?the content is safe.
Does anyone have a program that's getting "who called me" for a
relatedI've tried several versions that are available on line. The one I'mguess
currently using is returning QRNXIO for many of the transactions. I
it's crawling back too far.list
Thanks, Art
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
relatedquestions.list
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
listquestions.--
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxlist
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxlist
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxlist
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
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.