|
Doc wrote: >Is it possible to "throw" custom messages from a subprocedure? > >That is, I have a program called ShowCust. It has a bit of >code which looks >like this: > >/Free > openBalance = getOpenBalance( myCustNo ); > monitor: > on-error ????; > // handle customer not found > on-error; > // handle other errors > end-mon; >/End-Free > >getOpenBalance() is another procedure that accesses a file via SQL, and >calculates the current open balance. I'd like it if it could throw an >exception message if the customer isn't found, the customer >number is invalid, >etc. You can absolutely do this via the send program message API. The following snippet is from Scott Klement's socket tutorial: D SndPgmMsg PR ExtPgm('QMHSNDPM') D MessageID 7A Const D QualMsgF 20A Const D MsgData 256A Const D MsgDtaLen 10I 0 Const D MsgType 10A Const D CallStkEnt 10A Const D CallStkCnt 10I 0 Const D MessageKey 4A D ErrorCode 32766A options(*varsize) You need to keep track of how deep in the stack the sender is, compared to the receiver. --buck
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.