|
>Have you ever coded one of your solutions, >that was actually usable by a On-Error? I may have misunderstood the question. Here is my example code. RPGLE ERROR01: h option(*srcstmt: *nodebugio) h debug * dbgview(*list) tgtrls(*current) * CRTPGM PGM(ERROR01) MODULE(ERROR01 ERROR02) TGTRLS(*CURRENT) dvalidateNumber pr n d numberInp 15p 5 const d flag s n d errno s 10 c monitor c eval flag = validateNumber(12.34) c on-error 00202 c 'proc abend' dsply c on-error c eval errno = %error c errno dsply c dump c endmon c eval *inlr = *on RPGLE ERROR02: h nomain option(*srcstmt: *nodebugio) h debug * dbgview(*list) tgtrls(*current) dvalidateNumber pr n d numberInp 15p 5 const DescMsg pr D msgText 80 const pvalidateNumber b export dvalidateNumber pi n d numberInp 15p 5 const c callp escMsg('Abend') c return *off p e * send the escape message that will terminate the caller PescMsg b DescMsg pi D inpText 80 const * Send message API parameters D msgID s 7 inz('CPF9898') D msgFil s 20 inz('QCPFMSG *LIBL ') D msgData s like(inpText) D msgDataLen s 10i 0 inz(%size(msgData)) D msgType s 10 inz('*ESCAPE') D msgStackEnt s 10 inz('*') D msgStackCnt s 10i 0 inz(1) D msgKey s 4 D msgErrStruc s like(ErrStruc) * API error structure D errStruc DS inz D errSSize 10i 0 inz(%len(errStruc)) D errSUse 10i 0 D errSmsgID 7 D errSResrv 1 D errSData 80 C eval msgData = inpText C eval msgErrStruc = errStruc C Call(e) 'QMHSNDPM' C Parm msgID C Parm msgFil C Parm msgData C Parm msgDataLen C Parm msgType C Parm msgStackEnt C Parm msgStackCnt C Parm msgKey C Parm msgErrStruc C Eval errStruc = msgErrStruc * last chance trap for proc * swallow errors without worry. I don't care if sndmsg didn't work. c *pssr begsr c return c endsr PescMsg e CRTRPGMOD MODULE(ERROR01) DBGVIEW(*LIST) TGTRLS(*CURRENT) CRTRPGMOD MODULE(ERROR02) DBGVIEW(*LIST) TGTRLS(*CURRENT) CRTPGM PGM(ERROR01) MODULE(ERROR01 ERROR02) TGTRLS(*CURRENT) call error01 The procedure in ERROR02 (validateNumber) threw a message killing itself. That was trapped by on-error in ERROR01 and displays the proc abend message. Did I miss the crucial part of the thread? --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.