*=================================================================================== * MIT License * Copyright (c) 2016 TEMBO Technology Labs (Pty) Ltd. * Author: Tommy Atkins - Chief Development Officer * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit * persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies * or substantial portions of the Software. * ================================================================================== * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *=================================================================================== h nomain aut(*use) *=============================================================== * Application Error Handlers - Module 04 * ERR20: Retrieve Message Text RETURN=132 * ERR21: Retrieve Message Help RETURN=3000 *=============================================================== d EC ds d ByteIn 9b 0 inz(0) d ByteOut 9b 0 inz(0) d ErrorId 7 inz(' ') d Resvd1 1 inz(' ') d ErrorDta 20 inz(' ') *=============================================================== d ERR03 pr d MT 1 const options(*nopass) *=============================================================== d ERR20 pr 132 d MI 7 const d MF 10 const options(*omit:*nopass) d MD 2048 const varying d options(*omit:*nopass:*varsize) *=============================================================== d ERR21 pr 3000 d MI 7 const d MF 10 const options(*omit:*nopass) d MD 2048 const varying d options(*omit:*nopass:*varsize) *=============================================================== * Retrieve Message (QMHRTVM) API d QMHRTVM pr ExtPgm( 'QMHRTVM' ) d RV 4096 options(*varsize) d RVL 10i 0 const d Fmt 8 const d MsgId 7 const d MsgFL 20 const d MsgDta 128 const options(*varsize) d MsgDtaL 10i 0 const d RplSubVal 10 const d RtnFmtChr 10 const d Err like(EC) * d* RtvOpt 10 const options(*nopass) d* CvtCcsId 10i 0 const options(*nopass) d* RplCcsId 10i 0 const options(*nopass) *=============================================================== d RVP s * inz(%addr(RV)) d RVL s 10i 0 inz(%size(RV)) d RV ds 4096 d BytesR 10i 0 d BytesA 10i 0 d MsgLR 10i 0 d MsgLA 10i 0 d HelpLR 10i 0 d HelpLA 10i 0 d Msg 132 d HP s * d Help s 3000a based(HP) *=============================================================== d MFL s 20 inz('ERRMSGF *LIBL') d MDL s 10i 0 inz(0) *=============================================================== * ERR20: Retrieve Message Text RETURN=132 <<<<<<<<<<<<<<<<<<<<<< *=============================================================== p ERR20 b export d ERR20 pi 132 d MI 7 const d MF 10 const options(*omit:*nopass) d MD 2048 const varying d options(*omit:*nopass:*varsize) *=========================================== /free //========================================= monitor; //====================================== reset MFL; //====================================== select; when %parms = 1; QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:' ':1:'*YES':'*NO':EC); when %parms = 2; MFL = MF+'*LIBL'; QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:' ':1:'*YES':'*NO':EC); when %parms = 3; //============================= if %addr(MF) <> *NULL; MFL = MF+'*LIBL'; endif; //============================= MDL = %len(MD); QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:MD:MDL:'*YES':'*NO':EC); //============================= endsl; //========================================================== return %subst(Msg:1:MsgLR); //========================================================== on-error; ERR03(); endmon; //============================================================= /end-free p ERR20 e *=============================================================== * ERR21: Retrieve Message Help RETURN=3000 <<<<<<<<<<<<<<<<<<<< *=============================================================== p ERR21 b export d ERR21 pi 3000 d MI 7 const d MF 10 const options(*omit:*nopass) d MD 2048 const varying d options(*omit:*nopass:*varsize) *=========================================== /free //========================================= monitor; //====================================== select; when %parms = 1; QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:' ':1:'*YES':'*NO':EC); when %parms = 2; MFL = MF+'*LIBL'; QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:' ':1:'*YES':'*NO':EC); when %parms = 3; //============================= if %addr(MF) <> *NULL; MFL = MF+'*LIBL'; endif; //============================= MDL = %len(MD); QMHRTVM(RV:RVL:'RTVM0100':MI:MFL:MD:MDL:'*YES':'*NO':EC); //============================= endsl; //====================================== HP = %addr(Msg) + MsgLR; //====================================== return %subst(Help:1:HelpLR); //====================================== on-error; ERR03(); endmon; //========================================= /end-free p ERR21 e *===============================================================