|
Hi, we solved it as follows: We use a wrapper around QMHSNDPM to send an escape message to the previous call stack entry. The message we send is located in a message file. In the caller procedure we use the program status datastructure to catch the message-id and/or the message text. Depending on the message-id, we can direct different actions. The only problem we have, when transfering an Escape Message through several stacks, we either loose the variable message textes or message-ids (by only sending the message text). Caller Procedure: D PGMSDS SDS D SDSMsgId 40 46 D SDSMsgText 91 170 *---------------------------------------------------- /Free Monitor; Monitor; ProcedureCall(); On-Error; Select; When SDSMsgId = 'ERR1111'; //DoSomething When SDSMsgId = 'ERR2222'; //DoSomething Other SndEscMsg(SDSMsgId); //Transfer the message to the previous call-stack EndSl; On-Error; SndEscMsg(SDSMsgId); EndMon; *InLR = *On; Called Procedure: Monitor; If Condition1; SndEscMsg('ERR1111'); EndIf; On-Error; SndEscMsg(SDSMsgId); EndMon; Mit freundlichen Gru?en / Best regards Birgitta "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown) -----Ursprungliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Larry Ducie Gesendet: Montag, 6. Februar 2006 21:18 An: rpg400-l@xxxxxxxxxxxx Betreff: communicating with messages Hi, I read an atricle a while back which put forward the idea of emulating try/catch blocks by using the message APIs. The kind of thing I'm looking at is the possibility of wrapping a call to a procedure in a monitor block and within the called procedure, upon certain conditions, send a message up the stack to force the monitor group to activate a particular on-error condition. Sort of... /free monitor; // process task... processTask(); on-error TASK_HALTED; someCode(); on-error TASK_SUSPENDED; someOtherCode(); on-error; inTrouble(); endmon; /end-free and in processTask... /free if haltTaskConditionMet(); throw('MSG0001'); endif; if suspendTaskConditionMet(); throw('MSG0002'); endif; /end-free Is this possible? Where would I find examples for this kind of thing? Does my question make any sense at all? Cheers Larry Ducie -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.