|
Regards, Rich
D Assert PR D peAssertion 1N const D peMsgTxt 1024A const varying options(*nopass)
D Escape PR D peStackCnt 10I 0 value D peMsgTxt 1024A const varying
D sds sds qualified D procedure 10 D sts_code 5s 0 D sts_code_prv 5s 0 D line_no 8 D routine 8 D parm_count 3s 0 D msgid 7 D 4 D work_area 30 D pgm_lib 10 D msg_dta 80 D excpid 4 D filename 10 D 6 D jobdate 8 D compl_time 6 D compl_levl 4 D srcfile 10 D srclib 10 D srcmbr 10 D 76 D srcid_1 5i 0 D srcid_2 5i 0 D userid 10
/free
//Assert(%parms>0: 'You must pass at least one parm!');
Assert((ptr <> *NULL));*inlr = *on; // (otherwise this wont compile) /end-free
C *pssr begsr
/free
dsply (sds.procedure + ' ' +
sds.routine + ' ' +
sds.line_no);
/end-free
C endsr
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Assert(): Assert that a condition must be true.
*
* peAssertion = condition to assert.
* peMsgTxt = (optional) text of message to send
*
* Program will crash with a CPF9897 if assertion is not true.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P Assert B export
D Assert PI
D peAssertion 1N const
D peMsgTxt 1024A const varying options(*nopass)D peErrTxt s 52A
/free
if not peAssertion;
if %parms>=2;
peErrTxt = peMsgTxt;
dsply peErrTxt;
Escape(2: peMsgTxt);
else;
peErrTxt = 'Assertion Failed.';
dsply peErrTxt;
Escape(2: peErrTxt);
endif;
endif;
/end-free
P E*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Escape(): Send an escape message to a given call-stack entry * * peMsgTxt = human-readable text to send * peStackCnt = call-stack entry to send message to * * This procedure does not return. *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P Escape B export D Escape PI D peStackCnt 10I 0 value D peMsgTxt 1024A const varying
D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 1024A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 8AD dsEC DS D dsECBytesP 1 4I 0 inz(0) D dsECBytesA 5 8I 0 inz(0)
QMHSNDPM('CPF9897': 'QCPFMSG *LIBL': peMsgTxt: %len(peMsgTxt):
'*ESCAPE':'*': peStackCnt: wwMsgKey: dsEC);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.