*=================================================================================== * 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 05 * ERR50: Convert SQLCODE to Error Message *=============================================================== 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(' ') * ERR50: Convert SQLSTATE to Error Message ===================== d ERR50 pr n d CAPtr * const * ERR11: Send *ESCAPE Message ================================== d ERR11 pr d MI 7 const d MF 10 const options(*omit:*nopass) d MD 128 const options(*omit:*nopass) d MT 1 const options(*nopass) *=============================================================== d CAPtr s * d SQLCA ds based(CAPtr) d SQLAID 8 d SQLABC 10i 0 d SQLCODE 10i 0 d SQLMSGL 5i 0 d SQLMSGD 70 d SQLERRP 8 d SQLERRD 10i 0 dim(6) d SQLWARN 1 dim(11) d SQLSTATE 5 *=============================================================== * ERR50: Convert SQLCODE to Error Message <<<<<<<<<<<<<<<<<<<<<< *=============================================================== p ERR50 b export d ERR50 pi n d P * const *===================================================== d SQLMSG ds 7 d C3 3 3 *===================================================== /free monitor; //================================================ CAPtr = P; //================================================ select; when SQLCODE = 0; return *off; // Record Found OK when SQLCODE = 100; return *on; // End of File Indication when SQLCODE > 0; return *off; // Non-Terminal Warning/Information endsl; //================================================ SQLMSG = 'SQ' + %subst(%editc(%abs(SQLCODE):'X'):6:5); if C3 = '0'; C3 = 'L'; endif; //================================================ ERR11(SQLMSG:'QSQLMSG':%subst(SQLMSGD:1:SQLMSGL)); //================================================ return *off; //================================================ on-error; endmon; /end-free p ERR50 e *=====================================================================