*=============================================================== * 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 option(*nodebugio) debug dftactgrp(*no) actgrp(*caller) h usrprf(*owner) aut(*use) bnddir('SERVICES') *=============================================================== fCUSBALF if e k disk *=============================================================== d CUSMSTF_B0 pr extpgm('CUSMSTF_B0') d P likeds(P1) options(*varsize) d PL 10i 0 const *=============================================================== d CUSMSTF_B0 pi d P likeds(P1) options(*varsize) d PL 10i 0 const *=============================================================== d PP s * d P1 ds d PFName 1 10 d LibName 11 20 d MbrName 21 30 d Event 31 31 d Time 32 32 d CmtLock 33 33 d Resvd1 34 36 d CCSID 37 40b 0 d RRN 41 44b 0 d Resvd2 45 48 d OldOS 49 52b 0 d OldLen 53 56b 0 d OldNMOS 57 60b 0 d OldNMLen 61 64b 0 d NewOS 65 68b 0 d NewLen 69 72b 0 d NewNMOS 73 76b 0 d NewNMLen 77 80b 0 d Resvd3 81 96 *=============================================================== * Move *DIAG and Re-Send *ESCAPE Messages d ERR03 pr d MT 1 const options(*nopass) * Send *DIAG Message d ERR10 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) * 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) *=============================================================== * Original Record Pointer d OP s * * Original Record d O e ds based(OP) extname(CUSMSTF) qualified * Original Null Byte Map Pointer d ONBMP s * * Original Null Byte Map d ONBM s 1 dim(7) based(ONBMP) * New Record Pointer d NP s * * New Record d N e ds based(NP) extname(CUSMSTF) qualified * New Record Null Byte Map Pointer d NNBMP s * * New Record Null Byte Map d NNBM s 1 dim(7) based(NNBMP) *=============================================================== d VALIDCALL pr n extproc('VALIDCALL') d ProcArray 500 const options(*varsize) d ProcArrayL 5i 0 const *=============================================================== d Default pr d InsertEvent pr d DeleteEvent pr d UpdateEvent pr d Validate pr *=============================================================== d Error s n inz('0') d User s 10 inz(*USER) *=============================================================== /free //=================================================== monitor; //================================================ if not VALIDCALL('XXXYYYF$':8); ERH11('AOF0020':'ERRMSGF':P.PFNAME); return; endif; //================================================ PP = %addr(P); //================================================ select; when P.Event = '1'; // Insert NP = PP + P.NewOS; Default(); InsertEvent(); Validate(); when P.Event = '2'; // Delete OP = PP + P.OldOS; DeleteEvent(); when P.Event = '3'; // Update NP = PP + P.NewOS; OP = PP + P.OldOS; Default(); UpdateEvent(); Validate(); endsl; //================================================ if Error; ERR11('TRGB001':'AMWMSGF':'CUSMSTF_B0'); endif; //================================================ on-error; ERR11('TRGB999':'AMWMSGF':'CUSMSTF_B0'); endmon; //================================================ return; //================================================ /end-free *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *===================================================================== p Default b *===================================================== /free //=================================================== monitor; //================================================ N.RECSTS = *blank; N.USERID = User; //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p Default e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *===================================================================== p InsertEvent b *===================================================== /free //=================================================== monitor; //================================================ N.STRDTE = %date(); //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p InsertEvent e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *===================================================================== p DeleteEvent b *===================================================== /free //=================================================== monitor; //================================================ chain (O.CUSTNO) CUSBALF; if CUSTOTOS > 0; // Checking for an outstanding balance greater than zero Error = *on; // Cannot delete a customer with an outstanding balance ERR10('TRGB010':'ERRMSGF':'Current Balance'); endif; //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p DeleteEvent e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *===================================================================== p UpdateEvent b *===================================================== /free //=================================================== monitor; //================================================ N.STRDTE = O.STRDTE; //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p UpdateEvent e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< *===================================================================== p Validate b *===================================================== /free //=================================================== monitor; //================================================ reset Error; // CUSTNO ======================================== if N.CUSTNO = *zero; Error = *on; ERR10('TRGB100':'ERRMSGF':'Customer Id.'); endif; // CUSNME ======================================= if N.CUSNME = *blank; Error = *on; ERR10('TRGB100':'ERRMSGF':'Customer Name'); endif; //=================================================== on-error; ERR03(); endmon; //=================================================== /end-free p Validate e *=====================================================================