*=============================================================== * 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('AMWSRV') *=============================================================== fINVHDRF uf e k disk commit prefix(h) *=============================================================== d EntryPL pr extpgm('INVDETF_A0') d P likeds(P1) options(*varsize) d PL 10i 0 const *=============================================================== d EntryPL 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 *=============================================================== d OP s * d O e ds based(OP) extname(INVDETF) qualified d NP s * d N e ds based(NP) extname(INVDETF) qualified * Move *DIAG and Re-Send *ESCAPE Messages ====================== d ERR03 pr 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) *=============================================================== d InsertEvent pr d DeleteEvent pr d UpdateEvent pr *=============================================================== d CUSBALFP s * inz(%addr(CUSBALFR)) d CUSBALFK e ds extname(CUSBALF:*KEY) qualified d CUSBALFR e ds extname(CUSBALF) qualified d CUSBALF$ pr n d Action 5 const d Pointer * const d Keys 10i 0 const options(*nopass) *=============================================================== /free //=================================================== monitor; //================================================ PP = %addr(P); //================================================ select; // Insert ==================================== when P.Event = '1'; NP = PP + P.NewOS; InsertEvent(); // Delete ==================================== when P.Event = '2'; OP = PP + P.OldOS; DeleteEvent(); // Update ==================================== when P.Event = '3'; NP = PP + P.NewOS; OP = PP + P.OldOS; UpdateEvent(); //============================================ endsl; //================================================ on-error; ERR11('TRGA135':'AMWMSGF':'INVDETF_A0'); endmon; //================================================ return; //================================================ /end-free *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<================ *===================================================================== p InsertEvent b *===================================================== /free //=================================================== monitor; //================================================ chain (N.CUSTNO:N.INVNO) INVHDRF; CUSBALF$('R':CUSBALFP:N.CUSTNO); //================================================ hINVTOT += N.LINETOT; //================================================ CUSBALFR.CUSTOTOS += N.LINETOT; CUSBALFR.DAYSC += N.LINETOT; //================================================ update INVHDRFR; CUSBALF$('U':CUSBALFP); //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p InsertEvent e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<================ *===================================================================== p DeleteEvent b *===================================================== /free //=================================================== monitor; //================================================ chain (O.INVNO) INVHDRF; CUSBALF$('R':CUSBALFP:N.CUSTNO); //================================================ hINVTOT -= O.LINETOT; //================================================ CUSBALFR.CUSTOTOS -= N.LINETOT; CUSBALFR.DAYSC -= N.LINETOT; //================================================ update INVHDRFR; CUSBALF$('U':CUSBALFP); //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p DeleteEvent e *===================================================================== *<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<================ *===================================================================== p UpdateEvent b *===================================================== /free //=================================================== monitor; //================================================ chain (N.INVNO) INVHDRF; CUSBALF$('R':CUSBALFP:N.CUSTNO); //================================================ hINVTOT += (N.LINETOT-O.LINETOT); //================================================ CUSBALFR.CUSTOTOS += (N.LINETOT-O.LINETOT); CUSBALFR.DAYSC += (N.LINETOT-O.LINETOT); //================================================ update INVHDRFR; CUSBALF$('U':CUSBALFP); //================================================ on-error; ERR03(); endmon; //=================================================== /end-free p UpdateEvent e *=====================================================================