       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.     MCSSO062.                                        
       DATE-WRITTEN.   AUGUST 16, 1995.                                 
       DATE-COMPILED.                                                   
      *****************************************************************         
      *                                                               *         
      *               SOUTH CAROLINA ELECTRIC & GAS                   *         
      *                                                               *         
      * PROGRAM: MCSSO062.                                            *         
      *                                                               *         
      *****************************************************************         
      *               PROGRAM  SUMMARY                                *         
      *                                                               *         
      * THIS PROGRAM IS CALLED BY RPC S025 AS PART OF THE SERVICE     *         
      * ORDER POSTING PROCESS.  THIS PROGAM PROCESSES FINAL BILL      *         
      * DETAILS.  SERVICE ORDER DETAILS ARE RETRIEVED FROM SYBASE     *         
      * USING THE MAINFRAME CLIENT GATEWAY.                           *         
      *                                                               *         
      *****************************************************************         
      *               PROGRAM  MODIFICATION  LOG                      *         
      *                                                               *         
      *   DATE    INITIALS     COMMENTS                               *         
      * --------  --------     -----------------------------------    *         
      * 08/16/95    JHR        PROCEDURE ORIGINALLY CODED.            *         
      * 01/31/96    MR         INCLUDED TBMFWQ FOR TPR 2970 - CPD10S  *         
      * 02/14/96    WMG        SET THE AR-TRACE-NO TO WS-PAR-TRACE-NO *         
      *                        IN THE 5995 PARAGRAPH.                 *         
      * 02/26/96    JHR        TPR 3341 - MOVE "B" TO THE FIELD       *         
      *                        OC-CODE-BILL-OFF-CYCL.                 *         
      * 02/27/96    JHR        TPR 3219 - FIXED REVISED LIGHTING      *         
      *                        CONTRACT AMOUNT POSTED MOVE.           *         
      * 03/12/96    JHR        IMPLEMENT FCS/CIS COPYBOOK CHANGES.    *         
      * 03/17/96    SK         FCS/CIS CHANGES.                       *         
      * 03/20/96    JHR        TPR 3580 - FIXED AR JOURNALING MOVE    *         
      *                        IN PARAGRAPH 5260.                     *         
      * 03/28/96    LMB        TPR 2508 - ADDED TBLIEAP               *         
      * 03/28/96    LMB        TPR 2585 - ADDED TBNSFHST              *         
      * 04/19/96    JHR        TPR 3884 - ADDED CODE TO 5681, 7250    *         
      *                        AND 7330 IN ORDER TO OBTAIN THE GL     *         
      *                        NUMBER USED FOR REBATING INTEREST.     *         
      * 06/20/96    CSG        TPR 3228 - ADDED TBPRJSHR              *         
      * 08/19/96    PP         PCR 0160 - ADDED CALCULATION FOR       *         
      *                        POPULATING EPP_MTHS_RMNG_QT IN         *         
      *                        CSS_BUDGET_HIST.                       *         
      *                                                               *         
      * 07/22/96    SR         PCR#052 INSERT ROWS TO CSS_REFUND.     *         
      *                                                               *         
      * 08/28/96    WMG        TPR 5172 - ASSIGN ABEND TABLE          *         
      *                        INFORMATION TO VARIABLES IN THE        *         
      *                        LINKAGE SECTION IN ALL SQL ERROR       *         
      *                        PROCESSING ROUTINES.                   *         
      *                                                               *         
      * 09/16/96    AG         TPR#4158 GET NEW ADDRESS ID FROM       *         
      *                        COPYBOOK CPD00090.                     *         
      *                                                               *         
      * 09/23/96    PD         USE CPD0062C INSTAED OF CPD0062D.      *         
      *                        ADDED 9000- DUMMY PARA TO HANDLE       *         
      *                        ERROR.                                 *         
      *                                                               *         
PCR305* 09/23/96    PD         USE CJF00105 FOR CPD00010 CHANGES.     *         
PCR305* 09/25/96    AS         USE 105 JOURNAL FORMATS INSTEAD OF 101.*         
PCR212* 10/08/96    AS         USE THE ALLOCATION FACTOR  IN          *         
PCR212*                        CSS_ACCOUNT OR CSS_LOCAL_OFFICE TO     *         
PCR212*                        TRANSFER UTE AND UTG.                  *         
      * 10/21/96    AS         DFA/DPP REVERSAL.REUSED CODE FROM S084.*         
      * 02/13/97    MJG        SET CODE-ACCT-STAT TO BE FINAL BILLED  *         
PCR482* 03/06/97    MAD        MODIFICATIONS MADE TO CORRECT DEPOSIT  *         
      *                        FINAL BILL PROCESS.                    *         
      * 03/17/97    WMG        TPR 8961 - DO NOT UPDATE THE AT-ACCT-  *         
      *                        FINALED DATE VARIABLE IN AT.  THIS IS  *         
      *                        TO BE COMPLETED BY BILLING.            *         
TP9728* 03/19/97    PD         ADD DCLGEN TBWOARGM FOR CPD73 CHANGES. *         
      * 04/09/97    WMG        PCR 404 - CHANGED JOURNALLING CODE     *         
      *                        TRAN TYPES AND DISCARDED HARD CODED    *         
      *                        TRANSACTION COMMENT VARIABLES.         *         
      * 04/15/97    WMG        ADDED DEPOSIT-STATUS-CD TO THE         *         
      *                        CSS-DEP-ON-HAND CURSOR.                *         
      * 04/17/97    WMG        MODIFIED THE LOGIC IN THE 5665-        *         
      *                        PARAGRAPH TO USE THE CURRENT DATE      *         
      *                        INSTEAD OF THE COMPLETED DATE WHEN     *         
      *                        UPDATING DEPOSIT RECORDS AND           *         
      *                        DETERMINING INTEREST.                  *         
      * 04/28/97    WMG        TPR 10625 - SET THE                    *         
      *                        WS-DEPOSIT-REFUND-SW FLAG TO 'Y' BEFORE*         
      *                        APPLYING FULLY PAID DEPOSITS.  BY DOING*         
      *                        SO, CPD00010 WILL MOVE SPACES TO THE   *         
      *                        CURRENCY TYPE BEFORE INSERTING THE     *         
      *                        AR TRANS HISTORY RECORDS.              *         
      * 05/12/97    WMG        TPR 11102 - REMOVE LOGIC TO UPDATE     *         
      *                        CSS_CREDIT_PROFILE FOR DNPFB ORDERS.   *         
      * 06/11/97    WMG        PCR 393 MODIFICATIONS.                 *         
      * 07/11/97    CHANDRA    ADDED CPD00312, CWS10016, TBHLDAY      *         
T16187* 05/04/98    TQT        SET THE CONTRACT STATUS CODE TO 'E'    *         
      *                        FOR INACTIVE WHENEVER THE ACCOUNT IS   *         
      *                        FINAL BILLED                           *         
T16516* 05/26/98    CBSI       FIELD AC-AMT-TRAN-BALANCE IS           *         
      *                        INITIALIZED WITH ZEROES                *         
T17601* 10/01/98    FB         ADDRESS CHANGES WERE JOURNALLED WITH   *         
T17601*                        AN INCORRECT APPL_PROGRAM_ID.          *         
T17639* 10/14/98    FB         WRITE A WQ TO THE LIGHTING COORDINATOR *         
T17639*                        IF AN OFF-FINAL BILL HAS A LIGHTING    *         
T17639*                        CONTRACT.  MOVED FROM PANEL046.        *         
T17984* 10/20/98    FB         DELETE RECONNECT AGREEMENT.            *         
T18095* 10/23/98    FB         CONTRACT CHANGES WERE WRITTEN TO MNT   *         
T18095*                        WITH AN INCORRECT APPL_PROGRAM_ID.     *         
T18175* 11/02/98    SV         HANDLE SO-FINAL BILL DPP PROPERLY      *         
T18407* 11/09/98    PRA        MULTIPLE ROWS OK FOR SELECT 'Y'        *         
T18423* 11/10/98    SV         HANDLE DPP WITH RCC PROPERLY           *         
T18441* 11/11/98    SV         ADD RCNCT_TYPE_NO TO CONNECT_CHRG TABLE*         
T18665* 12/10/98    PD         MOVE 'A' INSTEAD OF 'J'.               *         
T17746* 12/15/98    PD         DELETE BILLED BAL FOR DPP/DEP BEFORE   *         
T17746*                        PROCESSING THEM FOR FINAL.             *         
T17989* 12/15/98   PD         FIX EPP PROCESSING FOR FINAL.          *          
T17989*                       PROCESSING THEM FOR FINAL.             *          
T17989*                       MOVE -VE TRAN BAL TO CIA (TPR 18258)   *          
T18786* 01/11/99    CBSI     INCLUDED DB2 CALL TO SELECT DATE PRIOR  *          
T18786*             MADRAS   TO 3 MONTHS OF THE CURRENT DATE.        *          
CBSI  * 01/12/99    CBSI      ABEND LOG MODIFIED TO INCLUDE ALL THE  *          
CBSI  *             MADRAS    ABEND PARAMETERS                       *          
T19013* 01/28/99    PD        CORRECTED 5821- FOR THE SPLIT PERCENT. *          
T19106* 02/15/99    SV        JOURNAL LPN WHILE FB DPP               *          
T19255* 02/26/99    SV        SET CODE-TEMP-BILL OF CSS_ACCOUNT TO   *          
      *                       'T' (TEMPORARY) FOR FB DPP             *          
T19105* 03/04/99    SV        IF PYMT START DATE OF FB CNT IS IN FUTURE         
      *                       SET IT TO CURRENT DATE SO THAT IT GETS *          
      *                       BILLED                                 *          
T19476* 03/24/99    SV        CORRECTED ROUNDING PROBLEM WHILE SPLITTING        
      *                       EPP TO UTE AND UTG                      *         
T19830* 04/26/99    FB        DO NOT DELETE FORMATTED ADDRESS IF OLD  *         
      *                       AND NEW ADDRESS IDS ARE THE SAME.       *         
T19577* 04/26/99    FB        CHANGE CATEGORY 28 ROUTING CATEGORY     *         
      *                       FROM 4 TO 1.                            *         
T19626* 04/26/99    FB        REMOVE CODE THAT DELETES BILL HEADER.   *         
      *                       ALWAYS SET BILL STATUS TO B.  DO NOT    *         
      *                       SET CODE_BILL_ITM_IND.                  *         
T19884* 05/05/99    BAB       ADD LOGIC FOR FINAL BILLING ACCOUNTS    *         
      *                       WITH BOTH DFA'S & DPP'S                 *         
T19758* 05/18/99    FB        UPDATE CODE_BILL_TYPE TO 'B'.           *         
T20025* 06/07/99    KP        Do not add first earnest amount to      *         
T20025*                       tran balance of second earnest amt detail         
T20025*                       record.  Shd only update the tranbalance*         
T20025*                       of DPP receivable detail row            *         
T20025**                                                              *         
T20365* 06/14/99    RDF       COMMENT OUT SETTING THE CODE-TEMP-BILL  *         
T20499* 07/26/99    KSB       CALL BILL WINDOW INSTEAD OF BILLING-DET *         
T20499**                      TO GET REVENUE MONTH                    *         
T19715* 06/17/99    JVH       TPR 19715 FOR SEB:  TOFF TRANSACTION IS *         
      *                       NOT UPDATING BTU FACTOR FOR FINAL BILLS *         
T20243* 08/11/99    CBSI     USE BILLING DETAIL TO CHECK IF ELECTRIC  *         
T20243*             MADRAS   AND GAS EXISTS FOR ACCOUNT               *         
T20243*                      CREATE UTE AND/OR UTG ROWS IF EPP IS     *         
T20243*                      GOES INTO CIA DURING FINAL BILLING       *         
T20238* 08/20/99    CBSI     CHANGED TO INSERT A ROW IN THE CONNECT   *         
T20238*             MADRAS   CHARGE TABLE WHEN DPP IS DROPPED AND     *         
T20238*                      WHEN DFA-OUTSTANDING IS NOT EQUAL TO     *         
T20238*                      ORIGINAL AMOUNT                          *         
T20721* 09/17/99    CBSI     ACCOUNT MOVED FULL DFA AMNT BUT THE DPP  *         
T20721*             MADRAS   AMNT WAS SHORT THE AMNT OF DFA. THE FIELD*         
T20721*                      WS-AU-AMT-TOTAL HAS BEEN INITIALIZED.    *         
T20838* 10/07/99    CBSI     INCLUDED GL-ACCT-NO FOR NSN IN DPP       *         
T20838*             MADRAS   REVERSAL PROCESS WHILE FINAL BILLING     *         
T21176* 12/28/99    FB       REMOVE ADDRESS MATCHING LOGIC.           *         
T21446* 03/22/00    CBSI     POST LIGHTING CANCELLATION FEES TO       *         
T21446*                      CONTRACT(CNT NAME CD - 407)              *         
T22066* 04/25/00    FB       DO NOT DELETE FREEFORM ADDRESSES IF THEY *         
T22066*                      EXIST ON CSS_LANDLORD.                   *         
T20548* 04/25/00    FB       UPDATE USPS DELIVERY POINT               *         
T22269* 05/28/00    CBSI     TO MAKE CORRECT ENTRIES FOR GL-CREDIT AND*         
t22269*             MADRAS   GL-DEBIT IN TRANS HISTORY. ALSO, IF COND *         
T22269*                      ADDED FOR VARCHAR CTBBIND IN 5240- PARA  *         
T22289* 06/01/00    CBSI     TO FORMAT MNT ROW FOR LIGHTING CONTRACT  *         
T22289*             MADRAS   CANCELLATION FEE IN TRANS HISTORY        *         
T22294* 06/02/00    CBSI     POPULATE WS-101-AMOUNT-ENTERED AND       *         
T22294*             MADRAS   WS-101-AMT-POSTED WITH AMOUNT IN 5295-   *         
T22325* 06/08/00    PRA      CATEGORY 28 WQ SHOULD ONLY GENERATE FOR  *         
      *                      RATES THAT ARE NOT 025 OR 026            *         
T22303* 07/11/00    CBSI     CODE-CONTRACT NEED TO BE SET WHEN CONTRCT*         
T22303*                      CREATED FOR LIGHTING CANCELLATION FEES   *         
T22600* 08/03/00    FB       DO NOT TRY TO UPDATE BASE USE FOR TOFFS  *         
T22600*                      IF NO BILLING DETAIL FOUND               *         
T22976* 11/02/00    FB       UPDATE CONTRACT END DATE FOR BILLING     *         
T22976*                      CONTRACTS WITH RATE 025 OR 026 FOR CC,   *         
T22976*                      OC, AND OFF ORDERS.                      *         
T22772* 09/18/00    CBSI     TO CONVERT RCC CREDIT AT FINAL BILL TIME *         
T22772*             MADRAS   TO CREDIT IN ADVANCE                     *         
T23387* 12/18/00    DL       TO DELETE RCC SUMM ROW ONLY WHEN NO OTHER*         
T23387*                      RCC ROW EXISTS                           *         
T23387* 02/13/01             SQLCODE -811 BYPASSED IN 8910-           *         
T23010* 02/20/01    CBSI     CANCELLED DFA FOR AN ACCOUNT HAVING BOTH *         
T23010*             CHENNAI  DPP AND DFA ON FINAL BILLING.            *         
T23454* 06/29/01    LAT      TO MOVE CORRECT AMT TO AR DURING SO FINAL*         
T23454*                      DFA/DPP REVERSAL.                        *         
T23539* 07/23/01    PRA      CML 23539-28 (MCR 310) COMPANY NUMBER    *         
T23539*                      FOR GENERAL LEDGER WILL BE '01'          *         
T23539*                      -- CHANGES PER CHANELLE                  *         
C24748* 08/21/01    mdj      MADE CHANGE SO SUBSCRIPT WOULD NOT BE OUT*         
C24748*                      OF BOUNDS IN PARA 2205.                  *         
      *                         INTEREST CORRECTLY                     *        
T23980*   11/19/01     SM19366  MODIFIED THE PROGRAM COPYBOOK          *        
T23980*                         CPD00023 SO NEEDED TO ADD COPYBOOK     *        
T23980*                         CWS0024B FOR SEB DEPOSIT REFUND.       *        
T24436* 11/20/01  COVANSYS   COPYBOOK CPD00061 CHANGED TO SUB         *         
T24436**          CHENNAI    PROGRAM  SCSCO061.                       *         
C25426* 11/28/01    SS82048  CHANGES TO FIX INTEREST CALCULATION      *         
C25426*                      FOR ACCOUNTS WHICH HAD MULTIPLE DEPOSITS *         
BILGEN* 11/30/01  COVANSYS   CHANGED TO SKIP INSERT INTO              *         
BILGEN*           CHENNAI    CSS_OFF_CYCL_ACCT FOR BILLGEN ACCOUNTS   *         
T25819* 04/17/02  SV         CODE-CCC-TYPE SHOULD HAVE A VALUE "B" WHEN         
T25819*                      DFA IS PROCESSED.                        *         
C24931* 05/29/02    FB       DELETE ROWS FOR ACCOUNT FROM             *         
C24931*                      CSS_BILL_ADDR_XREF PRIOR TO INSERT.      *         
C25596* 05/29/02    FB       DO NOT DELETE FORMATTED ADDRESS IF USED  *         
C25596*                      AS A LANDLORD ADDRESS.                   *         
C26298* 01/06/03    SR       CHECK FOR PENDING CONTRACT FOR OFF FINAL *         
C26298*                      BILL AND  DO NOT POST THE ORDER IF THERE *         
C26298*                      IS PENDING CONTRACT.                     *         
C27363* 06/02/03    FB       DO NOT WRITE TO OFF CYCLE IF CODE_ACCT_  *         
C27363*                      BILLED IS H.                             *         
C29238* 08/12/03    SR       UPDATE CODE PERM BILL TO PULL EXTRA      *         
C29238*                      POSTAGE FOR INTERNATIONAL ADDRESSES      *         
C28160* 12/15/03    SR       DO NOT UPDATE CODE-REFUND-ELIG FLAG WITH *         
C28160*                      SPACES WHEN THE ACCOUNT IS FINAL BILLED. *         
C30300* 02/27/04    SR       ADD CALCULATED INTEREST TO INTRST_YTD AND*         
C30300*                      TOTAL_INTRST FIELDS WHEN ACCOUNT IS FB.  *         
C32671* 06/28/05    SD       UPDATE PROJECT SHARE INFO AFTER THE ACCT *         
C32671*                      IS FINALLED.                             *         
T33431** 03/16/06   SK88120        COG PROJECT CHANGES -                        
T33431**                           A- ADD NEW COPYBOOKS                         
T33431**                           B- CHANGE IN CPD00073                        
C32832*  04/12/06   SC41135  THIRD-PARTY NOTIFICATION PROJ-MAKE THIRD *         
C32832*                      PARTY INACTIVE WHEN ACCOUNT IS FINALED   *         
REARCH*  01/16/07   PA       SO REAARCH MODIFICATIONS                 *         
REARCH*                      CONVERT OPEN CLIENT CALLS TO DB2 CALLS   *         
REARCH*  06/04/07   PA       UPDATE FAILING WITH -1 WHEN 2 PEOPLE ARE *         
REARCH*                      TRYING TO JOURNAL AT THE SAME TIME       *         
REARCH*                      USE COPYBOOK CPD0006A INPLACE OF CPD00006*         
C35749* 11/08/07    FB       WRITE ADDRESS ID TO TRANSACTION HISTORY. *         
C34599* 01/21/08    VP94820  STOPPED RESETTING CODES-DATA-PRESENT FOR *         
C34599*                      PROJECT SHARE.                                     
C37422* 10/16/08    SS19371  IF SEB FINAL BILL, CHECK FOR PENDING     *         
C37422*                      RCHGTAX FACTOR.  IF FOUND, CREATE WQ AND *         
C37422*                      HOLD FROM BILLING.                       *         
C37422* 11/21/08    SS19371  CHANGE HOLD CODE FROM 'H' TO 'X'         *         
C37422* 12/10/08    SS19371  CHANGE LOGIC SO THAT FULL PREPAY ON      *         
C37422*                      UNWORKED RCC WILL CREATE WQ & PUT ON HOLD*         
CFBEPP* 12/12/08    SS19371  MOVE SPACE TO EPP OFFER FOR FINAL BILL   *         
C35920* 12/17/08    SS19371  STOPPED RESETTING CODES-DATA-PRESENT FOR *         
C35920*                      PROJECT SHARE.                                     
A00759* 03/06/09    VV90387  STOPPED LIGHT CO-ORDINATOR WQ FOR RATES  *         
A00759*                      025,026,017,018,062 & 067. UPDATE THE BILL         
A00759*                      CONTRACT END DATE FOR ALL THESE RATES.   *         
A00759*                      ALSO INCLUDED NC FOR UPDATING THE END DT *         
A35665* 03/11/09    FMB      REMOVED DELETES FROM ADDRESS TABLES.     *         
A37302* 07/07/09    FMB      DELETED CSS_CIAC AND CSS_RVC_ACCT.       *         
A00870* 07/09/09    FMB      CHANGE TO DELETE ALL RCC ROWS.           *         
A37666* 12/03/09    FMB      CLEAN UP MAINTENANCE TRANSHIST.          *         
A02004* 02/05/10    DB18339  DELETING ZERO AMT AR CNTL ROWS.          *         
A00581* 02/09/10    DB18339  EXPIRE MED CERT WHEN ACCT FINALS.        *         
A02004* 04/14/10    SK42147  UPDATE AR-CNTL ROWS CORRECTLY.           *         
P00307* 06/23/10    SV95326  DELETE THE ROW FROM CSS_ACCT_ATTRIBUTE   *         
P00307*                      FOR THAT ACCOUNT WHERE THE ATTRIBUTE_DESC*         
P00307*                      IS 'BBP_REVIEW_EXEMPT' WHEN THE CUSTOMER *         
P00307*                      IS FINAL BILLING.                        *         
A37666* 08/02/10    FMB      IF ACCT_XFER_TO_ACCT IS FINAL BILLED FOR *         
A37666*                      CUSTOMER, NULL IT OUT ON CSS_CUSTOMER.   *         
P00453* 03/10/11    SS19371  PROCESSING FOR PAY AND GO SIMILAR TO EPP *         
P00453* 05/19/11    SS19371  CHANGE PAY AND GO TO PRE-PAY PLAN        *         
P00471* 08/01/11    PK98692  DPP DROP CHANGES - TO DELETE ATTRIBUTE   *         
P00471*                      ROWS - AUTO_DROP_DPP, AUTODPPDRPEXEMPIND *         
P00471*                      AND SPCL_BILL_MSG ROW WITH ID '91030'    *         
P00471*                      WHEN ACCOUNT IS FINAL BILLED             *         
P0471A* 10/17/11    PK98692  TO NOT CHANGE CREDIT GROUP TO 'A' WHEN   *         
P0471A*                      ACCOUNT DROPS FROM DPP.                  *         
A02677* 02/17/12    VV90387  UPDATE CONTRACT END DATE FOR DNPFB       *         
P00547* 03/14/12    FB       CHANGES FOR IAT PROJECT.                 *         
P00547* 05/07/13    DB18339  CHANGES FOR IAT PROJECT.                 *         
A04527* 09/27/13    MR7E794  REMOVED UNUSED DCLGENS.                  *         
A04847* 09/27/13    DB18339  CORRECT ELEC AR BALANCE ISSUE WITH ACCTS *         
                             FINALED WITH NO UTIL METERS              * 
ACT074* 03/27/14    VIJAY    REMOVE TBGLNAME                          *         
ACT074* A04880                                                                  
P00914* 02/26/16    FMB      DO NOT WRITE TO OFF CYCLE FOR OPEN WAY   *         
P00914*                      FINALED ACCOUNTS.                        *         
A05460* 01/28/16     MC95456  ACT023 - REMOVED UNUSED COPYBOOKS.      *         
ACT103* 03/19/16     MC95456  REPLACE CSS_WQ_ITEMS_MF WITH            *         
ACT103* APPL5460              CSS_WQ_ITEMS BY CALLING MCSCB077        *         
ACT103*                       REMOVE UNUSED COPYBOOKS.                *         
A05317* 10/14/16    FMB      REMOVE UNUSED CONTACT COLUMNS AND        *         
A05317*                      CCA00001.                                *         
      *****************************************************************         
      *                                                               *         
      * DIRECTORY OF MAJOR PROCESSING MODULES:                        *         
      *                                                               *         
      *   0000-MAIN                                                   *         
      *   1000-PROCESS-INPUT                                          *         
      *   5000-UPDATE                                                 *         
      *   5100-PROCESS-FB-ADDRESS                                     *         
      *   5210-PROCESS-SO-FB-UMCNTRC                                  *         
      *   5600-PROCESS-FINAL-BILL                                     *         
      *   5800-PROCESS-EPP                                            *         
      *                                                               *         
      *****************************************************************         
       ENVIRONMENT DIVISION.                                            
       DATA DIVISION.                                                   
       WORKING-STORAGE SECTION.                                         

MSQ017 01 MFA-PROGRAM-ID PIC X(8) VALUE 'MCSSO062'.
MSQ017     COPY MFASQLM.
                                                                        
       01  WS-START                    PIC X(40)                        
REARCH     VALUE 'WORKING STORAGE FOR MCSSO062 STARTS HERE'.            
                                                                        
      ****************************************************************          
      * INCLUDE DB2 DCLGENS.                                         *          
      ****************************************************************          
                                                                        
           EXEC SQL                                                             
              INCLUDE TBACCT                                                    
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBGTHST                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBGTPLN                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCNTDET                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBADDRID                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBADRFMT                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBADRFRE                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBARCNTL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBARHDT                                                   
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBARHIST                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBARPMT                                                   
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBJCNTL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBLADRX                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBLLDET                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBLLHDR                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBBTJRNL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCDCNTL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCDJRNL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCHGOFF                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCNSMP                                                   
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCNTINF                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCNTRCT                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBCUST                                                    
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBDEPHND                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBDEPHST                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBDEPINT                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBDFAACT                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBDFARCV                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBGLATNO                                                  
           END-EXEC.                                                            
                                                                        
                                                                        
           EXEC SQL                                                             
              INCLUDE TBINTHST                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBMNHIST                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBMNHDT                                                   
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBMSJRNL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBNMACTX                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBOFFCYL                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBPREM                                                    
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBRECNCT                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE TBUSRPRF                                                  
           END-EXEC.                                                            
                                                                        
TP2508     EXEC SQL                                                             
TP2508        INCLUDE TBLIEAP                                                   
TP2508     END-EXEC.                                                            
                                                                        
TP3228     EXEC SQL                                                             
TP3228        INCLUDE TBPRJSHR                                                  
TP3228     END-EXEC.                                                            
                                                                        
PCR212     EXEC SQL                                                             
PCR212        INCLUDE TBDELQ                                                    
PCR212     END-EXEC.                                                            
                                                                        
PCR212     EXEC SQL                                                             
PCR212        INCLUDE TBCCCHRG                                                  
PCR212     END-EXEC.                                                            
                                                                        
PCR212     EXEC SQL                                                             
PCR212        INCLUDE TBRCNCHR                                                  
PCR212     END-EXEC.                                                            
                                                                        
PCR212     EXEC SQL                                                             
PCR212        INCLUDE TBLOCOFC                                                  
PCR212     END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
               INCLUDE TBREFUND                                                 
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
               INCLUDE TBCRCOLL                                                 
           END-EXEC.                                                            
                                                                        
TP9728     EXEC SQL                                                     07009600
TP9728         INCLUDE TBWOARGM                                         07009700
TP9728     END-EXEC.                                                    07009800
                                                                        
           EXEC SQL                                                     07009600
               INCLUDE TBCSTPLN                                         07009700
           END-EXEC.                                                    07009800
                                                                        
           EXEC SQL                                                             
               INCLUDE TBHLDAY                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
               INCLUDE SQLCA                                                    
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
               INCLUDE TBCRPROF                                                 
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
T17639         INCLUDE TBBLCNTR                                                 
T17639     END-EXEC.                                                            
                                                                        
T22066     EXEC SQL                                                             
T22066         INCLUDE TBLNDLRD                                                 
T22066     END-EXEC.                                                            
                                                                        
T22976     EXEC SQL                                                             
T22976         INCLUDE TBUTLENV                                                 
T22976     END-EXEC.                                                            
                                                                        
C32832     EXEC SQL                                                             
C32832         INCLUDE TBTHDPTY                                                 
C32832     END-EXEC.                                                            
                                                                        
C32832     EXEC SQL                                                             
C32832         INCLUDE TBTHDHST                                                 
C32832     END-EXEC.                                                            
                                                                        
REARCH     EXEC SQL                                                             
REARCH         INCLUDE TBSOFIN                                                  
REARCH     END-EXEC.                                                            
                                                                        
REARCH     EXEC SQL                                                             
REARCH         INCLUDE TBFBUMC                                                  
REARCH     END-EXEC.                                                            
                                                                        
C37422     EXEC SQL                                                             
C37422         INCLUDE TBFXDFCT                                                 
C37422     END-EXEC.                                                            
                                                                        
A00581     EXEC SQL                                                             
A00581         INCLUDE TBCSTALT                                                 
A00581     END-EXEC.                                                            
                                                                        
P00307     EXEC SQL                                                             
P00307         INCLUDE TBACTATT                                                 
P00307     END-EXEC.                                                            
                                                                        
P00471     EXEC SQL                                                             
P00471         INCLUDE TBSBLMSG                                                 
P00471     END-EXEC.                                                            
                                                                        
P00914     EXEC SQL                                                             
P00914         INCLUDE TBMTRENV                                                 
P00914     END-EXEC.                                                            
                                                                        
P00547* CSS_CATEGORY - F5                                                       
P00547     EXEC SQL                                                             
P00547         INCLUDE TBCAT                                                    
P00547     END-EXEC.                                                            
                                                                        
P00914     EXEC SQL                                                             
P00914         INCLUDE TBRDFMT                                                  
P00914     END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE CWS00071                                                  
           END-EXEC.                                                            
                                                                        
           EXEC SQL                                                             
              INCLUDE CWS0090A                                                  
           END-EXEC.                                                            
                                                                        
                                                                        
      ****************************************************************          
      * COBOL WORKING STORAGE COPY BOOKS.                            *          
      ****************************************************************          
                                                                        
                                                                        
      * SUPPORTS REBATE CALC (CPD00003).                                        
           COPY CWS00004.                                                       
           COPY CWS00007.                                                       
           EXEC SQL                                                             
              INCLUDE CWS00008                                                  
           END-EXEC.                                                            
                                                                        
      * SUPPORTS JOURNALING.                                                    
           COPY CJF00101.                                                       
           COPY CJF00102.                                                       
           COPY CJF00103.                                                       
PCR305     COPY CJF00105.                                                       
           COPY CJF00113.                                                       
                                                                        
      * SUPPORTS ERROR HANDLING.                                                
           COPY CWS00010.                                                       
                                                                        
      * SUPPORTS ONLINE/CSR JOURNALS.                                           
           COPY CWS00027.                                                       
                                                                        
      * SUPPORTS ACCOUNT CODES DATA PRESENT.                                    
           COPY CWS00056.                                                       
                                                                        
      * SUPPORTS SERVICE ORDER CODES DATA PRESENT.                              
           COPY CWS00059.                                                       
                                                                        
      * SUPPORTS DB2 AND SQL ERROR CHECKING.                                    
           COPY CWS00303.                                                       
                                                                        
      * SUPPORTS COG DEG GAS ENTRY                                              
T33431     COPY CWSCA225.                                                       
                                                                        
      * SUPPORTS REFUND ENTRY                                                   
           EXEC SQL                                                             
              INCLUDE CWS00131                                                  
           END-EXEC.                                                            
                                                                        
      * SUPPORTS DEP INT CALC.                                                  
           EXEC SQL                                                             
              INCLUDE CWS0223B                                                  
           END-EXEC.                                                            
                                                                        
      * SUPPORTS COMMON JOURNALING.                                             
REARCH     EXEC SQL                                                             
REARCH        INCLUDE CWS0013B                                                  
REARCH     END-EXEC.                                                            
                                                                        
      * SUPPORTS PAYMENT ROUTINE (CPD00010).                                    
           EXEC SQL                                                             
              INCLUDE CWS00017                                                  
           END-EXEC.                                                            
                                                                        
      * SUPPORTS LOADING GL NUMBERS.                                            
           EXEC SQL                                                             
              INCLUDE CWS00061                                                  
           END-EXEC.                                                            
      *                                                                         
T23980     EXEC SQL                                                             
T23980         INCLUDE CWS0024B                                                 
T23980     END-EXEC.                                                            
      *                                                                         
ACT103*                                                                         
ACT103/***** FOR WQ INSERT - WORKING STORAGE COPYBOOK FOR MCSCB077              
ACT103     EXEC SQL                                                             
ACT103          INCLUDE CWS00077                                                
ACT103     END-EXEC.                                                            
ACT103                                                                  
                                                                        
      * SUPPORTS PAYMENT APPLICATION.                                           
           EXEC SQL                                                             
              INCLUDE CWS00073                                                  
           END-EXEC.                                                            
                                                                        
T33431     EXEC SQL                                                             
T33431       INCLUDE TBJBPARM                                                   
T33431     END-EXEC.                                                            
                                                                        
NONUTL******************************************************************        
NONUTL*    HOLIDAY CHECK                                                        
NONUTL******************************************************************        
NONUTL     EXEC SQL                                                             
NONUTL         INCLUDE CWS10016                                                 
NONUTL     END-EXEC.                                                            
HPCCDM*EJECT                                                                    
                                                                        
      ****************************************************************          
      * WORK AREAS.                                                  *          
      ****************************************************************          
       01  WS-FINAL-BILL-PROGRAM-NAMES.                                 
REARCH     05  PROGRAM-NAME                 PIC X(08) VALUE 'MCSSO062'. 
ACT103     05  WS-WQ-CALL-PGM               PIC X(08) VALUE 'MCSSO062'. 
           05  WS-PROG-CREDIT-DEPOSIT       PIC X(08) VALUE 'PCSSO62A'. 
           05  WS-PROG-CREDIT-CNT-INTRST    PIC X(08) VALUE 'PCSSO62B'. 
           05  WS-PROG-FINAL-BILL-DPP       PIC X(08) VALUE 'PCSSO62D'. 
           05  WS-PROG-FINAL-BILL-DFA       PIC X(08) VALUE 'PCSSO62E'. 
           05  WS-PROG-FINAL-BILL-CNT       PIC X(08) VALUE 'PCSSO62F'. 
           05  WS-PROG-FINAL-BILL-ADDR      PIC X(08) VALUE 'PCSSO62G'. 
           05  WS-PROG-FINAL-BILL-LGHTG     PIC X(08) VALUE 'PCSSO62H'. 
           05  WS-PROG-CLOSE-CONTRACT       PIC X(08) VALUE 'PCSSO62I'. 
           05  WS-PROG-CREDIT-DEPOSIT-INT   PIC X(08) VALUE 'PCSSO62J'. 
T18516     05  WS-PROG-CREDIT-DEPOSIT-AR    PIC X(08) VALUE 'PCSSO62K'. 
T17746     05  WS-PROG-CREDIT-DEP-BILLED    PIC X(08) VALUE 'PCSSO62L'. 
T17746     05  WS-PROG-CREDIT-DPP-BILLED    PIC X(08) VALUE 'PCSSO62M'. 
T19884     05  WS-PROG-CREDIT-DFA-BILLED    PIC X(08) VALUE 'PCSSO62N'. 
T22772     05  WS-PROG-RCC-TO-CIA           PIC X(08) VALUE 'PCSSO62O'. 
T33431     05  MCSCB225                     PIC X(8) VALUE  'McSCB225'. 
T33431     05  WS-COG-TRAN-TYPE-CD-73       PIC X(1) VALUE  'P'.        
ACT103     05  MCSCB077                     PIC X(08) VALUE 'MCSCB077'. 
ACT103     05  SCSCB077                     PIC X(08) VALUE 'SCSCB077'. 
                                                                        
ACT103 01  WS-MCSCB077-OUTPUT.                                          
ACT103     05  WS-MCSCB077-RET-CODE     PIC S9(09) COMP VALUE 0.        
                                                                        
ACT103 01  WS-CPD0010S-CALL-TYPE        PIC X(01)  VALUE 'O'.           
ACT103     88 WS-CPD0010S-ONLINE-CALL              VALUE 'O'.           
ACT103     88 WS-CPD0010S-BATCH-CALL               VALUE 'B'.           
                                                                        
       01  WS-NULL-IND-VARS.                                            
           05  WS-NULL-INDICATOR-1      PIC S9(04) COMP.                
           05  WS-NULL-INDICATOR-2      PIC S9(04) COMP.                
           05  WS-NULL-INDICATOR-3      PIC S9(04) COMP.                
           05  WS-NULL-INDICATOR-4      PIC S9(04) COMP.                
           05  WS-DFA-NULL-IND          PIC S9(04) COMP   VALUE +0.     
           05  WS-DFA-NULL-IND2         PIC S9(04) COMP   VALUE +0.     
PCR482     05  WS-TOTAL-PAYMENTS-NI     PIC S9(04) COMP   VALUE +0.     
T20499     05  WS-REVENUE-MONTH-NULL-1  PIC S9(04) COMP   VALUE +0.     
T20499     05  WS-REVENUE-MONTH-NULL-2  PIC S9(4) COMP.                 
T20499     05  WS-NULL-IND01            PIC S9(4) COMP.                 
A37666     05  WS-NULL-CU               PIC S9(4) COMP.                 
                                                                        
       01  GW-LIB-MISC-FIELDS.                                          
           05  GWL-PROC                  POINTER.                       
           05  GWL-INIT-HANDLE           POINTER.                       
           05  GWL-RC                    PIC S9(9) COMP.                
           05  GWL-STATUS-NR             PIC S9(9) COMP.                
           05  GWL-STATUS-DONE           PIC S9(9) COMP.                
           05  GWL-STATUS-COUNT          PIC S9(9) COMP.                
           05  GWL-STATUS-COMM           PIC S9(9) COMP.                
           05  GWL-STATUS-RETURN-CODE    PIC S9(9) COMP.                
           05  GWL-STATUS-SUBCODE        PIC S9(9) COMP.                
                                                                        
       01  CS-LIB-MISC-FIELDS.                                          
           05  WS-CSL-CMD-HANDLE         PIC S9(9) COMP VALUE 0.        
           05  WS-CSL-CON-HANDLE         PIC S9(9) COMP VALUE 0.        
           05  WS-CSL-CTX-HANDLE         PIC S9(9) COMP VALUE 0.        
           05  WS-CSL-NULL               PIC S9(9) COMP VALUE 0.        
           05  WS-CSL-RC                 PIC S9(9) COMP.                
           05  WS-CSL-RESTYPE            PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-ITEM-NUM               PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-COPIED                 PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-COPIED-NULL            PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-INDICATOR              PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-INDICATOR-NULL         PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-NUMROWS                PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-RPC-RC                 PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-RPC-SUCCESS            PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-RETURN-CODE            PIC S9(9) COMP SYNC VALUE 0.   
           05  WS-RN-NULL-ITEM           PIC S9(04) COMP VALUE -1.      
                                                                        
       01  CS-PROPERTY-FIELDS.                                          
           05  WS-SO-FINAL-BILL-RPC      PIC X(23)                      
               VALUE 'csrddat.dbo.pd_D0000198'.                         
           05  WS-SO-FB-UMCNTRCT-RPC     PIC X(23)                      
               VALUE 'csrddat.dbo.pd_D0000202'.                         
           05  WS-SO-RPC-LEN             PIC S9(9) COMP VALUE +23.      
           05  WS-OUTLEN                 PIC S9(9) COMP VALUE 0.        
           05  WS-STRLEN                 PIC S9(9) COMP VALUE 0.        
           05  WS-MSGLIMIT               PIC S9(9) COMP VALUE +5.       
           05  PARM-L                    PIC S9(9) COMP.                
           05  PARM-ID1                  PIC S9(9) COMP VALUE 1.        
                                                                        
       01  WS-DATAFMT.                                                  
           05  WS-NM-PARM                PIC X(132).                    
           05  WS-NMLEM-PARM             PIC S9(9) COMP SYNC.           
           05  WS-DATATYPE-PARM          PIC S9(9) COMP SYNC.           
           05  WS-FORMT-PARM             PIC S9(9) COMP SYNC.           
           05  WS-MAXLENGTH-PARM         PIC S9(9) COMP SYNC.           
           05  WS-SCALE-PARM             PIC S9(9) COMP SYNC.           
           05  WS-PRECISION-PARM         PIC S9(9) COMP SYNC.           
           05  WS-FNTSTATUS-PARM         PIC S9(9) COMP SYNC.           
           05  WS-FMTCOUNT-PARM          PIC S9(9) COMP SYNC.           
           05  WS-USERTYPE-PARM          PIC S9(9) COMP SYNC.           
           05  WS-LOCALE-PARM            PIC S9(9) COMP SYNC.           
                                                                        
       01  WS-DATAFMT-BIND.                                             
           05  WS-NM-BIND                PIC X(132).                    
           05  WS-NMLEM-BIND             PIC S9(9) COMP SYNC.           
           05  WS-DATATYPE-BIND          PIC S9(9) COMP SYNC.           
           05  WS-FORMT-BIND             PIC S9(9) COMP SYNC.           
           05  WS-MAXLENGTH-BIND         PIC S9(9) COMP SYNC.           
           05  WS-SCALE-BIND             PIC S9(9) COMP SYNC.           
           05  WS-PRECISION-BIND         PIC S9(9) COMP SYNC.           
           05  WS-FNTSTATUS-BIND         PIC S9(9) COMP SYNC.           
           05  WS-FMTCOUNT-BIND          PIC S9(9) COMP SYNC.           
           05  WS-USERTYPE-BIND          PIC S9(9) COMP SYNC.           
           05  WS-LOCALE-BIND            PIC S9(9) COMP SYNC.           
                                                                        
       01  WS-SERVER-MSG.                                               
           05  WS-SM-MSGNO               PIC S9(9) COMP SYNC.           
           05  WS-SM-STATE               PIC S9(9) COMP SYNC.           
           05  WS-SM-SEVERITY            PIC S9(9) COMP SYNC.           
           05  WS-SM-TEXT                PIC X(256).                    
           05  WS-SM-TEXT-LEN            PIC S9(9) COMP SYNC.           
           05  WS-SM-SVRNAME             PIC X(256).                    
           05  WS-SM-SVRNAME-LEN         PIC S9(9) COMP SYNC.           
           05  WS-SM-PROC                PIC X(256).                    
           05  WS-SM-PROC-LEN            PIC S9(9) COMP SYNC.           
           05  WS-SM-LINE                PIC S9(9) COMP SYNC.           
           05  WS-SM-STATUS              PIC S9(9) COMP SYNC.           
                                                                        
       01  WS-CLIENT-MSG.                                               
           05  WS-CM-SEVERITY            PIC S9(9) COMP SYNC.           
           05  WS-CM-OC-MSGNO            PIC S9(9) COMP SYNC.           
           05  WS-CM-OC-MSGTEXT          PIC X(256).                    
           05  WS-SM-OC-MSGTEXT-LEN      PIC S9(9) COMP SYNC.           
           05  WS-CM-OS-MSGNO            PIC S9(9) COMP SYNC.           
           05  WS-CM-OS-MSGTEXT          PIC X(256).                    
           05  WS-CM-OS-MSGTEXT-LEN      PIC S9(9) COMP SYNC.           
           05  WS-CM-STATUS              PIC S9(9) COMP SYNC.           
                                                                        
       01  WS-DATALEN                    PIC S9(9) COMP SYNC VALUE 0.   
       01  WS-INDIC                      PIC S9(9) COMP SYNC VALUE 0.   
                                                                        
       01  SNA-FIELDS.                                                  
           05  SNA-SUBC                  PIC S9(9) COMP.                
           05  SNA-CONNECTION-NAME       PIC X(8)  VALUE SPACES.        
                                                                        
      *************************************************************             
      *==>WORKING STORAGE CHG FOR CTBBIND ISSUE SYB 01/27/98   <==*             
      *************************************************************             
       01  XD-ADDR-COUNTRY-BD-01.                                       
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-COUNTRY-BD          PIC X(35).                   
                                                                        
       01  XD-ADDR-PREFIX-1-BD-01.                                      
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-PREFIX-1-BD         PIC X(03).                   
                                                                        
       01  XD-ADDR-PREFIX-2-BD-01.                                      
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-PREFIX-2-BD         PIC X(02).                   
                                                                        
       01  XD-ADDR-ST-BD-01.                                            
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-ST-BD               PIC X(35).                   
                                                                        
       01  XD-ADDR-SUFFIX-BD-01.                                        
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-SUFFIX-BD           PIC X(02).                   
                                                                        
       01  XD-ADDR-ZIP-CODE-BD-01.                                      
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDR-ZIP-CODE-BD         PIC X(09).                   
                                                                        
       01  XD-ADDRESS-FORMAT-BD-01.                                     
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDRESS-FORMAT-BD        PIC X(01).                   
                                                                        
       01  XD-ADDRESS-OVERFLOW-BD-01.                                   
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ADDRESS-OVERFLOW-BD      PIC X(35).                   
                                                                        
       01  XD-CARRIER-ROUTE-BD-01.                                      
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-CARRIER-ROUTE-BD         PIC X(05).                   
                                                                        
       01  XD-CREDIT-LETTER-IND-BD-01.                                  
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-CREDIT-LETTER-IND-BD     PIC X(01).                   
                                                                        
       01  XD-FINAL-BILL-CY-ST-BD-01.                                   
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-FINAL-BILL-CY-ST-BD      PIC X(20).                   
                                                                        
       01  XD-FINAL-BILLOVFL-BD-01.                                     
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-FINAL-BILL-OVFL-BD       PIC X(35).                   
                                                                        
       01  XD-HOUSE-NO-BD-01.                                           
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-HOUSE-NO-BD              PIC X(05).                   
                                                                        
       01  XD-SEND-TO-LOCOFF-IND-BD-01.                                 
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-SEND-TO-LOCOFF-IND-BD    PIC X(01).                   
                                                                        
       01  XD-STREET-LOCATION-1-BD-01.                                  
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-STREET-LOCATION-1-BD     PIC X(04).                   
                                                                        
       01  XD-STREET-LOCATION-2-BD-01.                                  
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-STREET-LOCATION-2-BD     PIC X(06).                   
                                                                        
       01  XD-STREET-NAME-BD-01.                                        
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-STREET-NAME-BD           PIC X(16).                   
                                                                        
       01  XD-STREET-SUFFIX-BD-01.                                      
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-STREET-SUFFIX-BD         PIC X(04).                   
                                                                        
       01  XD-ZIP-CODE-BD-01.                                           
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ZIP-CODE-BD              PIC X(05).                   
                                                                        
       01  XD-ZIP-CODE-PLUS-FOUR-BD-01.                                 
           05  FILLER                      PIC S9(4) COMP.              
           05  XD-ZIP-CODE-PLUS-FOUR-BD    PIC X(04).                   
                                                                        
       01  XD-ZIP-CODE-TOKEN-BD-01.                                     
           05  FILLER                      PIC S9(4) COMP.              
           05 XD-ZIP-CODE-TOKEN-BD         PIC X(01).                   
                                                                        
T20548 01  XD-USPS-DEL-POINT-BD-01.                                     
T20548     05  FILLER                      PIC S9(4) COMP.              
T20548     05 XD-USPS-DEL-POINT-BD         PIC X(02).                   
      *************************************************************             
      *==>END STORAGE CHG FOR CTBBIND ISSUE SYB 01/27/98       <==*             
      *************************************************************             
                                                                        
T20443 01  XF-REV-INSTALL-AMT-BD-01.                                    
T20443     05  FILLER                      PIC S9(4) COMP.              
           05  XF-REV-INSTALL-AMT-BD       PIC X(09).                   
                                                                        
T20443 01  XF-IC-NO-BD-01.                                              
           05  XF-IC-NO-BD                 PIC S9(04) COMP.             
                                                                        
       01  WS-ADDRESS-DETAILS.                                          
           05  WS-HOUSE-NO                 PIC X(15).                   
           05  WS-ADDR-PREFIX-1            PIC X(03).                   
           05  WS-ADDR-PREFIX-2            PIC X(02).                   
           05  WS-STREET-NAME              PIC X(30).                   
           05  WS-STREET-SUFFIX            PIC X(04).                   
           05  WS-STREET-LOCATION-1        PIC X(04).                   
           05  WS-STREET-LOCATION-2        PIC X(11).                   
           05  WS-ADDRESS-OVERFLOW         PIC X(35).                   
REARCH     05  WS-ADDRESS-FORMAT           PIC X(01).                   
           05  WS-ZIP-CODE                 PIC X(05).                   
           05  WS-ZIP-CODE-PLUS-FOUR       PIC X(04).                   
           05  WS-ZIP-CODE-TOKEN           PIC X(01).                   
           05  WS-ADDR-SUFFIX              PIC X(02).                   
           05  WS-CARRIER-ROUTE            PIC X(05).                   
           05  WS-ADDR-ST                  PIC X(55).                   
           05  WS-FINAL-BILL-CY-ST         PIC X(30).                   
           05  WS-ADDR-ZIP-CODE            PIC X(09).                   
           05  WS-ADDR-COUNTRY             PIC X(35).                   
           05  WS-FINAL-BILL-OVFL          PIC X(35).                   
T20548     05  WS-USPS-DEL-POINT           PIC XX.                      
REARCH     05  WS-SEND-TO-LOCOFF-IND       PIC X(01).                   
REARCH     05  WS-CREDIT-LETTER-IND        PIC X(01).                   
C35749     05  WS-ADDR-ST-2                PIC X(55).                   
                                                                        
       01  WS-NEW-ADDR-ID-COMPONENTS.                                   
COB305     05 WS-NEW-ADDR-ID-COMP        PIC S9(13) COMP-3 VALUE 0.           
           05  WS-NEW-ADDR-IDENT           PIC 9(13).                   
                                                                        
       01  COUNTER-FIELDS.                                              
           05  CTR-COLUMN                  PIC S9(9) COMP VALUE 1.      
           05  CTR-ROWS                    PIC S9(9) COMP VALUE 0.      
                                                                        
       01  WORK-FIELDS.                                                 
           05  MAX-LENGTH-PARM             PIC S9(9) COMP.              
           05  WRKLEN1                     PIC S9(9) COMP.              
           05  WRKLEN2                     PIC S9(9) COMP.              
           05  WRK-DONE-STATUS             PIC S9(9) COMP.              
T17989     05  WS-CIA-SUMM-FLAG            PIC X(01) VALUE 'N'.         
T17989     05  WS-CIA-DET1-FLAG            PIC X(01) VALUE 'N'.         
                                                                        
       01  WS-WORK-AREA.                                                
T22772     05  WS-CREDIT-BALANCE           PIC S9(09)V99 COMP-3 VALUE 0.
COB305     05 WS-PREMISE-NO        PIC S9(10)V COMP-3 VALUE 0.          
COB305     05 WS-ACCOUNT-NO        PIC S9(13)V COMP-3 VALUE 0.          
COB305     05 WS-CUSTOMER-NO        PIC S9(10)V COMP-3 VALUE 0.          
           05  WS-TODAYS-DATE              PIC X(10) VALUE SPACES.      
           05  WS-DATE-COMPLETE            PIC X(10) VALUE SPACES.      
           05  WS-SERV-ORDER-NO-C          PIC X(13) VALUE SPACES.      
           05  WS-SERV-ORDER-NO-I REDEFINES WS-SERV-ORDER-NO-C          
                                           PIC 9(13).                   
COB305     05 WS-SERV-ORDER-NO-D        PIC S9(13)V COMP-3 VALUE 0.          
           05  WS-ORDER-TYPE-CD            PIC X(05) VALUE SPACES.      
T22976     05  WS-ORDER-TYPE-CD-2          PIC XX    VALUE SPACES.      
           05  WS-USER-ID                  PIC X(07) VALUE SPACES.      
           05  WS-PASSWORD.                                             
               49  WS-PASSWORD-LEN         PIC S9(4) COMP SYNC VALUE 0. 
               49  WS-PASSWORD-TEXT        PIC X(15) VALUE SPACES.      
           05  WS-SERVER.                                               
               49  WS-SERVER-LEN           PIC S9(4) COMP SYNC VALUE 0. 
               49  WS-SERVER-TEXT          PIC X(17) VALUE SPACES.      
           05  WS-DET-CSS-AR-CNTL.                                      
COB305         10 WS-AC-ACCOUNT-NO        PIC S9(13)V COMP-3 VALUE 0.        
               10  WS-AC-PYMT-PRIORITY-LVL PIC S9(4)     COMP.          
               10  WS-AC-ITEM-ID           PIC S9(9)     COMP.          
               10  WS-SAVE-AC-ITEM-ID      PIC S9(9)     COMP.          
               10  WS-AC-AMT-AR-DAY-00     PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-AMT-AR-DAY-30     PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-AMT-AR-DAY-60     PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-AMT-AR-DAY-90     PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-AMT-UNUSED-CR     PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-AMT-TRAN-BALANCE  PIC S9(09)V99 COMP-3 VALUE 0.
               10  WS-AC-TOT-SUMM-UNBILLED PIC S9(09)V99 COMP-3 VALUE 0.
           05  WS-RCV-TYPE                 PIC X(03)     VALUE SPACES.  
           05  WS-NULL-DT-IND-1            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-3            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-4            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-5            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-7            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-8            PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-10           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-11           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-12           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-13           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-14           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-15           PIC S9(04)    COMP.          
           05  WS-NULL-DT-IND-16           PIC S9(04)    COMP.          
C32832     05  WS-NULL-DATE-NEXT-ANNIV     PIC S9(04)    COMP.          
C32832     05  WS-NULL-DATE-INACTIVE       PIC S9(04)    COMP.          
C32832     05  WS-NULL-DATE-MAILED         PIC S9(04)    COMP.          
           05  WS-DATE-ORIG-PYMT-IND       PIC S9(04)    COMP.          
           05  WS-SAVE-DET-BALANCE         PIC S9(09)V99 VALUE 0.       
           05  WS-SAVE-DO-BALANCE          PIC 9(09)V99  VALUE 0.       
           05  WS-SAVE-DO-INTEREST         PIC 9(09)V99  VALUE 0.       
           05  WS-MONTHS-OF-INTEREST       PIC 9(03)     VALUE 0.       
COB305     05 WS-AMT-ARTOT        PIC S9(09)V99 COMP-3 VALUE 0.        
           05  WS-AMT-MO-PYMT              PIC 9(09)V99.                
T22289     05  WS-AMT-MO-PYMT-C            PIC $$$$$$$$9.99.            
           05  WS-AMT-BILL-FULL            PIC 9(09)V99.                
T22289     05  WS-AMT-BILL-FULL-C          PIC $$$$$$$$9.99.            
           05  WS-TRAN-APPL-NO             PIC S9(04)  USAGE COMP.      
           05  WS-ADDR-COUNT               PIC S9(04)  USAGE COMP.      
           05  WS-NAME-COUNT               PIC S9(04)  USAGE COMP.      
T22066     05  WS-LANDLORD-COUNT           PIC S9(04)  USAGE COMP.      
COB305     05 WS-ADDRESS-ID-MATCH        PIC S9(13)V USAGE COMP-3 
COB305       VALUE 0.    
COB305     05 WS-OLD-ADDRESS-ID        PIC S9(13)V USAGE COMP-3 VALUE 0.    
           05  WS-IND                      PIC S9(04).                  
           05  WS-DFA-TOTAL-ERNST-AMT    PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-DFA-OUTSTANDING        PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-ERNST-DATE             PIC  X(10) VALUE SPACES.       
           05  WS-AR-SUMM-TOTAL          PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AR-DET-TOTAL           PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-DFA-TIMESTAMP          PIC  X(26) VALUE SPACES.       
           05  WS-DFA-ROW-COUNT          PIC S9(04)    COMP   VALUE 0.  
T18175     05  WS-DPP-ROW-COUNT          PIC S9(04)    COMP   VALUE 0.  
           05  WS-JRNL-1ST-ERNST-PAY-AMT                                
                                         PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-JRNL-2ND-ERNST-PAY-AMT                                
                                         PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-JOURNALLING-SW         PIC  X(1)  VALUE 'Y'.          
               88 JOURNALLING            VALUE 'Y'.                     
           05  WS-DFA-RECV-SW            PIC  X(01) VALUE 'N'.          
               88 RECV-DONE                         VALUE 'Y'.          
           05  WS-DFA-ITEM-ID            PIC S9(09)    COMP   VALUE 0.  
           05  WS-MAX-ITEM-ID            PIC S9(09)    COMP   VALUE 0.  
           05  WS-AMT-RECV-ORIG-ENTERED  PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AR-AMT-TRANS           PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AU-AMT-TOTAL           PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AMT-DAY-00             PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AMT-DAY-30             PIC S9(09)V99 COMP-3 VALUE +0. 
           05  WS-AU-AMT-HOLD            PIC S9(09)V99 COMP-3 VALUE +0. 
PCR482     05  WS-TOTAL-PAYMENTS         PIC S9(09)V99 COMP-3 VALUE +0. 
T17639     05  WS-LC-EXISTS              PIC S9(4)     COMP   VALUE 0.  
T17639     05  WS-LC-MESSAGE.                                           
T17639         10  F                           PIC X(51) VALUE          
T17639         'LIGHTING CONTRACT EXISTS FOR AN ACCOUNT THAT HAS AN'.   
T17639         10  F                           PIC X(51) VALUE          
T17639         ' OFF ORDER.  PLEASE REVIEW FOR ADDITIONAL CHARGES. '.   
A37666     05  WS-XF-MESSAGE.                                           
A37666         10  F                           PIC X(54) VALUE          
A37666        'MULTIPLE ACCOUNT TRANSFER TO ACCOUNT HAS FINAL BILLED.'. 
P00547     05  WS-IAT-MESSAGE.                                          
P00547         10  F                           PIC X(51) VALUE          
P00547        'VERIFY OR UPDATE THE INTERNATIONAL ADDRESS ENTERED.'.    
T19715     05 WS-BTU-FACTOR             PIC S9(05)V9(03) COMP-3 VALUE   
                                        0.                              
           05  WS-CNT-ITEM-ID              PIC S9(09) COMP VALUE 0.     
C37422     05  WS-DATETIME-SETUP        PIC X(10).                      
C37422     05  WS-SETUP-TS.                                             
C37422         10  WS-SETUP-TS-DATE     PIC X(10).                      
C37422         10  WS-SETUP-TS-TIME     PIC X(16)                       
C37422                                      VALUE '-00.00.00.000000'.   
                                                                        
C37422 01  WS-RCC-TAX-COMMENTS.                                         
C37422     05  WS-RCCCHG-COMMENTS-TEXT.                                 
C37422         10  FILLER                      PIC X(34)  VALUE         
C37422             'FINAL BILL ACCOUNT HAS PRE-PAY RCC'.                
C37422         10  FILLER                      PIC X(27)  VALUE         
C37422             'NEED TO BE HANDLED MANUALLY'.                       
                                                                        
       01  WS-SAVE-AC-CNTL.                                             
           05 WS-SAVE-ACCOUNT-NO        PIC S9(13)    COMP-3 VALUE 0.   
           05 WS-SAVE-PYMT-PRIORITY-LVL PIC S9(04)    COMP   VALUE 0.   
           05 WS-SAVE-ITEM-ID           PIC S9(09)    COMP   VALUE 0.   
           05 WS-SAVE-AMT-AR-DAY-00     PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-AMT-AR-DAY-30     PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-AMT-AR-DAY-60     PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-AMT-AR-DAY-90     PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-AMT-UNUSED-CR     PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-AMT-TRAN-BALANCE  PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-TOT-SUMM-UNBILLED PIC S9(09)V99 COMP-3 VALUE +0.  
           05 WS-SAVE-LAST-UPDATE-TS    PIC  X(26) VALUE SPACES.        
                                                                        
                                                                        
       01  WS-DATE-TIME-FIELDS.                                         
           05  WS-CURRENT-DATE           PIC X(10) VALUE SPACES.        
           05  WS-CURRENT-TIMESTAMP      PIC X(26) VALUE SPACES.        
           05  WS-PROGRAM-TIMESTAMP      PIC X(26) VALUE SPACES.        
           05  WS-CURRRENT-DATE.                                        
               10  WS-CURRENT-CC         PIC 9(02).                     
               10  WS-CURRENT-YY         PIC 9(02).                     
               10  FILLER                PIC X(01) VALUE SPACES.        
               10  WS-CURRENT-MM         PIC 9(02).                     
               10  FILLER                PIC X(01) VALUE SPACES.        
               10  WS-CURRENT-DD         PIC 9(02).                     
                                                                        
           05  WS-DFA-1ST-ERNST-PAY-DT             VALUE SPACES.        
               10 WS-DFA-DATE-1-MM      PIC  X(02).                     
               10 FILLER                PIC  X(01).                     
               10 WS-DFA-DATE-1-DD      PIC  X(02).                     
               10 FILLER                PIC  X(01).                     
               10 WS-DFA-DATE-1-CC      PIC  X(02).                     
               10 WS-DFA-DATE-1-YY      PIC  X(02).                     
           05 WS-DATE-6.                                                
               10 WS-DATE-6-YY          PIC  X(02).                     
               10 WS-DATE-6-MM          PIC  X(02).                     
               10 WS-DATE-6-DD          PIC  X(02).                     
           05  WS-DATE-6-NUM    REDEFINES WS-DATE-6                     
                                        PIC  9(06).                     
           05  WS-DFA-2ND-ERNST-PAY-DT             VALUE SPACES.        
               10 WS-DFA-DATE-2-MM      PIC  X(02).                     
               10 FILLER                PIC  X(01).                     
               10 WS-DFA-DATE-2-DD      PIC  X(02).                     
               10 FILLER                PIC  X(01).                     
               10 WS-DFA-DATE-2-CC      PIC  X(02).                     
               10 WS-DFA-DATE-2-YY      PIC  X(02).                     
                                                                        
       01  WS-EPP-VARIABLES.                                            
           05  WS-CURR-DATE.                                            
               10  WS-CURR-YYYY             PIC 9(04).                  
               10  FILLER                   PIC X(01) VALUE '-'.        
               10  WS-CURR-MM               PIC 9(02).                  
               10  FILLER                   PIC X(01) VALUE '-'.        
               10  WS-CURR-DD               PIC 9(02).                  
           05  WS-PREV-DATE.                                            
               10  WS-PREV-YYYY          PIC 9(04).                     
               10  FILLER                PIC X(01) VALUE '-'.           
               10  WS-PREV-MM            PIC 9(02).                     
               10  FILLER                PIC X(01) VALUE '-'.           
               10  WS-PREV-DD            PIC 9(02).                     
           05  WS-PREV-DATE-C    REDEFINES WS-PREV-DATE                 
                                         PIC X(10).                     
           05  WS-START-DATE.                                           
               10  WS-SD-YEAR          PIC X(04) VALUE SPACES.          
               10  FILLER              PIC X(01) VALUE SPACES.          
               10  WS-SD-MONTH         PIC X(02) VALUE SPACES.          
               10  FILLER              PIC X(01) VALUE SPACES.          
               10  WS-SD-DAY           PIC X(02) VALUE SPACES.          
           05  WS-ANNIVERSARY-DATE.                                     
               10  WS-AD-YEAR          PIC X(04) VALUE SPACES.          
               10  FILLER              PIC X(01) VALUE SPACES.          
               10  WS-AD-MONTH         PIC X(02) VALUE SPACES.          
               10  FILLER              PIC X(01) VALUE SPACES.          
               10  WS-AD-DAY           PIC X(02) VALUE SPACES.          
           05  WS-AD-MONTH-X           PIC X(02) VALUE SPACES.          
           05  WS-AD-MONTH-RED                                          
                  REDEFINES WS-AD-MONTH-X PIC 9(02).                    
                                                                        
           05  WS-AD-YEAR-X            PIC X(04) VALUE SPACES.          
           05  WS-AD-YEAR-RED                                           
                  REDEFINES WS-AD-YEAR-X  PIC 9(04).                    
           05  WS-YEAR-MONTH1.                                          
               10 WS-YEAR1             PIC 9(04)  VALUE ZERO.           
               10 WS-MONTH1            PIC 9(02)  VALUE ZERO.           
           05  WS-YEAR-MONTH2.                                          
               10 WS-YEAR2             PIC 9(04)  VALUE ZERO.           
               10 WS-MONTH2            PIC 9(02)  VALUE ZERO.           
           05  WS-AC-TOT-SUMM-UNBILLED    PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-AR-DAY-00-EPP       PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-AR-DAY-30-EPP       PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-AR-DAY-60-EPP       PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-AR-DAY-90-EPP       PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-UNUSED-CR-EPP       PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-POSTED              PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-AMT-POSTED-SUM          PIC S9(09)V99 COMP-3 VALUE 0. 
           05  WS-NULL-DT-IND-2           PIC S9(04) COMP VALUE 0.      
           05  WS-REVENUE-MONTH-NULL      PIC S9(04) COMP VALUE 0.      
           05  WS-AMT-POSTED-NULL         PIC S9(04) COMP VALUE 0.      
COB305     05 WS-REVENUE-MONTH        PIC S9(6)V USAGE COMP-3 VALUE 0.      
           05  WS-REVENUE-MONTH-X         PIC X(6) VALUE SPACES.        
           05  WS-PROG-FINAL-BILL-EPP     PIC X(08) VALUE 'PCSSO62C'.   
P00453     05  WS-PROG-FINAL-BILL-PRP     PIC X(08) VALUE 'PCSSO62P'.   
           05  WS-TRANSFER-EPP-DESC       PIC X(28) VALUE               
                                         'TRANSFER TO UTILITY GAS/ELEC'.
           05  WS-113-RECORD-DESC         PIC X(24) VALUE               
                                         'EPP TRANSFER AGING MAINT'.    
COB305     05 WS-RATIO-UTE        PIC S9(01)V9999 COMP-3 VALUE 0.       
COB305     05 WS-RATIO-UTG        PIC S9(01)V9999 COMP-3 VALUE 0.       
COB305     05 WS-AMT-ARUTE        PIC S9(09)V99 COMP-3 VALUE 0.         
COB305     05 WS-AMT-ARUTG        PIC S9(09)V99 COMP-3 VALUE 0.         
           05  WS-UTILITY                 PIC X(01) VALUE SPACES.       
           05  WS-ADD-TO-TOTAL            PIC X(01) VALUE 'N'.          
           05  WS-SUBTRACT-FROM-TOTAL     PIC X(01) VALUE 'N'.          
           05  WS-TEMP-AMT-POSTED         PIC S9(9)V999 COMP-3 VALUE +0.
           05  WS-TEMP-NOT-ROUNDED        PIC S9(9)V999 COMP-3 VALUE +0.
T19476     05  WS-BALANCE-UTL             PIC S9(09)V99 COMP-3 VALUE +0.
T19476     05  WS-UTILITY-BALANCE-UTE     PIC S9(09)V99 COMP-3 VALUE +0.
T19476     05  WS-UTILITY-BALANCE-UTG     PIC S9(09)V99 COMP-3 VALUE +0.
T20243     05  WS-ELEC-REV-ALLOC-PCT      PIC S9(03)V9999 COMP-3        
T20243                                                VALUE +0.         
           05  WS-EPP-BREAKDOWN-DONE      PIC X(01) VALUE 'N'.          
           05  WS-GL-NO-NUM-FORMAT.                                     
               10  WS-GL-FIRST-3-DIGITS   PIC 9(03).                    
               10  WS-GL-DECIMAL          PIC X(01).                    
               10  WS-GL-LAST-4-DIGITS    PIC 9(04).                    
                                                                        
       01  WS-MISCELLANEOUS.                                            
           05  WS-1                      PIC 9(01) VALUE 1.             
           05  WS-9                      PIC 9(01) VALUE 9.             
           05  WS-19                     PIC 9(02) VALUE 19.            
           05  WS-20                     PIC 9(02) VALUE 20.            
           05  WS-29                     PIC 9(02) VALUE 29.            
           05  WS-30                     PIC 9(02) VALUE 30.            
           05  WS-39                     PIC 9(02) VALUE 39.            
           05  WS-40                     PIC 9(02) VALUE 40.            
           05  WS-45                     PIC 9(02) VALUE 45.            
           05  WS-50                     PIC 9(02) VALUE 50.            
           05  WS-60                     PIC 9(02) VALUE 60.            
           05  WS-70                     PIC 9(02) VALUE 70.            
           05  WS-80                     PIC 9(02) VALUE 80.            
           05  WS-90                     PIC 9(02) VALUE 90.            
           05  WS-100                    PIC 9(03) VALUE 100.           
AS0996     05  WS-105                    PIC 9(03) VALUE 105.           
           05  WS-103                    PIC 9(03) VALUE 103.           
           05  WS-113                    PIC 9(03) VALUE 113.           
           05  WS-129                    PIC 9(03) VALUE 129.           
           05  WS-999                    PIC 9(03) VALUE 999.           
           05  WS-MULTIPLE-ROWS-CALL     PIC S9(3) VALUE -811.          
           05  WS-A                      PIC X(01) VALUE 'A'.           
           05  WS-B                      PIC X(01) VALUE 'B'.           
           05  WS-C                      PIC X(01) VALUE 'C'.           
           05  WS-D                      PIC X(01) VALUE 'D'.           
           05  WS-E                      PIC X(01) VALUE 'E'.           
           05  WS-F                      PIC X(01) VALUE 'F'.           
           05  WS-G                      PIC X(01) VALUE 'G'.           
           05  WS-I                      PIC X(01) VALUE 'I'.           
           05  WS-J                      PIC X(01) VALUE 'J'.           
           05  WS-K                      PIC X(01) VALUE 'K'.           
           05  WS-L                      PIC X(01) VALUE 'L'.           
           05  WS-M                      PIC X(01) VALUE 'M'.           
           05  WS-P                      PIC X(01) VALUE 'P'.           
           05  WS-R                      PIC X(01) VALUE 'R'.           
           05  WS-S                      PIC X(01) VALUE 'S'.           
           05  WS-T                      PIC X(01) VALUE 'T'.           
           05  WS-CNT                    PIC X(03) VALUE 'CNT'.         
           05  WS-DFA                    PIC X(03) VALUE 'DFA'.         
           05  WS-DNPFB                  PIC X(05) VALUE 'DNPFB'.       
           05  WS-NO                     PIC X(01) VALUE 'N'.           
           05  WS-YES                    PIC X(01) VALUE 'Y'.           
           05  WS-TERM-TRAN              PIC X(04) VALUE 'S062'.        
T18786     05  WS-PREVIOUS-DATE          PIC X(10) VALUE SPACES.        
           05  WS-FB-TRAN-COMMENT        PIC X(25) VALUE                
                                         'NEW ADDRESS ID GENERATED'.    
           05  WS-FB-TRAN-COMMENT-LEN    PIC S9(04) COMP VALUE +25.     
T24436     05  WS-EIBRESP                PIC S9(8) COMP SYNC VALUE ZERO.
           05  WS-CASH-DRAWER.                                          
               10  WS-CD-COMPANY-NO      PIC X(02).                     
               10  WS-CD-LOCAL-OFFICE    PIC X(03).                     
               10  WS-CD-REPORT-NO       PIC X(03).                     
               10  WS-CD-REPORT-DATE     PIC X(10).                     
               10  WS-CASH-DRAWER-ID     PIC S9(04) COMP.               
           05  WS-113-RECORD-DESC        PIC X(24) VALUE                
                                         'EPP TRANSFER AGING MAINT'.    
           05  WS-CODES-EPP-CHECK.                                      
               10  FILLER                PIC X(02).                     
               10  WS-EPP-IND            PIC X(01) VALUE 'N'.           
               10  FILLER                PIC X(29).                     
                                                                        
P00453     05  WS-CODES-PRP-CHECK.                                      
P00453         10  FILLER                PIC X(14).                     
P00453         10  WS-PRP-IND            PIC X(01) VALUE 'N'.           
P00453         10  FILLER                PIC X(17).                     
                                                                        
           05  WS-RCV-MAINT.                                            
               10  WS-DEP-LITERAL        PIC X(04)     VALUE 'DEP'.     
               10  WS-DEP-ID-NO          PIC 9(07).                     
               10  WS-AGING-ADJUSTED-LITERAL PIC X(18) VALUE            
                   ' AGING ADJUSTED'.                                   
                                                                        
COB305     05 WS-AMT-DEPOSIT        PIC S9(7)V99 USAGE COMP-3 VALUE 0.       
COB305     05 WS-AMT-REFUNDED        PIC S9(9)V99 USAGE COMP-3 VALUE 0.       
COB305     05 WS-HOLD-ACCOUNT-NO        PIC S9(13)V COMP-3 VALUE 0.             
           05  WS-ACCT-CHG-JRNL-DONE   PIC X(01)  VALUE 'N'.            
           05  WS-JRNL-WRITTEN         PIC X(01)  VALUE 'N'.            
T18441     05 WS-CURR-PYMT-PRIORITY-LVL PIC  S9(4) USAGE COMP.          
T18441     05 WS-UTE-OR-UTG-EXISTS      PIC  X(01) VALUE SPACES.        
T18441     05 WS-UTE-EXISTS             PIC  X(01) VALUE SPACES.        
T18441     05 WS-UTG-EXISTS             PIC  X(01) VALUE SPACES.        
T21446     05 WS-CNT-NAME-CD-LITE       PIC  S9(04) COMP VALUE 407.     
T21446     05 WS-COMMENTS               PIC  X(26) VALUE                
T21446                                  'SERVICE ORDER - FINAL BILL'.   
T21446     05 WS-UMCNTRCT-FOUND         PIC X(01) VALUE 'N'.            
T21446        88 UMCNTRCT-DATA-FOUND              VALUE 'Y'.            
T22303     05 WS-CNTRCT-CREATED         PIC X(01) VALUE SPACES.         
T22976     05 WS-FETCH-SQLCODE          PIC S9(9) VALUE +000 COMP.      
T22772     05 WS-CIA-EXISTS             PIC X     VALUE 'Y'.            
T23387     05 WS-RCC-EXISTS             PIC X     VALUE 'N'.            
T23010     05 WS-END-OF-PROCESS-DFA     PIC X(01) VALUE 'N'.            
C35749     05 WS-FORMATTED-ADDED        PIC X(01) VALUE 'N'.            
C35749     05 WS-FREEFORM-ADDED         PIC X(01) VALUE 'N'.            
C35749     05 WS-ADDR-ID-ADDED          PIC 9(13) VALUE ZEROES.         
C37422     05 WS-FCTRROW-EXIST          PIC X(01) VALUE 'N'.            
                                                                        
       01  SWITCHES.                                                    
           05  ALL-DONE-SW             PIC X(01) VALUE 'N'.             
               88 NOT-ALL-DONE                   VALUE 'N'.             
               88 ALL-DONE                       VALUE 'Y'.             
           05  SEND-DONE-SW            PIC X(01) VALUE 'Y'.             
               88 SEND-DONE-ERROR                VALUE 'N'.             
               88 SEND-DONE-OK                   VALUE 'Y'.             
                                                                        
       01  TDS-RETURN-FIELDS.                                           
           05  RS-RETURN-CODE            PIC S9(9) COMP VALUE 0.        
REARCH     05  S-RETURN-CODE             PIC S9(9) COMP VALUE 0.        
REARCH     05  MCSCO061                  PIC X(8) VALUE 'MCSCO061'.     
                                                                        
       01  WS-FLAGS.                                                    
           05  SW-RESULTS                PIC X(01) VALUE 'Y'.           
               88 NO-MORE-RESULTS                  VALUE 'N'.           
               88 MORE-RESULTS                     VALUE 'Y'.           
           05  SW-FETCH                  PIC X(01) VALUE 'Y'.           
               88 NO-MORE-ROWS                     VALUE 'N'.           
               88 MORE-ROWS                        VALUE 'Y'.           
           05  WS-ROWS-FOUND             PIC X(01) VALUE 'N'.           
               88 NO-ROWS-FOUND                    VALUE 'N'.           
               88 ROWS-FOUND                       VALUE 'Y'.           
           05  WS-NO-MORE-CREDIT         PIC X(01) VALUE 'N'.           
               88 NO-MORE-CREDIT                   VALUE 'Y'.           
           05  WS-CNSMPTN-HIST-WAS-FOUND PIC X(01) VALUE 'N'.           
               88 CNSMPTN-HIST-WAS-FOUND           VALUE 'Y'.           
           05  WS-CERT-ISSUED            PIC X(01) VALUE 'N'.           
               88 CERT-ISSUED                      VALUE 'Y'.           
           05  WS-DEP-DET-EXISTS         PIC X(01) VALUE 'N'.           
               88 DEP-DET-EXISTS                   VALUE 'Y'.           
           05  WS-BILL-ADDR-XREF-EXISTS  PIC X(01) VALUE 'N'.           
               88 BILL-ADDR-XREF-EXISTS            VALUE 'Y'.           
           05  WS-ADDR-FREEFORM-EXISTS   PIC X(01) VALUE 'N'.           
               88 ADDR-FREEFORM-EXISTS             VALUE 'Y'.           
           05  WS-ADDR-FORMATTED-EXISTS  PIC X(01) VALUE 'N'.           
               88 ADDR-FORMATTED-EXISTS            VALUE 'Y'.           
           05  WS-FORM-ADDR-MATCHED      PIC X(01) VALUE 'N'.           
               88 FORM-ADDR-MATCHED                VALUE 'Y'.           
           05  WS-PPL-TABLE-LOADED       PIC X(01) VALUE 'N'.           
               88 PPL-TABLE-LOADED                 VALUE 'Y'.           
           05  WS-ACTIVE-DEP-EXISTS      PIC X(01) VALUE 'N'.           
               88 ACTIVE-DEP-EXISTS                VALUE 'Y'.           
           05  WS-PROCESS-CNT-XFER       PIC X(01) VALUE 'N'.           
T17984     05  WS-RCC-FOUND              PIC X(01) VALUE 'N'.           
P00547     05  WS-IAT-CAT-FOUND          PIC X(01) VALUE 'N'.           
                                                                        
PCR393 01  WS-PCR393-VARIABLES.                                         
PCR393     05  WS-HOLD-COMMENTS          PIC X(50).                     
PCR393     05  WS-XFR-FROM-COMMENT       PIC X(12) VALUE 'XFR FROM DPP'.
PCR393     05  WS-FOUND-CNT-NAME         PIC X(01) VALUE 'N'.           
PCR393     05  SUB-RECV                  PIC S9(04) COMP.               
PCR393                                                                  
PCR393 01  CNT-TABLE.                                                   
PCR393     05  TB-CNT                    OCCURS 20 TIMES.               
PCR393         10   TB-CNT-ITEM-ID   PIC S9(09) COMP VALUE 0.           
PCR393         10   TB-CNT-NAME-CD   PIC S9(04) COMP VALUE 0.           
PCR393         10   TB-CODE-CNT-TYPE PIC X(01).                         
                                                                        
T20243 01  WS-FLAGS.                                                    
T20243     05  WS-UTE-SW                PIC X(01) VALUE 'N'.            
T20243         88 UTE-EXISTS                      VALUE 'Y'.            
T20243     05  WS-ELECGAS-EXISTS        PIC X(01).                      
T20243     05  WS-UTG-SW                PIC X(01) VALUE 'N'.            
T20243         88 UTG-EXISTS                      VALUE 'Y'.            
T20243     05  WS-UNMETERED-SW          PIC X(01) VALUE 'N'.            
T20243         88 UNMETERED-EXISTS                VALUE 'Y'.            
       01  WS-END                        PIC X(40)                      
REARCH     VALUE 'WORKING STORAGE FOR MCSSO062 ENDS HERE  '.            
                                                                        
      ****************************************************************          
      * DECLARE SQL CURSORS.                                         *          
      ****************************************************************          
           EXEC SQL                                                     
              DECLARE SUMM-AR-CNTL CURSOR FOR                           
                 SELECT AMT_AR_DAY_00    ,                              
                        AMT_AR_DAY_30    ,                              
                        AMT_AR_DAY_60    ,                              
                        AMT_AR_DAY_90    ,                              
                        AMT_UNUSED_CR    ,                              
                        TOT_SUMM_UNBILLED,                              
                        PYMT_PRIORITY_LVL                               
                   FROM CSS_AR_CNTL                                     
                  WHERE ACCOUNT_NO    = :AC-ACCOUNT-NO                  
                    AND ITEM_ID       = :AC-ITEM-ID                     
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE SUMM-AR-CNTL CURSOR FOR                                   
MFA-TR*          SELECT AMT_AR_DAY_00    ,                                      
MFA-TR*                 AMT_AR_DAY_30    ,                                      
MFA-TR*                 AMT_AR_DAY_60    ,                                      
MFA-TR*                 AMT_AR_DAY_90    ,                                      
MFA-TR*                 AMT_UNUSED_CR    ,                                      
MFA-TR*                 TOT_SUMM_UNBILLED,                                      
MFA-TR*                 PYMT_PRIORITY_LVL                                       
MFA-TR*            FROM CSS_AR_CNTL                                             
MFA-TR*           WHERE ACCOUNT_NO    = :AC-ACCOUNT-NO                          
MFA-TR*             AND ITEM_ID       = :AC-ITEM-ID                             
MFA-TR*           QUERYNO 7000                                                  
MFA-TR*    END-EXEC.                                                            
                                                                        
           EXEC SQL                                                     
              DECLARE DET-AR-CNTL CURSOR FOR                            
                 SELECT AMT_AR_DAY_00   ,                               
                        AMT_AR_DAY_30   ,                               
                        AMT_AR_DAY_60   ,                               
                        AMT_AR_DAY_90   ,                               
                        AMT_TRAN_BALANCE,                               
                        ITEM_ID                                         
                   FROM CSS_AR_CNTL                                     
                  WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO           
                    AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL    
                    AND ITEM_ID           > :WS-AC-ITEM-ID              
               ORDER BY AMT_TRAN_BALANCE                                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE DET-AR-CNTL CURSOR FOR                                    
MFA-TR*          SELECT AMT_AR_DAY_00   ,                                       
MFA-TR*                 AMT_AR_DAY_30   ,                                       
MFA-TR*                 AMT_AR_DAY_60   ,                                       
MFA-TR*                 AMT_AR_DAY_90   ,                                       
MFA-TR*                 AMT_TRAN_BALANCE,                                       
MFA-TR*                 ITEM_ID                                                 
MFA-TR*            FROM CSS_AR_CNTL                                             
MFA-TR*           WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO                   
MFA-TR*             AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL            
MFA-TR*             AND ITEM_ID           > :WS-AC-ITEM-ID                      
MFA-TR*        ORDER BY AMT_TRAN_BALANCE                                        
MFA-TR*        QUERYNO 7010                                                     
MFA-TR*    END-EXEC.                                                            
                                                                        
           EXEC SQL                                                     
              DECLARE CSS-BILLING-DET CURSOR FOR                        
                 SELECT CODE_UTIL_TYPE,                                 
                        IC_NO         ,                                 
                        CODE_BILL_ITM_IND,                              
                        REVENUE_MONTH,                                  
                        BTU_FACTOR                                      
                   FROM CSS_BILLING_DET                                 
                  WHERE ACCOUNT_NO = :BG-ACCOUNT-NO                     
                    AND BILL_NO    = :BG-BILL-NO                        
T19715              FOR UPDATE OF BTU_FACTOR                            
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE CSS-BILLING-DET CURSOR FOR                                
MFA-TR*          SELECT CODE_UTIL_TYPE,                                         
MFA-TR*                 IC_NO         ,                                         
MFA-TR*                 CODE_BILL_ITM_IND,                                      
MFA-TR*                 REVENUE_MONTH,                                          
MFA-TR*                 BTU_FACTOR                                              
MFA-TR*            FROM CSS_BILLING_DET                                         
MFA-TR*           WHERE ACCOUNT_NO = :BG-ACCOUNT-NO                             
MFA-TR*             AND BILL_NO    = :BG-BILL-NO                                
MFA-TR*             FOR UPDATE OF BTU_FACTOR                                    
MFA-TR*           QUERYNO 7020                                                  
MFA-TR*    END-EXEC.                                                            
                                                                        
           EXEC SQL                                                     
              DECLARE CSS-DEP-ON-HAND CURSOR FOR                        
                 SELECT DEPOSIT_CERT_NO   ,                             
                        AMT_DEPOSIT       ,                             
                        DEPOSIT_STATUS_CD ,                             
                        DATE_CERT_ISSUE   ,                             
                        TOTAL_INTRST      ,                             
                        DATE_REFUNDED     ,                             
                        DATE_INTST_CALC_TO,                             
                        DATEADD( DAY, 1, DATE_INTST_CALC_TO ),                  
                        CODE_REFUND_STATUS,                             
                        INTRST_YTD        ,                             
C30300                  AMT_REFUNDED                                    
                   FROM CSS_DEP_ON_HAND                                 
                  WHERE ACCOUNT_NO = :DO-ACCOUNT-NO                     
                    AND (DEPOSIT_STATUS_CD = 'A'                        
                     OR  DEPOSIT_STATUS_CD = 'P')                       
                 ORDER BY DEPOSIT_STATUS_CD                             
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ044
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE CSS-DEP-ON-HAND CURSOR FOR                                
MFA-TR*          SELECT DEPOSIT_CERT_NO   ,                                     
MFA-TR*                 AMT_DEPOSIT       ,                                     
MFA-TR*                 DEPOSIT_STATUS_CD ,                                     
MFA-TR*                 DATE_CERT_ISSUE   ,                                     
MFA-TR*                 TOTAL_INTRST      ,                                     
MFA-TR*                 DATE_REFUNDED     ,                                     
MFA-TR*                 DATE_INTST_CALC_TO,                                     
MFA-TR*                 DATE_INTST_CALC_TO + 1 DAY,                             
MFA-TR*                 CODE_REFUND_STATUS,                                     
MFA-TR*                 INTRST_YTD        ,                                     
MFA-TR*                 AMT_REFUNDED                                            
MFA-TR*            FROM CSS_DEP_ON_HAND                                         
MFA-TR*           WHERE ACCOUNT_NO = :DO-ACCOUNT-NO                             
MFA-TR*             AND (DEPOSIT_STATUS_CD = 'A'                                
MFA-TR*              OR  DEPOSIT_STATUS_CD = 'P')                               
MFA-TR*          ORDER BY DEPOSIT_STATUS_CD                                     
MFA-TR*          QUERYNO 7030                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
           EXEC SQL                                                     
              DECLARE ACTIVE-DEP-ON-HAND CURSOR FOR                     
                 SELECT 'Y'                                             
                   FROM CSS_DEP_ON_HAND                                 
                  WHERE ACCOUNT_NO        = :DO-ACCOUNT-NO              
PCR482              AND (DEPOSIT_STATUS_CD = :WS-A                      
PCR482               OR  DEPOSIT_STATUS_CD = 'P')                       
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE ACTIVE-DEP-ON-HAND CURSOR FOR                             
MFA-TR*          SELECT 'Y'                                                     
MFA-TR*            FROM CSS_DEP_ON_HAND                                         
MFA-TR*           WHERE ACCOUNT_NO        = :DO-ACCOUNT-NO                      
MFA-TR*             AND (DEPOSIT_STATUS_CD = :WS-A                              
MFA-TR*              OR  DEPOSIT_STATUS_CD = 'P')                               
MFA-TR*          QUERYNO 7050                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
           EXEC SQL                                                     
             DECLARE DFA-REC-CURSOR  CURSOR FOR                         
              SELECT ACCOUNT_NO       ,                                 
                     PYMT_PRIORITY_LVL,                                 
                     AGREEMENT_NO     ,                                 
                     AMT_CONTRACT_DEFR,                                 
                     AMT_DAY_00       ,                                 
                     AMT_DAY_30       ,                                 
                     AMT_DAY_60       ,                                 
                     AMT_DAY_90       ,                                 
                     DFA_PYMT_PRIORITY,                                 
                     CNT_ITEM_ID                                        
                FROM CSS_DFA_RECVBLE                                    
               WHERE ACCOUNT_NO         = :DV-ACCOUNT-NO                
                 AND PYMT_PRIORITY_LVL  = 90                            
                 AND DFA_PYMT_PRIORITY <> 90                            
                 AND AGREEMENT_NO       = :DV-AGREEMENT-NO              
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*      DECLARE DFA-REC-CURSOR  CURSOR FOR                                 
MFA-TR*       SELECT ACCOUNT_NO       ,                                         
MFA-TR*              PYMT_PRIORITY_LVL,                                         
MFA-TR*              AGREEMENT_NO     ,                                         
MFA-TR*              AMT_CONTRACT_DEFR,                                         
MFA-TR*              AMT_DAY_00       ,                                         
MFA-TR*              AMT_DAY_30       ,                                         
MFA-TR*              AMT_DAY_60       ,                                         
MFA-TR*              AMT_DAY_90       ,                                         
MFA-TR*              DFA_PYMT_PRIORITY,                                         
MFA-TR*              CNT_ITEM_ID                                                
MFA-TR*         FROM CSS_DFA_RECVBLE                                            
MFA-TR*        WHERE ACCOUNT_NO         = :DV-ACCOUNT-NO                        
MFA-TR*          AND PYMT_PRIORITY_LVL  = 90                                    
MFA-TR*          AND DFA_PYMT_PRIORITY <> 90                                    
MFA-TR*          AND AGREEMENT_NO       = :DV-AGREEMENT-NO                      
MFA-TR*          QUERYNO 6681                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
PCR393     EXEC SQL                                                     
PCR393       DECLARE CNT-NAME-CURSOR CURSOR FOR                         
PCR393        SELECT DV.CNT_ITEM_ID,                                    
PCR393               CT.CNT_NAME_CD,                                    
PCR393               CT.CODE_CONTRACT_TYPE                              
PCR393          FROM CSS_DFA_RECVBLE DV,                                
PCR393               CSS_CONTRACT    CT                                 
PCR393         WHERE DV.ACCOUNT_NO         = :DV-ACCOUNT-NO             
PCR393           AND DV.PYMT_PRIORITY_LVL  = :DV-PYMT-PRIORITY-LVL      
PCR393           AND DV.ACCOUNT_NO         = CT.ACCOUNT_NO              
PCR393           AND DV.DFA_PYMT_PRIORITY  = CT.PYMT_PRIORITY_LVL       
PCR393           AND DV.CNT_ITEM_ID        = CT.CNT_ITEM_ID             
                                                            
PCR393     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*      DECLARE CNT-NAME-CURSOR CURSOR FOR                                 
MFA-TR*       SELECT DV.CNT_ITEM_ID,                                            
MFA-TR*              CT.CNT_NAME_CD,                                            
MFA-TR*              CT.CODE_CONTRACT_TYPE                                      
MFA-TR*         FROM CSS_DFA_RECVBLE DV,                                        
MFA-TR*              CSS_CONTRACT    CT                                         
MFA-TR*        WHERE DV.ACCOUNT_NO         = :DV-ACCOUNT-NO                     
MFA-TR*          AND DV.PYMT_PRIORITY_LVL  = :DV-PYMT-PRIORITY-LVL              
MFA-TR*          AND DV.ACCOUNT_NO         = CT.ACCOUNT_NO                      
MFA-TR*          AND DV.DFA_PYMT_PRIORITY  = CT.PYMT_PRIORITY_LVL               
MFA-TR*          AND DV.CNT_ITEM_ID        = CT.CNT_ITEM_ID                     
MFA-TR*          QUERYNO 6650                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
T17746     EXEC SQL                                                     
T17746        DECLARE TOT-AR-CNTL CURSOR FOR                            
T17746        SELECT ITEM_ID          ,                                 
T17746               PYMT_PRIORITY_LVL,                                 
T17746               AMT_AR_DAY_00    ,                                 
T17746               AMT_AR_DAY_30    ,                                 
T17746               AMT_AR_DAY_60    ,                                 
T17746               AMT_AR_DAY_90    ,                                 
T17746               AMT_UNUSED_CR    ,                                 
T17746               AMT_TRAN_BALANCE                                   
T17746          FROM CSS_AR_CNTL                                        
T17746         WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
T17746           AND PYMT_PRIORITY_LVL IN (80,90)                       
T17746           AND ITEM_ID           > 0                              
                                                            
T17746     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE TOT-AR-CNTL CURSOR FOR                                    
MFA-TR*       SELECT ITEM_ID          ,                                         
MFA-TR*              PYMT_PRIORITY_LVL,                                         
MFA-TR*              AMT_AR_DAY_00    ,                                         
MFA-TR*              AMT_AR_DAY_30    ,                                         
MFA-TR*              AMT_AR_DAY_60    ,                                         
MFA-TR*              AMT_AR_DAY_90    ,                                         
MFA-TR*              AMT_UNUSED_CR    ,                                         
MFA-TR*              AMT_TRAN_BALANCE                                           
MFA-TR*         FROM CSS_AR_CNTL                                                
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL IN (80,90)                               
MFA-TR*          AND ITEM_ID           > 0                                      
MFA-TR*          QUERYNO 7991                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
T22976     EXEC SQL                                                     
T22976        DECLARE LIGHT-CURSOR CURSOR FOR                           
T22976        SELECT IC_NO                                              
T22976          FROM CSS_UTIL_ENVRNMT                                   
T22976         WHERE ACCOUNT_NO        = :UT-ACCOUNT-NO                 
T22976           AND CODE_UTIL_TYPE    = 'U'                            
T22976           AND RATE_PLAN_NO      IN ('025', '026',                
A00759                                     '017', '018',                
A00759                                     '062', '067')                
                                                            
T22976     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE LIGHT-CURSOR CURSOR FOR                                   
MFA-TR*       SELECT IC_NO                                                      
MFA-TR*         FROM CSS_UTIL_ENVRNMT                                           
MFA-TR*        WHERE ACCOUNT_NO        = :UT-ACCOUNT-NO                         
MFA-TR*          AND CODE_UTIL_TYPE    = 'U'                                    
MFA-TR*          AND RATE_PLAN_NO      IN ('025', '026',                        
MFA-TR*                                    '017', '018',                        
MFA-TR*                                    '062', '067')                        
MFA-TR*          QUERYNO 7900                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
T22772     EXEC SQL                                                     
T22772        DECLARE AMT-TRAN CURSOR FOR                               
T22772        SELECT AMT_TRAN_BALANCE                                   
T22772          FROM CSS_AR_CNTL                                        
T22772         WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
T22772           AND ITEM_ID           > 0                              
T22772           AND PYMT_PRIORITY_LVL = 60                             
T22772           AND AMT_TRAN_BALANCE  < 0                              
T22772         FOR UPDATE OF AMT_TRAN_BALANCE                           
                                                            
T22772     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE AMT-TRAN CURSOR FOR                                       
MFA-TR*       SELECT AMT_TRAN_BALANCE                                           
MFA-TR*         FROM CSS_AR_CNTL                                                
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND ITEM_ID           > 0                                      
MFA-TR*          AND PYMT_PRIORITY_LVL = 60                                     
MFA-TR*          AND AMT_TRAN_BALANCE  < 0                                      
MFA-TR*        FOR UPDATE OF AMT_TRAN_BALANCE                                   
MFA-TR*          QUERYNO 7060                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
C32832     EXEC SQL                                                     
C32832        DECLARE THD-PRTY-CURSOR CURSOR FOR                        
C32832        SELECT THD_PRTY_ID,                                       
C32832               THD_PRTY_STATUS,                                   
C32832               DATE_INACTIVE,                                     
C32832               DATE_NEXT_ANNIV                                    
C32832          FROM CSS_THD_PRTY                                       
C32832        WHERE ACCOUNT_NO = :ZW-ACCOUNT-NO                         
C32832          AND THD_PRTY_STATUS = 'A'                               
                                                            
C32832     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE THD-PRTY-CURSOR CURSOR FOR                                
MFA-TR*       SELECT THD_PRTY_ID,                                               
MFA-TR*              THD_PRTY_STATUS,                                           
MFA-TR*              DATE_INACTIVE,                                             
MFA-TR*              DATE_NEXT_ANNIV                                            
MFA-TR*         FROM CSS_THD_PRTY                                               
MFA-TR*       WHERE ACCOUNT_NO = :ZW-ACCOUNT-NO                                 
MFA-TR*         AND THD_PRTY_STATUS = 'A'                                       
MFA-TR*        QUERYNO 7940                                                     
MFA-TR*    END-EXEC.                                                            
                                                                        
C32832     EXEC SQL                                                     
C32832        DECLARE TP-HIST-CURSOR CURSOR FOR                         
C32832            SELECT REPLACE(REPLACE(CONVERT(CHAR(26), DATE_TRANS
           , 121), ' ', '-'), ':', '.') DATE_TRANS,                            
C32832                   LETTER_TYPE_CD,                                
C32832                   LETTER_STATUS                                  
C32832             FROM CSS_THD_PRTY_HIST                               
C32832            WHERE THD_PRTY_ID = :ZX-THD-PRTY-ID                   
C32832             AND CAST(DATE_TRANS AS DATE) =IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )               
                                                            
C32832     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ029
MFA-TR* MSQ054
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE TP-HIST-CURSOR CURSOR FOR                                 
MFA-TR*           SELECT DATE_TRANS,                                            
MFA-TR*                  LETTER_TYPE_CD,                                        
MFA-TR*                  LETTER_STATUS                                          
MFA-TR*            FROM CSS_THD_PRTY_HIST                                       
MFA-TR*           WHERE THD_PRTY_ID = :ZX-THD-PRTY-ID                           
MFA-TR*            AND DATE(DATE_TRANS) =:WS-CURRENT-DATE                       
MFA-TR*          QUERYNO 7965                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
REARCH     EXEC SQL                                                     
REARCH        DECLARE CSS-SO-FB-UMCNTRCT CURSOR FOR                     
REARCH           SELECT REV_INSTALL_AMT,                                
REARCH                  IC_NO                                           
REARCH             FROM CSS_SO_FB_UMCNTRCT                              
REARCH            WHERE SERV_ORDER_NO = :WS-SERV-ORDER-NO-D             
                                                            
REARCH     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE CSS-SO-FB-UMCNTRCT CURSOR FOR                             
MFA-TR*          SELECT REV_INSTALL_AMT,                                        
MFA-TR*                 IC_NO                                                   
MFA-TR*            FROM CSS_SO_FB_UMCNTRCT                                      
MFA-TR*           WHERE SERV_ORDER_NO = :WS-SERV-ORDER-NO-D                     
MFA-TR*          QUERYNO 5221                                                   
MFA-TR*    END-EXEC.                                                            
                                                                        
       LINKAGE SECTION.                                                 
REARCH     COPY CCA00004.                                                       
                                                                        
REARCH PROCEDURE DIVISION USING  CMN-SO100-LINK-AREA.                   

SCA006        SET WS-GL-SUB TO 1.
      ******************************************************************        
      * 0000-MAINLINE                                                  *        
      * CONTROLS THE MAIN PATH OF THE PROGRAM                          *        
      ******************************************************************        
       0000-MAINLINE.                                                   
                                                                        
           PERFORM 0100-INITIALIZATION        THRU 0100-EXIT.           
           PERFORM 0110-INIT-CWS00007-FLDS    THRU 0110-EXIT.           
           PERFORM 0115-INIT-CWS00008-FLDS    THRU 0115-EXIT.           
           PERFORM 0135-INIT-CWS00027-FLDS    THRU 0135-EXIT.           
           PERFORM 0150-INIT-CWS00303-FLDS    THRU 0150-EXIT.           
           PERFORM 0155-INIT-CWS00013-FLDS    THRU 0155-EXIT.           
           PERFORM 0160-INIT-CJF00101-FLDS    THRU 0160-EXIT.           
           PERFORM 0170-INIT-CJF00103-FLDS    THRU 0170-EXIT.           
           PERFORM 0180-INIT-CJF00105-FLDS    THRU 0180-EXIT.           
           PERFORM 0185-INIT-CJF00113-FLDS    THRU 0185-EXIT.           
           PERFORM 0205-INIT-CWS00010-FLDS    THRU 0205-EXIT.           
           PERFORM 0215-INIT-CWS00056-FLDS    THRU 0215-EXIT.           
                                                                        
           PERFORM 1000-PROCESS-INPUT         THRU 1000-EXIT.           
           PERFORM 2000-PROCESS-OUTPUT        THRU 2000-EXIT.           
           PERFORM 9600-TERMINATE-LINK        THRU 9600-EXIT.           
                                                                        
       0000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 0100-INITIALIZATION                                            *        
      * INITIALIZES ALL WORKING STORAGE FIELDS AND DB2 HOST VARIABLES  *        
      * EACH TIME THIS SUBROUTINE IS CALLED.                           *        
      * PERFORMED BY 0000-MAINLINE.                                    *        
      ******************************************************************        
       0100-INITIALIZATION.                                             
                                                                        
           MOVE '0100'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           MOVE LOW-VALUES               TO DCLCSS-ACCOUNT              
                                            DCLCSS-ADDR-FORMATTED       
                                            DCLCSS-ADDR-FREEFORM        
                                            DCLCSS-ADDR-ID-CNTL         
                                            DCLCSS-AR-CNTL              
                                            DCLCSS-AR-PMT-PRTY          
                                            DCLCSS-AR-TRANS-HIST        
                                            DCLCSS-AR-TRN-HST-DET       
                                            DCLCSS-BATCH-JRNL           
                                            DCLCSS-BCH-JRNL-CNTL        
                                            DCLCSS-BILL-ADDR-XREF       
                                            DCLCSS-BILLING-DET          
                                            DCLCSS-BILLING-HDR          
                                            DCLCSS-BUDGET-HIST          
                                            DCLCSS-BUDGET-PLAN          
                                            DCLCSS-CHRG-OFF             
                                            DCLCSS-CNSMPTN-HIST         
                                            DCLCSS-CONTRACT             
                                            DCLCSS-CREDIT-PROFILE       
                                            DCLCSS-CSH-DRWR-CNTL        
                                            DCLCSS-CSH-DRWR-JRNL        
                                            DCLCSS-CUSTOMER             
                                            DCLCSS-DEP-INT-RATE         
                                            DCLCSS-DEP-PAY-HST          
                                            DCLCSS-DEP-ON-HAND          
                                            DCLCSS-DFA-ACCT             
                                            DCLCSS-DFA-RECVBLE          
                                            DCLCSS-GL-ACCT-NO           
                                            DCLCSS-MISC-JRNL            
                                            DCLCSS-MNT-TRANS-HIST       
                                            DCLCSS-MT-TRN-HST-DET       
                                            DCLCSS-NAME-ACCT-XREF       
                                            DCLCSS-OFF-CYCL-ACCT        
                                            DCLCSS-PREMISE              
                                            DCLCSS-RECONNECT            
                                            DCLCSS-USER-PROFILE.        
                                                                        
           MOVE 0                        TO WS-SAVE-DET-BALANCE         
                                            WS-SAVE-DO-INTEREST         
                                            WS-MONTHS-OF-INTEREST.      
T21446     PERFORM 7200-SELECT-TIMESTAMP THRU 7200-EXIT.                
                                                                        
       0100-EXIT.                                                       
           EXIT.                                                        
                                                                        
           COPY CPD0007B.                                                       
           COPY CPD0009B.                                                       
           COPY CPD0027B.                                                       
           COPY CPD0303B.                                                       
           COPY CPD0013B.                                                       
           COPY CPD0101B.                                                       
           COPY CPD0103B.                                                       
           COPY CPD0105B.                                                       
           COPY CPD0113B.                                                       
           COPY CPDX010B.                                                       
           COPY CPD0056B.                                                       
                                                                        
      ******************************************************************        
      * 1000-PROCESS-INPUT                                             *        
      * RECEIVES INPUT AND CONTROLS EDITING AND PROCESSING OF IT.      *        
      * PERFORMED BY 0000-MAINLINE.                                    *        
      ******************************************************************        
       1000-PROCESS-INPUT.                                              
                                                                        
           MOVE '1000'                        TO ACTIVE-PARAGRAPH.      
                                                                        
REARCH     PERFORM 1100-LOAD-WORK-AREAS    THRU 1100-EXIT.              
                                                                        
       1000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 1100-LOAD-WORK-AREAS                                           *        
      * PERFORMED BY 1000-PROCESS-INPUT.                               *        
      ******************************************************************        
       1100-LOAD-WORK-AREAS.                                            
                                                                        
           MOVE '1100'                    TO ACTIVE-PARAGRAPH.          
                                                                        
           MOVE LOW-VALUES                TO WS-DATAFMT                 
                                             WS-DATAFMT-BIND.           
                                                                        
           MOVE CMN-CUSTOMER-NO           TO WS-CUSTOMER-NO.            
           MOVE CMN-PREMISE-NO            TO WS-PREMISE-NO.             
           MOVE CMN-ACCOUNT-NO            TO WS-ACCOUNT-NO              
           MOVE CMN-SERV-ORDER-NO         TO WS-SERV-ORDER-NO-C.        
           MOVE WS-SERV-ORDER-NO-I        TO WS-SERV-ORDER-NO-D.        
           MOVE CMN-CODES-SO-DATA-PRESENT TO WS-CODES-SO-DATA-PRESENT.  
           MOVE CMN-TODAYS-DATE           TO WS-TODAYS-DATE.            
           MOVE CMN-HOLD-COMPLETED-DATE   TO WS-DATE-COMPLETE.          
           MOVE CMN-USER-ID               TO WS-USER-ID.                
           MOVE CMN-SERV-ORDER-TYPE       TO WS-ORDER-TYPE-CD.          
T22976     MOVE WS-ORDER-TYPE-CD          TO WS-ORDER-TYPE-CD-2.        
T19715     IF CMN-BTU-FACTOR NOT EQUAL SPACES THEN                      
              MOVE CMN-BTU-FACTOR         TO WS-BTU-FACTOR              
              DIVIDE 1000 INTO WS-BTU-FACTOR GIVING WS-BTU-FACTOR       
T19715     END-IF.                                                      
                                                                        
       1100-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 2000-PROCESS-OUTPUT                                            *        
      * PERFORMED BY 0000-MAINLINE.                                    *        
      ******************************************************************        
       2000-PROCESS-OUTPUT.                                             
                                                                        
           MOVE '2000'                          TO ACTIVE-PARAGRAPH.    
                                                                        
           PERFORM 5000-UPDATE                  THRU 5000-EXIT.         
                                                                        
       2000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 2205-LOAD-GL-NUMBERS.                                          *        
      * LOADS ALL G/L NUMBERS FOR ALL COMPANIES.                       *        
      * PERFORMED BY 5000-UPDATE.                                      *        
      ******************************************************************        
       2205-LOAD-GL-NUMBERS.                                            
                                                                        
           MOVE '2205'                   TO ACTIVE-PARAGRAPH.           
T24436     PERFORM 9350-LINK-SCSCO061    THRU 9350-EXIT.                
                                                                        
C24748     PERFORM VARYING WS-VALID-CO-SUB FROM 1 BY 1                  
C24748           UNTIL WS-VALID-CO-SUB > 5                              
C24748           OR WS-VALID-CO-NO (WS-VALID-CO-SUB) = '01'             
C24748           OR WS-VALID-CO-NO (WS-VALID-CO-SUB) = WS-GL-99         
C24748        IF WS-VALID-CO-NO (WS-VALID-CO-SUB) = '01'                
                 MOVE WS-Y               TO WS-COMPANY-IN-TABLE         
              END-IF                                                    
           END-PERFORM.                                                 
                                                                        
       2205-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 2500-GET-NEW-ADDRESS-ID.                                       *        
      ******************************************************************        
       2500-GET-NEW-ADDRESS-ID.                                         
                                                                        
           PERFORM 2501-GET-DATE-TIME       THRU 2501-EXIT.             
                                                                        
           MOVE WS-CURRENT-DATE             TO WS-90-CURRENT-DATE.      
           MOVE WS-CURRENT-TIMESTAMP        TO WS-90-CURRENT-TIMESTAMP. 
           MOVE CMN-USER-ID                 TO WS-90-USERID.            
           MOVE '090'                       TO WS-90-PANEL-NO.          
           MOVE WS-FB-TRAN-COMMENT          TO WS-90-TRANS-COMMENTS.    
           MOVE WS-FB-TRAN-COMMENT-LEN      TO WS-90-TRANS-COMMENTS-LEN.
                                                                        
           PERFORM 6202-GET-NEW-ADDRESS-ID  THRU 6202-EXIT.             
                                                                        
           MOVE WS-90-NEW-ADDRESS-ID        TO WS-NEW-ADDR-ID-COMP.     
                                                                        
       2500-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 2501-GET-DATE-TIME.                                           *         
      *****************************************************************         
       2501-GET-DATE-TIME.                                              
                                                                        
           EXEC SQL                                                     
              SELECT CAST(SYSDATETIMEOFFSET() AS DATE),                         
                     REPLACE(REPLACE(CONVERT(CHAR(26), 
           CIS.CURRENT$TIMESTAMP(), 121), ' ', '-'), ':', '.')                 
                INTO :WS-CURRENT-DATE,                                  
                     :WS-CURRENT-TIMESTAMP                              
                FROM CSS_MODEL_SQL                                      
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CURRENT DATE,                                              
MFA-TR*              CURRENT TIMESTAMP                                          
MFA-TR*         INTO :WS-CURRENT-DATE,                                          
MFA-TR*              :WS-CURRENT-TIMESTAMP                                      
MFA-TR*         FROM CSS_MODEL_SQL                                              
MFA-TR*         QUERYNO 2501                                                    
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '2501'                     TO ACTIVE-PARAGRAPH       
              MOVE 'CSS_MODEL_SQL'            TO CMN-TABLE-1            
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-1  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       2501-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5000-UPDATE.                                                   *        
      * CONTROLS MAIN PROCESSING OF UPDATES.                           *        
      * PERFORMED BY 2000-PROCESS-OUTPUT.                              *        
      ******************************************************************        
       5000-UPDATE.                                                     
                                                                        
           MOVE '5000'                   TO ACTIVE-PARAGRAPH.           
                                                                        
      *    SELECT WORKING FIELDS.                                               
T16516     MOVE ZEROES                           TO AC-AMT-TRAN-BALANCE.
           MOVE WS-PREMISE-NO                    TO PR-PREMISE-NO.      
           MOVE WS-ACCOUNT-NO                    TO AT-ACCOUNT-NO.      
           MOVE WS-CUSTOMER-NO                   TO CU-CUSTOMER-NO.     
           MOVE WS-USER-ID                       TO PF-USER-ID.         
                                                                        
           PERFORM 7220-SELECT-CSS-PREMISE       THRU 7220-EXIT.        
           PERFORM 7210-SELECT-CSS-ACCOUNT       THRU 7210-EXIT.        
           PERFORM 7230-SELECT-CSS-CUSTOMER      THRU 7230-EXIT.        
           PERFORM 7080-SELECT-RESP-AREA-ID      THRU 7080-EXIT.        
           PERFORM 7260-OPEN-WAY-CHECK           THRU 7260-EXIT.        
                                                                        
      *    LOAD GL NUMBERS FOR ALL COMPANIES.                                   
           PERFORM 2205-LOAD-GL-NUMBERS          THRU 2205-EXIT.        
                                                                        
           PERFORM 5010-PREPARE-JOURNAL          THRU 5010-EXIT.        
                                                                        
      *                                                                         
T17746     PERFORM 5900-ADJUST-BILLED-BAL        THRU 5900-EXIT         
      *                                                                         
                                                                        
      *    SPLIT EXISTING EPP INTO UTE AND UTG IF IT EXISTS.                    
           MOVE AT-CODES-DATA-PRESENT             TO WS-CODES-EPP-CHECK.
           IF WS-EPP-IND = 'A'                                          
              PERFORM 5800-PROCESS-EPP            THRU 5800-EXIT        
           END-IF.                                                      
                                                                        
P00453* CHECK CDP FOR PAG AND SPLIT PPL 50 (SAME AS EPP) IF IT EXISTS.          
           MOVE AT-CODES-DATA-PRESENT          TO WS-CODES-PRP-CHECK.   
P00453     IF WS-PRP-IND = 'A'                                          
P00453        PERFORM 5805-PROCESS-PRP            THRU 5805-EXIT        
000453     END-IF.                                                      
                                                                        
      *    PROCESS FINAL BILL ADDRESS DETAILS.                                  
           IF WS-CODE-SO-FINAL-BILL = WS-A                              
              PERFORM 5100-PROCESS-FB-ADDRESS     THRU 5100-EXIT        
           END-IF.                                                      
                                                                        
      *    PROCESS FINAL BILL UNMETERED CONTRACT DETAILS.                       
           IF WS-CODE-SO-FB-UMCNTRCT = WS-A                             
              PERFORM 5210-PROCESS-SO-FB-UMCNTRCT THRU 5210-EXIT        
T22303        IF  WS-CNTRCT-CREATED = 'Y'                               
T22303            MOVE AT-CODES-DATA-PRESENT    TO WS-CODES-DATA-PRESENT
T22303            MOVE 'A'                      TO WS-CODE-CONTRACT     
T22303            MOVE WS-CODES-DATA-PRESENT    TO AT-CODES-DATA-PRESENT
T22303            PERFORM 8311-UPDATE-AT-CODES  THRU 8311-EXIT          
T22303        END-IF                                                    
           END-IF.                                                      
                                                                        
           IF WS-JRNL-WRITTEN = 'Y'                                     
              PERFORM 5020-TERMINATE-JOURNAL      THRU 5020-EXIT        
           END-IF.                                                      
                                                                        
      *    PROCESS FINAL BILL.                                                  
           PERFORM 5600-PROCESS-FINAL-BILL        THRU 5600-EXIT.       
                                                                        
      *    CHECK FOR ACTIVE DEPOSITS ON HAND.                                   
           PERFORM 7050-OPEN-ACTIVE-DEP-ON-HAND   THRU 7050-EXIT.       
           PERFORM 7150-FETCH-ACTIVE-DEP-ON-HAND  THRU 7150-EXIT.       
           MOVE AT-CODES-DATA-PRESENT    TO WS-CODES-DATA-PRESENT.      
           IF ACTIVE-DEP-EXISTS                                         
              MOVE WS-A                  TO WS-CODE-DEP-ON-HAND         
           ELSE                                                         
              MOVE SPACES                TO WS-CODE-DEP-ON-HAND         
           END-IF.                                                      
           PERFORM 7051-CLOSE-ACTIVE-DEP-ON-HAND  THRU 7051-EXIT.       
                                                                        
      *    UPDATE ACCOUNT FIELDS.                                               
           PERFORM 7200-SELECT-TIMESTAMP      THRU 7200-EXIT.           
           MOVE WS-CURRENT-TIMESTAMP          TO AT-LAST-UPDATE-TS.     
           MOVE 0                             TO WS-NULL-DT-IND-14.     
           MOVE WS-CODES-DATA-PRESENT         TO AT-CODES-DATA-PRESENT. 
           MOVE WS-A                          TO AT-CODE-BILL-PEND.     
                                                                        
           IF WS-ACCT-CHG-JRNL-DONE = 'N'                               
              PERFORM 8305-JRNL-ACCT-STAT-CHG     THRU 8305-EXIT        
           END-IF.                                                      
                                                                        
T17639     PERFORM 5300-LIGHTING-CONTRACT         THRU 5300-EXIT.       
                                                                        
A00759     IF (WS-ORDER-TYPE-CD-2 = 'CC' OR 'NC' OR 'UM' OR 'OF') OR    
A02677        (WS-ORDER-TYPE-CD = 'DNPFB')                              
P00307        MOVE AT-ACCOUNT-NO                    TO YP-ACCOUNT-NO    
P00307        PERFORM 8300-DELETE-ACCT-ATTRIBUTE    THRU 8300-EXIT      
T22976        PERFORM 5400-UPDATE-LIGHTING-CONTRACT THRU 5400-EXIT      
P00307     END-IF.                                                      
                                                                        
C32671     MOVE AT-CODES-DATA-PRESENT      TO WS-CODES-DATA-PRESENT     
CFBEPP     MOVE SPACES                     TO WS-CODE-EPP-OFFER         
P00453     MOVE SPACES                     TO WS-CODE-PRE-PAY-PLAN      
C32671     MOVE WS-CODES-DATA-PRESENT      TO AT-CODES-DATA-PRESENT     
           PERFORM 8310-UPDATE-CSS-ACCOUNT        THRU 8310-EXIT.       
C32671     MOVE AT-ACCOUNT-NO                     TO PJ-ACCOUNT-NO      
C32671     PERFORM 8480-UPDATE-PJS                THRU 8480-EXIT.       
                                                                        
C32832     MOVE AT-CODES-DATA-PRESENT      TO WS-CODES-DATA-PRESENT     
C32832     MOVE SPACES                     TO WS-CODE-THIRD-PTY         
C32832     MOVE WS-CODES-DATA-PRESENT      TO AT-CODES-DATA-PRESENT     
C32832     PERFORM 8310-UPDATE-CSS-ACCOUNT        THRU 8310-EXIT.       
C32832     MOVE AT-ACCOUNT-NO              TO ZW-ACCOUNT-NO             
C32832     PERFORM 5500-UPDATE-THD-PRTY          THRU 5500-EXIT.        
A37666     IF AT-ACCOUNT-NO = CU-AUTO-XFER-TO-ACCT AND                  
A37666         CU-AUTO-XFER-TO-ACCT > 0                                 
A37666             PERFORM 8800-UPDATE-CUSTOMER THRU 8800-EXIT          
A37666             PERFORM 5001-FORMAT-WQ THRU 5001-EXIT
           END-IF.               
                                                                        
       5000-EXIT.                                                       
           EXIT.                                                        
                                                                        
A37666 5001-FORMAT-WQ.                                                  
A37666                                                                  
A37666     MOVE '5001'                        TO ACTIVE-PARAGRAPH.      
A37666                                                                  
ACT103     INITIALIZE CWS00077-FIELDS.                                  
                                                                        
A37666     EXEC SQL                                                     
ACT103         SELECT
              CAST(SYSDATETIMEOFFSET() AS DATE)
            INTO
              :WS-77-DATE-CREATED                   
A37666     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                     39770000
MFA-TR*        SET :WS-77-DATE-CREATED = CURRENT DATE                   39780000
MFA-TR*    END-EXEC.                                                    39790000

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

A37666                                                                  
ACT103     MOVE 518                       TO WS-77-CATEGORY-ID.         
ACT103     MOVE PF-RESP-AREA-ID           TO WS-77-RESP-AREA-ID.        
ACT103     MOVE CMN-SERV-ORDER-NO         TO WS-77-SERV-ORDER-NO.       
ACT103     MOVE CMN-USER-ID               TO WS-77-USER-ID-ORIG.        
ACT103     MOVE WS-77-DATE-CREATED        TO WS-77-DATE-REQUIRED.       
ACT103     MOVE AT-ACCOUNT-NO             TO WS-77-ACCOUNT-NO.          
ACT103     MOVE PR-PREMISE-NO             TO WS-77-PREMISE-NO.          
ACT103     MOVE CU-CUSTOMER-NO            TO WS-77-CUSTOMER-NO.         
ACT103     MOVE AT-LOCAL-OFFICE           TO WS-77-LOCAL-OFFICE.        
ACT103     MOVE '5'                       TO WS-77-ROUTE-CATEGORY.      
ACT103     MOVE 'N'                       TO WS-77-PRIORITY.            
ACT103     MOVE WS-XF-MESSAGE             TO WS-77-COMMENTS-TEXT.       
ACT103     MOVE 54                        TO WS-77-COMMENTS-LEN.        
ACT103     MOVE SPACES                    TO WS-77-FREE-FORM-TXT.       
ACT103     MOVE ZERO                      TO WS-77-FREE-FORM-LEN.       
ACT103     MOVE PROGRAM-NAME              TO WS-77-CREATED-BY.          
A37666     PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT.               
A37666                                                                  
A37666 5001-EXIT.                                                       
A37666     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5010-PREPARE-JOURNAL.                                          *        
      * PERFORMED BY 5000-UPDATE                                       *        
      *              5600-PROCESS-FINAL-BILL                           *        
      *              5601-USE-CREDIT-BALANCES                          *        
      *              5660-APPLY-DEPOSIT-TO-BILL                        *        
      *              5661-DETERMINE-DEPOSIT                            *        
      *              5665-UPDATE-DEPOSIT-RECORDS.                      *        
      ******************************************************************        
       5010-PREPARE-JOURNAL.                                            
                                                                        
           MOVE '5010'                     TO ACTIVE-PARAGRAPH.         
                                                                        
           MOVE AT-COMPANY-NO              TO WS-100-COMPANY-NO.        
           MOVE WS-9                       TO WS-TRAN-OPER-LEVEL.       
           MOVE WS-1                       TO WS-TRAN-OCAP-FIELD.       
           MOVE WS-1                       TO WS-TRAN-OCAP-VALUE.       
           MOVE WS-C                       TO WS-TRAN-JRNL-TYPE.        
           MOVE WS-N                       TO WS-TRAN-HOLD-EXEMPT-FLAG. 
           MOVE WS-USER-ID                 TO WS-JRNL-OL-TEMP-ID.       
           MOVE WS-JRNL-CK-OPER-ID         TO WS-JRNL-OPERATION-RQST.   
                                                                        
           PERFORM 6400-ONLINE-JRNL-ROUTINE     THRU 6400-EXIT.         
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE PROGRAM-NAME            TO ABEND-PROGRAM             
              MOVE 'USERABEN'              TO ABEND-FUNCTION            
              PERFORM 9900-SQL-ERROR-ROUTINE    THRU 9900-EXIT          
           END-IF.                                                      
                                                                        
           MOVE WS-JRNL-OL-OPR-LOC         TO WS-TERM-LOC.              
           MOVE '01'                       TO WS-JRNL-OL-COMPANY.       
           MOVE '998'                      TO WS-JRNL-OL-LOC-OFF.       
           MOVE '998'                      TO WS-JRNL-OL-REPORT-NO.     
           MOVE WS-TODAYS-DATE             TO WS-JRNL-OL-REPORT-DT.     
           MOVE +9999                      TO WS-JRNL-OL-CASH-DRWR.     
           MOVE WS-TERM-LOC                TO WS-JRNL-OL-TERM-LOC       
                                              WS-JRNL-OL-CASH-LOC       
                                              WS-JRNL-OL-OPR-LOC.       
           MOVE WS-USER-ID                 TO WS-JRNL-OL-PERM-ID.       
           MOVE WS-JRNL-VALIDATE-OPER      TO WS-JRNL-OPERATION-RQST.   
           MOVE WS-C                       TO WS-JRNL-SOURCE-CODE.      
                                                                        
           IF CASH-TRANSACTION                                          
              MOVE WS-JRNL-CASH-UPDATE     TO WS-JRNL-OL-AUTH-TYPE      
           ELSE                                                         
              MOVE WS-JRNL-NON-CASH-UPDATE TO WS-JRNL-OL-AUTH-TYPE      
           END-IF.                                                      
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           PERFORM 6400-ONLINE-JRNL-ROUTINE     THRU 6400-EXIT.         
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE PROGRAM-NAME            TO ABEND-PROGRAM             
              MOVE 'USERABEN'              TO ABEND-FUNCTION            
              PERFORM 9900-SQL-ERROR-ROUTINE    THRU 9900-EXIT          
           END-IF.                                                      
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           PERFORM 5030-LOAD-COMMON-100         THRU 5030-EXIT.         
           ADD 1                           TO WS-100-JRNL-TRAN-APPL-NO. 
           MOVE WS-TODAYS-DATE             TO WS-100-DATE-LAST-ACTION   
                                              AT-DATE-LAST-ACTION.      
           MOVE WS-JRNL-OL-COMPANY         TO WS-PAR-COMPANY-NO.        
           MOVE WS-JRNL-OL-LOC-OFF         TO WS-PAR-LOCAL-OFFICE.      
           MOVE WS-JRNL-OL-REPORT-NO       TO WS-PAR-REPORT-NO.         
           MOVE WS-JRNL-OL-REPORT-DT       TO WS-PAR-REPORT-DATE.       
           MOVE WS-JRNL-OL-CASH-DRWR       TO WS-PAR-CASH-DRAWER.       
           MOVE WS-TERM-TRAN               TO WS-PAR-EIBTRNID           
           MOVE WS-TERM-LOC                TO WS-PAR-ACCESS-LOC.        
           MOVE WS-USER-ID                 TO WS-PAR-OPERATOR-ID.       
           MOVE PF-RESP-AREA-ID            TO WS-PAR-RESP-AREA.         
           MOVE 0                          TO WS-101-REVENUE-MONTH.     
                                                                        
       5010-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5020-TERMINATE-JOURNAL.                                        *        
      * PERFORMED BY 5000-UPDATE                                       *        
      *              5600-PROCESS-FINAL-BILL                           *        
      *              5601-USE-CREDIT-BALANCES                          *        
      *              5660-APPLY-DEPOSIT-TO-BILL                        *        
      *              5661-DETERMINE-DEPOSIT                            *        
      *              5665-UPDATE-DEPOSIT-RECORDS.                      *        
      ******************************************************************        
       5020-TERMINATE-JOURNAL.                                          
                                                                        
           MOVE '5020'                   TO ACTIVE-PARAGRAPH.           
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-CNTRL-ONLY       TO WS-JRNL-OPERATION-RQST.     
           PERFORM 6400-ONLINE-JRNL-ROUTINE     THRU 6400-EXIT.         
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE PROGRAM-NAME          TO ABEND-PROGRAM               
              MOVE 'USERABEN'            TO ABEND-FUNCTION              
              PERFORM 9900-SQL-ERROR-ROUTINE    THRU 9900-EXIT          
           END-IF.                                                      
                                                                        
       5020-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5030-LOAD-COMMON-100.                                          *        
      * PERFORMED BY 5010-PREPARE-JOURNAL                              *        
      *              5666-PAY-DEP-DET-FM                               *        
      *              5681-APPLY-REBATE.                                *        
      ******************************************************************        
       5030-LOAD-COMMON-100.                                            
                                                                        
           MOVE '5030'                    TO ACTIVE-PARAGRAPH.          
                                                                        
           MOVE WS-A                      TO WS-100-JRNL-SORT-ID.       
           MOVE AT-ACCOUNT-NO             TO WS-100-ACCT-NO.            
           MOVE CU-CUSTOMER-NO            TO WS-100-CUSTOMER-NO.        
           MOVE PR-PREMISE-NO             TO WS-100-PREMISE-NO.         
           MOVE WS-TERM-TRAN              TO WS-100-CODE-TERMINAL-TRAN. 
           MOVE WS-C                      TO WS-100-CODE-ENTRY-SOURCE.  
           MOVE AT-LOCAL-OFFICE           TO WS-100-LOCAL-OFFICE-CD.    
           MOVE AT-COMPANY-NO             TO WS-100-COMPANY-NO          
                                             GO-COMPANY-NO.             
       5030-EXIT.                                                       
           EXIT.                                                        
                                                                        
AS0996******************************************************************        
AS0996* 5045-LOAD-COMMON-105.                                          *        
AS0996* PERFORMED BY 5681-APPLY-REBATE                                 *        
AS0996******************************************************************        
AS0996 5045-LOAD-COMMON-105.                                            
AS0996                                                                  
AS0996     MOVE '5045'                  TO ACTIVE-PARAGRAPH.            
AS0996                                                                  
AS0996     MOVE WS-105                  TO WS-105-JRNL-FORMAT-NO.       
AS0996     MOVE SPACES                  TO WS-105-CASH-DRAWER-USED.     
AS0996     MOVE CU-CODE-EMPL-ACCT       TO WS-105-CODE-EMPL-ACCT.       
AS0996     MOVE AT-CODE-COMPANY-ACCT    TO WS-105-CODE-COMPANY-ACCT.    
AS0996     MOVE PR-CODE-PREMISE-STAT    TO WS-105-CODE-PREMISE-STATUS.  
AS0996     MOVE AT-CODE-ACCT-STAT       TO WS-105-CODE-ACCOUNT-STATUS.  
AS0996     MOVE PR-REV-DISTRICT-CD      TO WS-105-CODE-REVENUE-DISTRICT.
AS0996     MOVE ZERO                    TO WS-105-QUANTITY-ENTERED.     
AS0996                                                                  
AS0996 5045-EXIT.                                                       
AS0996     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5050-LOAD-COMMON-101.                                          *        
      * PERFORMED BY 5666-PAY-DEP-DET-FM                               *        
      ******************************************************************        
       5050-LOAD-COMMON-101.                                            
                                                                        
           MOVE '101'                   TO WS-101-JRNL-FORMAT-NO.       
           MOVE SPACES                  TO WS-101-CASH-DRAWER-USED      
                                           WS-101-FUNCTION-CODE.        
           MOVE PR-REV-DISTRICT-CD      TO WS-101-CODE-REVENUE-DISTRICT.
           MOVE CU-CODE-EMPL-ACCT       TO WS-101-CODE-EMPL-ACCT.       
           MOVE AT-CODE-COMPANY-ACCT    TO WS-101-CODE-COMPANY-ACCT.    
           MOVE AT-CODE-ACCT-STAT       TO WS-101-CODE-ACCOUNT-STATUS.  
           MOVE PR-CODE-PREMISE-STAT    TO WS-101-CODE-PREMISE-STATUS.  
                                                                        
           MOVE AU-AMT-POSTED           TO WS-101-AMT-POSTED            
                                           WS-JRNL-RCV-DEBIT-AMT        
                                           WS-JRNL-RCV-CREDIT-AMT.      
           MOVE AR-AMT-ORIG-ENTERED     TO WS-101-AMOUNT-ENTERED.       
           MOVE AU-CODE-AR-AGE          TO WS-101-AR-AGE.               
           MOVE WS-CURRENT-DATE         TO WS-101-DATE-AR-BILLED.       
           MOVE 0                       TO WS-101-ITEM-ID-NO.           
                                                                        
           IF AC-PYMT-PRIORITY-LVL < 50                                 
              MOVE 0                    TO WS-101-DETAIL-END-AR-BAL     
                                           WS-101-DETAIL-END-BAL        
           ELSE                                                         
              MOVE AC-AMT-TRAN-BALANCE  TO WS-101-DETAIL-END-BAL        
              COMPUTE WS-101-DETAIL-END-AR-BAL = AC-AMT-AR-DAY-00 +     
                                                 AC-AMT-AR-DAY-30 +     
                                                 AC-AMT-AR-DAY-60 +     
                                                 AC-AMT-AR-DAY-90       
           END-IF.                                                      
                                                                        
       5050-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5100-PROCESS-FB-ADDRESS.                                       *        
      * PERFORMED BY 5000-UPDATE.                                      *        
      ******************************************************************        
       5100-PROCESS-FB-ADDRESS.                                         
                                                                        
           MOVE '5100'                          TO ACTIVE-PARAGRAPH.    
                                                                        
      *    LOAD SO FINAL BILL DETAILS FROM SYBASE.                              
           PERFORM 5150-GET-SO-FINAL-BILL              THRU 5150-EXIT.  
                                                                        
      *    DETERMINE EXISTING ADDRESS DETAILS.                                  
           PERFORM 5130-GET-OLD-ADDR-DETAILS           THRU 5130-EXIT.  
                                                                        
      *    CHECK NEW BILLING ADDRESS FORMAT.                                    
REARCH     IF WS-ADDRESS-FORMAT         = WS-A                          
              IF FORM-ADDR-MATCHED                                      
      *          USE MATCHING FORMATTED BILLING ADDRESS ID.                     
                 IF BILL-ADDR-XREF-EXISTS                               
                    MOVE WS-ADDRESS-ID-MATCH    TO AQ-ADDRESS-ID        
                    PERFORM 8330-UPDATE-BILL-ADDR-XREF THRU 8330-EXIT   
                 ELSE                                                   
                    MOVE AT-ACCOUNT-NO          TO AQ-ACCOUNT-NO        
                    MOVE WS-ADDRESS-ID-MATCH    TO AQ-ADDRESS-ID        
                    MOVE CU-NAME-ID             TO AQ-NAME-ID           
                    MOVE AT-COMPANY-NO          TO AQ-COMPANY-NO        
                    PERFORM 8540-INSERT-BILL-ADDR-XREF THRU 8540-EXIT   
                 END-IF                                                 
                 MOVE WS-ADDRESS-ID-MATCH       TO AT-ADDRESS-ID        
              ELSE                                                      
      *          PROCESS NEW FORMATTED BILLING ADDRESS ID.                      
                 PERFORM 2500-GET-NEW-ADDRESS-ID       THRU 2500-EXIT   
                 PERFORM 8530-INSERT-ADDR-FORMATTED    THRU 8530-EXIT   
                                                                        
                 IF BILL-ADDR-XREF-EXISTS                               
                    MOVE WS-NEW-ADDR-ID-COMP    TO AQ-ADDRESS-ID        
                    PERFORM 8330-UPDATE-BILL-ADDR-XREF THRU 8330-EXIT   
                 ELSE                                                   
                    MOVE AT-ACCOUNT-NO          TO AQ-ACCOUNT-NO        
                    MOVE WS-NEW-ADDR-ID-COMP    TO AQ-ADDRESS-ID        
                    MOVE CU-NAME-ID             TO AQ-NAME-ID           
                    MOVE AT-COMPANY-NO          TO AQ-COMPANY-NO        
                    PERFORM 8540-INSERT-BILL-ADDR-XREF THRU 8540-EXIT   
                 END-IF                                                 
                 MOVE WS-NEW-ADDR-ID-COMP       TO AT-ADDRESS-ID        
              END-IF                                                    
                                                                        
              MOVE WS-A                         TO AT-ADDRESS-FORMAT    
                                                                        
REARCH     ELSE IF WS-ADDRESS-FORMAT         = WS-B                     
      *       PROCESS NEW FREEFORM BILLING ADDRESS ID.                          
              PERFORM 2500-GET-NEW-ADDRESS-ID          THRU 2500-EXIT   
              PERFORM 8550-INSERT-ADDR-FREEFORM        THRU 8550-EXIT   
                                                                        
              IF BILL-ADDR-XREF-EXISTS                                  
                 MOVE WS-NEW-ADDR-ID-COMP       TO AQ-ADDRESS-ID        
                 PERFORM 8330-UPDATE-BILL-ADDR-XREF     THRU 8330-EXIT  
              ELSE                                                      
                 MOVE AT-ACCOUNT-NO             TO AQ-ACCOUNT-NO        
                 MOVE WS-NEW-ADDR-ID-COMP       TO AQ-ADDRESS-ID        
                 MOVE CU-NAME-ID                TO AQ-NAME-ID           
                 MOVE AT-COMPANY-NO             TO AQ-COMPANY-NO        
                 PERFORM 8540-INSERT-BILL-ADDR-XREF    THRU 8540-EXIT   
              END-IF                                                    
                                                                        
              MOVE WS-NEW-ADDR-ID-COMP          TO AT-ADDRESS-ID        
              MOVE WS-B                         TO AT-ADDRESS-FORMAT    
           END-IF
           END-IF.                                                      
                                                                        
      *    UPDATE ACCOUNT DETAILS.                                              
           PERFORM 7200-SELECT-TIMESTAMP               THRU 7200-EXIT.  
           MOVE WS-CURRENT-TIMESTAMP            TO AT-LAST-UPDATE-TS.   
           MOVE WS-TODAYS-DATE                  TO AT-DATE-LAST-ACTION. 
REARCH     IF WS-SEND-TO-LOCOFF-IND         = WS-YES                    
              MOVE WS-L                         TO AT-CODE-P-BILL-DEST  
           END-IF.                                                      
                                                                        
           IF WS-ACCT-CHG-JRNL-DONE = 'N'                               
              PERFORM 8305-JRNL-ACCT-STAT-CHG          THRU 8305-EXIT   
           END-IF.                                                      
C29238*    UPDATE CODE-PERM-BILL TO PULL EXTRA POSTAGE FOR INTERNATIONAL        
C29238*    ADDRESSES                                                            
REARCH     IF WS-ADDRESS-FORMAT         = WS-B                          
REARCH        IF (WS-ADDR-COUNTRY         > SPACES  AND                 
REARCH            WS-ADDR-COUNTRY         NOT EQUAL 'USA' AND           
P00547            WS-ADDR-COUNTRY         NOT EQUAL 'UNITED STATES')    
C29238           MOVE WS-D                   TO AT-CODE-PERM-BILL       
P00547           PERFORM 5920-IAT-WQ         THRU 5920-EXIT             
C29238        END-IF                                                    
C29238     END-IF.                                                      
                                                                        
           PERFORM 8310-UPDATE-CSS-ACCOUNT             THRU 8310-EXIT.  
C32671     MOVE AT-ACCOUNT-NO                     TO PJ-ACCOUNT-NO      
C32671     PERFORM 8480-UPDATE-PJS                THRU 8480-EXIT.       
                                                                        
      *    PROCESS ADDRESS CHANGE JOURNALING.                                   
REARCH     IF WS-ADDRESS-FORMAT         = WS-A OR WS-B                  
              PERFORM 5110-JOURNAL-ADDR-CHANGES        THRU 5110-EXIT   
           END-IF.                                                      
                                                                        
       5100-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5110-JOURNAL-ADDR-CHANGES.                                     *        
      *                                                                *        
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS                           *        
      ******************************************************************        
       5110-JOURNAL-ADDR-CHANGES.                                       
                                                                        
           MOVE '5110'                     TO ACTIVE-PARAGRAPH.         
                                                                        
           MOVE +0                         TO MH-TRAN-COMMENT-LEN.      
           MOVE SPACES                     TO MH-TRAN-COMMENT-TEXT.     
T18095     MOVE WS-PROG-FINAL-BILL-ADDR     TO MH-APPL-PROGRAM-ID.      
                                                                        
           PERFORM 5120-JRNL-TRAN-HEAD     THRU 5120-EXIT.              
                                                                        
           IF WS-HOUSE-NO NOT = DY-HOUSE-NO                             
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-HOUSE-NO > SPACES                                   
                 MOVE +15                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-HOUSE-NO          TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-HOUSE-NO > SPACES                                   
                 MOVE +15                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-HOUSE-NO          TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'HOUSE NO       '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDR-PREFIX-1 NOT = DY-ADDR-PREFIX-1                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-PREFIX-1 > SPACES                              
                 MOVE +3                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-PREFIX-1     TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-ADDR-PREFIX-1 > SPACES                              
                 MOVE +3                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-ADDR-PREFIX-1     TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ADDRESS PREFIX1'       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDR-PREFIX-2 NOT = DY-ADDR-PREFIX-2                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-PREFIX-2 > SPACES                              
                 MOVE +2                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-PREFIX-2     TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-ADDR-PREFIX-2 > SPACES                              
                 MOVE +2                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-ADDR-PREFIX-2     TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ADDRESS PREFIX2'       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-STREET-NAME NOT = DY-STREET-NAME                       
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-STREET-NAME > SPACES                                
                 MOVE +30                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-STREET-NAME       TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-STREET-NAME > SPACES                                
                 MOVE +30                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-STREET-NAME       TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'STREET NAME    '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-STREET-SUFFIX NOT = DY-STREET-SUFFIX                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-STREET-SUFFIX > SPACES                              
                 MOVE +4                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-STREET-SUFFIX     TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-STREET-SUFFIX > SPACES                              
                 MOVE +4                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-STREET-SUFFIX     TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'STREET SUFFIX  '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-STREET-LOCATION-1 NOT = DY-STREET-LOCATION-1           
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-STREET-LOCATION-1 > SPACES                          
                 MOVE +4                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-STREET-LOCATION-1 TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-STREET-LOCATION-1 > SPACES                          
                 MOVE +4                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-STREET-LOCATION-1 TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'STREET LOC 1   '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-STREET-LOCATION-2 NOT = DY-STREET-LOCATION-2           
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-STREET-LOCATION-2 > SPACES                          
                 MOVE +11                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-STREET-LOCATION-2 TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-STREET-LOCATION-2 > SPACES                          
                 MOVE +11                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-STREET-LOCATION-2 TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'STREET LOC 2   '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDRESS-OVERFLOW NOT = DY-ADDRESS-OVERFLOW             
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDRESS-OVERFLOW > SPACES                           
                 MOVE +35                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDRESS-OVERFLOW  TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-ADDRESS-OVERFLOW > SPACES                           
                 MOVE +35                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-ADDRESS-OVERFLOW  TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ADDR OVERFLOW  '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ZIP-CODE NOT = DY-ZIP-CODE                             
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ZIP-CODE > SPACES                                   
                 MOVE +5                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ZIP-CODE          TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-ZIP-CODE > SPACES                                   
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-ZIP-CODE          TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ZIP CODE       '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
C35749     IF WS-ZIP-CODE-TOKEN NOT = DY-ZIP-CODE-TOKEN                 
C35749        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
C35749        IF WS-ZIP-CODE-TOKEN > SPACES                             
C35749           MOVE +1                   TO MI-CHG-COLUMN-VALUE-LEN   
C35749           MOVE WS-ZIP-CODE-TOKEN    TO MI-CHG-COLUMN-VALUE-TEXT  
C35749        ELSE                                                      
C35749           MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
C35749           MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
C35749        END-IF                                                    
C35749        IF DY-ZIP-CODE-TOKEN > SPACES                             
C35749           MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
C35749           MOVE DY-ZIP-CODE-TOKEN    TO MI-PRV-COLUMN-VALUE-TEXT  
C35749        ELSE                                                      
C35749           MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
C35749           MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
C35749        END-IF                                                    
C35749        MOVE 'ZIP CODE TOKEN '       TO MI-COLUMN-DESC            
C35749        MOVE SPACES                  TO MI-TABLE-ID               
C35749        PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
C35749        ADD 1                        TO WS-TRAN-APPL-NO           
C35749     END-IF.                                                      
                                                                        
           IF WS-ZIP-CODE-PLUS-FOUR NOT = DY-ZIP-CODE-PLUS-FOUR         
              MOVE WS-TRAN-APPL-NO          TO MI-TRAN-APPL-NO          
              IF WS-ZIP-CODE-PLUS-FOUR > SPACES                         
                 MOVE +4                    TO MI-CHG-COLUMN-VALUE-LEN  
                 MOVE WS-ZIP-CODE-PLUS-FOUR TO MI-CHG-COLUMN-VALUE-TEXT 
              ELSE                                                      
                 MOVE +9                    TO MI-CHG-COLUMN-VALUE-LEN  
                 MOVE '*DELETED*'           TO MI-CHG-COLUMN-VALUE-TEXT 
              END-IF                                                    
              IF DY-ZIP-CODE-PLUS-FOUR > SPACES                         
                 MOVE +4                    TO MI-PRV-COLUMN-VALUE-LEN  
                 MOVE DY-ZIP-CODE-PLUS-FOUR TO MI-PRV-COLUMN-VALUE-TEXT 
              ELSE                                                      
                 MOVE +5                    TO MI-PRV-COLUMN-VALUE-LEN  
                 MOVE '*NEW*'               TO MI-PRV-COLUMN-VALUE-TEXT 
              END-IF                                                    
              MOVE 'ZIP CODE PLUS 4'        TO MI-COLUMN-DESC           
              MOVE SPACES                   TO MI-TABLE-ID              
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                         TO WS-TRAN-APPL-NO          
           END-IF.                                                      
                                                                        
           IF WS-ADDR-SUFFIX NOT = DY-ADDR-SUFFIX                       
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-SUFFIX > SPACES                                
                 MOVE +2                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-SUFFIX       TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-ADDR-SUFFIX > SPACES                                
                 MOVE +2                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-ADDR-SUFFIX       TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ADDRESS SUFFIX '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-CARRIER-ROUTE NOT = DY-CARRIER-ROUTE                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-CARRIER-ROUTE > SPACES                              
                 MOVE +5                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-CARRIER-ROUTE     TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DY-CARRIER-ROUTE > SPACES                              
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DY-CARRIER-ROUTE     TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'CARRIER ROUTE  '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDR-ST NOT = DZ-ADDR-STREET                           
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-ST > SPACES                                    
                 MOVE +55                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-ST           TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DZ-ADDR-STREET > SPACES                                
                 MOVE +55                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DZ-ADDR-STREET       TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'STREET ADDRESS '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
C35749     IF WS-ADDR-ST-2 NOT = DZ-ADDR-STREET-2                       
C35749        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
C35749        IF WS-ADDR-ST-2 > SPACES                                  
C35749           MOVE +55                  TO MI-CHG-COLUMN-VALUE-LEN   
C35749           MOVE WS-ADDR-ST-2         TO MI-CHG-COLUMN-VALUE-TEXT  
C35749        ELSE                                                      
C35749           MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
C35749           MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
C35749        END-IF                                                    
C35749        IF DZ-ADDR-STREET-2 > SPACES                              
C35749           MOVE +55                  TO MI-PRV-COLUMN-VALUE-LEN   
C35749           MOVE DZ-ADDR-STREET-2     TO MI-PRV-COLUMN-VALUE-TEXT  
C35749        ELSE                                                      
C35749           MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
C35749           MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
C35749        END-IF                                                    
C35749        MOVE 'STREET ADDRESS 2'      TO MI-COLUMN-DESC            
C35749        MOVE SPACES                  TO MI-TABLE-ID               
C35749        PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
C35749        ADD 1                        TO WS-TRAN-APPL-NO           
C35749     END-IF.                                                      
                                                                        
           IF WS-FINAL-BILL-CY-ST NOT = DZ-ADDR-CITY-STATE              
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-FINAL-BILL-CY-ST > SPACES                           
                 MOVE +30                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-FINAL-BILL-CY-ST  TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DZ-ADDR-CITY-STATE > SPACES                            
                 MOVE +30                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DZ-ADDR-CITY-STATE   TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'CITY STATE     '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDR-ZIP-CODE NOT = DZ-ADDR-ZIP-CODE                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-ZIP-CODE > SPACES                              
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-ZIP-CODE     TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DZ-ADDR-ZIP-CODE > SPACES                              
                 MOVE +9                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DZ-ADDR-ZIP-CODE     TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'ZIP CODE       '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-ADDR-COUNTRY NOT = DZ-ADDR-COUNTRY                     
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-ADDR-COUNTRY > SPACES                               
                 MOVE +35                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-ADDR-COUNTRY      TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DZ-ADDR-COUNTRY > SPACES                               
                 MOVE +35                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DZ-ADDR-COUNTRY      TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'COUNTRY        '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-FINAL-BILL-OVFL NOT = DZ-ADDRESS-OVERFLOW              
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              IF WS-FINAL-BILL-OVFL > SPACES                            
                 MOVE +35                  TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE WS-FINAL-BILL-OVFL   TO MI-CHG-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +9                   TO MI-CHG-COLUMN-VALUE-LEN   
                 MOVE '*DELETED*'          TO MI-CHG-COLUMN-VALUE-TEXT  
              END-IF                                                    
              IF DZ-ADDRESS-OVERFLOW > SPACES                           
                 MOVE +35                  TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE DZ-ADDRESS-OVERFLOW  TO MI-PRV-COLUMN-VALUE-TEXT  
              ELSE                                                      
                 MOVE +5                   TO MI-PRV-COLUMN-VALUE-LEN   
                 MOVE '*NEW*'              TO MI-PRV-COLUMN-VALUE-TEXT  
              END-IF                                                    
              MOVE 'OVERFLOW       '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-FORMATTED-ADDED = 'Y'                                  
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              MOVE WS-ADDR-ID-ADDED        TO MI-CHG-COLUMN-VALUE-TEXT  
              MOVE +13                     TO MI-CHG-COLUMN-VALUE-LEN   
              MOVE +5                      TO MI-PRV-COLUMN-VALUE-LEN   
              MOVE '*NEW*'                 TO MI-PRV-COLUMN-VALUE-TEXT  
              MOVE 'ADDRESS ID     '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
           IF WS-FREEFORM-ADDED = 'Y'                                   
              MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
              MOVE WS-ADDR-ID-ADDED        TO MI-CHG-COLUMN-VALUE-TEXT  
              MOVE +13                     TO MI-CHG-COLUMN-VALUE-LEN   
              MOVE +5                      TO MI-PRV-COLUMN-VALUE-LEN   
              MOVE '*NEW*'                 TO MI-PRV-COLUMN-VALUE-TEXT  
              MOVE 'ADDRESS ID     '       TO MI-COLUMN-DESC            
              MOVE SPACES                  TO MI-TABLE-ID               
              PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT          
              ADD 1                        TO WS-TRAN-APPL-NO           
           END-IF.                                                      
                                                                        
      * RESET THE PAR APPL PROGRAM VARIABLE.                                    
           MOVE PROGRAM-NAME                TO WS-PAR-APPL-PROG-ID.     
                                                                        
       5110-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5120-JRNL-TRAN-HEAD.                                           *        
      * PERFORMED BY 5110-JOURNAL-ADDR-CHANGES.                        *        
      ******************************************************************        
       5120-JRNL-TRAN-HEAD.                                             
                                                                        
           MOVE '5120'                      TO ACTIVE-PARAGRAPH.        
                                                                        
           MOVE 1                           TO WS-TRAN-APPL-NO          
                                               MI-TRAN-APPL-NO.         
           MOVE WS-USER-ID                  TO MH-USER-ID.              
           MOVE WS-TODAYS-DATE              TO MH-DATE-TRANS.           
           MOVE WS-F                        TO MH-CODE-TRAN-TYPE.       
                                                                        
           IF WS-PROCESS-CNT-XFER = 'Y'                                 
              MOVE CT-ACCOUNT-NO            TO MH-ACCOUNT-NO            
           ELSE                                                         
              MOVE AT-ACCOUNT-NO            TO MH-ACCOUNT-NO            
           END-IF.                                                      
                                                                        
           MOVE 0                           TO MH-CUSTOMER-NO.          
           MOVE 0                           TO MH-PREMISE-NO.           
           MOVE PF-RESP-AREA-ID             TO MH-RESP-AREA-ID.         
                                                                        
      *    GET NEW TIMESTAMP.                                                   
           PERFORM 7200-SELECT-TIMESTAMP        THRU 7200-EXIT.         
           MOVE WS-CURRENT-TIMESTAMP        TO MH-TRANS-HIST-SEQ-NO     
                                               MI-TRANS-HIST-SEQ-NO.    
                                                                        
       5120-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5130-GET-OLD-ADDR-DETAILS.                                     *        
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS                           *        
      ******************************************************************        
       5130-GET-OLD-ADDR-DETAILS.                                       
                                                                        
           MOVE '5130'                      TO ACTIVE-PARAGRAPH.        
                                                                        
           IF AT-ADDRESS-FORMAT = WS-A                                  
              MOVE SPACES                   TO DCLCSS-ADDR-FREEFORM     
              MOVE AT-ADDRESS-ID            TO DY-ADDRESS-ID            
                                               WS-OLD-ADDRESS-ID        
              PERFORM 7430-SELECT-ADDR-FORMATTED THRU 7430-EXIT         
           ELSE IF AT-ADDRESS-FORMAT = WS-B                             
              MOVE SPACES                   TO DCLCSS-ADDR-FORMATTED    
              MOVE AT-ADDRESS-ID            TO DZ-ADDRESS-ID            
                                               WS-OLD-ADDRESS-ID        
              PERFORM 7420-SELECT-ADDR-FREEFORM  THRU 7420-EXIT         
           ELSE                                                         
              MOVE SPACES                   TO DCLCSS-ADDR-FREEFORM     
                                               DCLCSS-ADDR-FORMATTED    
              GO TO 5130-EXIT                                           
           END-IF
           END-IF.                                                      
                                                                        
           MOVE WS-ACCOUNT-NO                TO AQ-ACCOUNT-NO.          
           PERFORM 7410-SELECT-BILL-ADDR-XREF    THRU 7410-EXIT.        
                                                                        
           MOVE AT-ADDRESS-ID                TO AQ-ADDRESS-ID.          
           PERFORM 7440-SELECT-COUNT-BILL-ADDR   THRU 7440-EXIT.        
                                                                        
           MOVE AT-ADDRESS-ID                TO HT-ADDRESS-ID.          
           PERFORM 7450-SELECT-COUNT-NAME-ACCT   THRU 7450-EXIT.        
                                                                        
T22066     MOVE AT-ADDRESS-ID                TO SI-ADDRESS-ID.          
T22066     PERFORM 7460-SELECT-COUNT-LANDLORD    THRU 7460-EXIT.        
                                                                        
T21176     MOVE 'N' TO WS-FORM-ADDR-MATCHED.                            
                                                                        
       5130-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5150-GET-SO-FINAL-BILL.                                        *        
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                          *        
      ******************************************************************        
       5150-GET-SO-FINAL-BILL.                                          
                                                                        
           MOVE '5150'                       TO ACTIVE-PARAGRAPH.       
                                                                        
REARCH     PERFORM 5155-SELECT-CSS-SO-FINAL-BILL THRU 5155-EXIT         
                                                                        
REARCH     MOVE XD-HOUSE-NO                  TO WS-HOUSE-NO.            
REARCH     MOVE XD-ADDR-PREFIX-1             TO WS-ADDR-PREFIX-1.       
REARCH     MOVE XD-ADDR-PREFIX-2             TO WS-ADDR-PREFIX-2.       
REARCH     MOVE XD-STREET-NAME               TO WS-STREET-NAME.         
REARCH     MOVE XD-STREET-SUFFIX             TO WS-STREET-SUFFIX.       
REARCH     MOVE XD-STREET-LOCATION-1         TO WS-STREET-LOCATION-1.   
REARCH     MOVE XD-STREET-LOCATION-2         TO WS-STREET-LOCATION-2.   
REARCH     MOVE XD-ADDRESS-OVERFLOW          TO WS-ADDRESS-OVERFLOW.    
REARCH     MOVE XD-ZIP-CODE                  TO WS-ZIP-CODE.            
REARCH     MOVE XD-ZIP-CODE-PLUS-FOUR        TO WS-ZIP-CODE-PLUS-FOUR.  
REARCH     MOVE XD-ZIP-CODE-TOKEN            TO WS-ZIP-CODE-TOKEN.      
REARCH     MOVE XD-ADDR-SUFFIX               TO WS-ADDR-SUFFIX.         
REARCH     MOVE XD-CARRIER-ROUTE             TO WS-CARRIER-ROUTE.       
REARCH     MOVE XD-ADDR-ST                   TO WS-ADDR-ST.             
REARCH     MOVE XD-FINAL-BILL-CY-ST          TO WS-FINAL-BILL-CY-ST.    
REARCH     MOVE XD-ADDR-ZIP-CODE             TO WS-ADDR-ZIP-CODE.       
REARCH     MOVE XD-ADDR-COUNTRY              TO WS-ADDR-COUNTRY.        
REARCH     MOVE XD-FINAL-BILL-OVFL           TO WS-FINAL-BILL-OVFL.     
REARCH     MOVE XD-USPS-DELIV-PT-CD          TO WS-USPS-DEL-POINT.      
REARCH     MOVE XD-ADDRESS-FORMAT            TO WS-ADDRESS-FORMAT.      
REARCH     MOVE XD-SEND-TO-LOCOFF-IND        TO WS-SEND-TO-LOCOFF-IND.  
REARCH     MOVE XD-CREDIT-LETTER-IND         TO WS-CREDIT-LETTER-IND.   
C35749     MOVE XD-ADDR-ST-2                 TO WS-ADDR-ST-2.           
                                                                        
       5150-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
REARCH* 5155-SELECT-CSS-SO-FINAL-BILL.                                          
      ******************************************************************        
REARCH 5155-SELECT-CSS-SO-FINAL-BILL.                                   
                                                                        
REARCH     MOVE '5155'                TO ACTIVE-PARAGRAPH.              
                                                                        
REARCH     EXEC SQL                                                     
REARCH         SELECT ADDR_COUNTRY,                                     
REARCH                ADDR_PREFIX_1,                                    
REARCH                ADDR_PREFIX_2,                                    
REARCH                ADDR_ST,                                          
REARCH                ADDR_SUFFIX,                                      
REARCH                ADDR_ZIP_CODE,                                    
REARCH                ADDRESS_FORMAT,                                   
REARCH                ADDRESS_OVERFLOW,                                 
REARCH                CARRIER_ROUTE,                                    
REARCH                CREDIT_LETTER_IND,                                
REARCH                FINAL_BILL_CY_ST,                                 
REARCH                FINAL_BILL_OVFL,                                  
REARCH                HOUSE_NO,                                         
REARCH                SEND_TO_LOCOFF_IND,                               
REARCH                STREET_LOCATION_1,                                
REARCH                STREET_LOCATION_2,                                
REARCH                STREET_NAME,                                      
REARCH                STREET_SUFFIX,                                    
REARCH                ZIP_CODE,                                         
REARCH                ZIP_CODE_PLUS_FOUR,                               
REARCH                ZIP_CODE_TOKEN,                                   
REARCH                USPS_DELIV_PT_CD,                                 
C35749                ADDR_ST_2                                         
REARCH       INTO     :XD-ADDR-COUNTRY,                                 
REARCH                :XD-ADDR-PREFIX-1,                                
REARCH                :XD-ADDR-PREFIX-2,                                
REARCH                :XD-ADDR-ST,                                      
REARCH                :XD-ADDR-SUFFIX,                                  
REARCH                :XD-ADDR-ZIP-CODE,                                
REARCH                :XD-ADDRESS-FORMAT,                               
REARCH                :XD-ADDRESS-OVERFLOW,                             
REARCH                :XD-CARRIER-ROUTE,                                
REARCH                :XD-CREDIT-LETTER-IND,                            
REARCH                :XD-FINAL-BILL-CY-ST,                             
REARCH                :XD-FINAL-BILL-OVFL,                              
REARCH                :XD-HOUSE-NO,                                     
REARCH                :XD-SEND-TO-LOCOFF-IND,                           
REARCH                :XD-STREET-LOCATION-1,                            
REARCH                :XD-STREET-LOCATION-2,                            
REARCH                :XD-STREET-NAME,                                  
REARCH                :XD-STREET-SUFFIX,                                
REARCH                :XD-ZIP-CODE,                                     
REARCH                :XD-ZIP-CODE-PLUS-FOUR,                           
REARCH                :XD-ZIP-CODE-TOKEN,                               
REARCH                :XD-USPS-DELIV-PT-CD,                             
C35749                :XD-ADDR-ST-2                                     
REARCH      FROM CSS_SO_FINAL_BILL                                      
REARCH      WHERE SERV_ORDER_NO = :WS-SERV-ORDER-NO-D                   
                                                            
REARCH     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT ADDR_COUNTRY,                                             
MFA-TR*               ADDR_PREFIX_1,                                            
MFA-TR*               ADDR_PREFIX_2,                                            
MFA-TR*               ADDR_ST,                                                  
MFA-TR*               ADDR_SUFFIX,                                              
MFA-TR*               ADDR_ZIP_CODE,                                            
MFA-TR*               ADDRESS_FORMAT,                                           
MFA-TR*               ADDRESS_OVERFLOW,                                         
MFA-TR*               CARRIER_ROUTE,                                            
MFA-TR*               CREDIT_LETTER_IND,                                        
MFA-TR*               FINAL_BILL_CY_ST,                                         
MFA-TR*               FINAL_BILL_OVFL,                                          
MFA-TR*               HOUSE_NO,                                                 
MFA-TR*               SEND_TO_LOCOFF_IND,                                       
MFA-TR*               STREET_LOCATION_1,                                        
MFA-TR*               STREET_LOCATION_2,                                        
MFA-TR*               STREET_NAME,                                              
MFA-TR*               STREET_SUFFIX,                                            
MFA-TR*               ZIP_CODE,                                                 
MFA-TR*               ZIP_CODE_PLUS_FOUR,                                       
MFA-TR*               ZIP_CODE_TOKEN,                                           
MFA-TR*               USPS_DELIV_PT_CD,                                         
MFA-TR*               ADDR_ST_2                                                 
MFA-TR*      INTO     :XD-ADDR-COUNTRY,                                         
MFA-TR*               :XD-ADDR-PREFIX-1,                                        
MFA-TR*               :XD-ADDR-PREFIX-2,                                        
MFA-TR*               :XD-ADDR-ST,                                              
MFA-TR*               :XD-ADDR-SUFFIX,                                          
MFA-TR*               :XD-ADDR-ZIP-CODE,                                        
MFA-TR*               :XD-ADDRESS-FORMAT,                                       
MFA-TR*               :XD-ADDRESS-OVERFLOW,                                     
MFA-TR*               :XD-CARRIER-ROUTE,                                        
MFA-TR*               :XD-CREDIT-LETTER-IND,                                    
MFA-TR*               :XD-FINAL-BILL-CY-ST,                                     
MFA-TR*               :XD-FINAL-BILL-OVFL,                                      
MFA-TR*               :XD-HOUSE-NO,                                             
MFA-TR*               :XD-SEND-TO-LOCOFF-IND,                                   
MFA-TR*               :XD-STREET-LOCATION-1,                                    
MFA-TR*               :XD-STREET-LOCATION-2,                                    
MFA-TR*               :XD-STREET-NAME,                                          
MFA-TR*               :XD-STREET-SUFFIX,                                        
MFA-TR*               :XD-ZIP-CODE,                                             
MFA-TR*               :XD-ZIP-CODE-PLUS-FOUR,                                   
MFA-TR*               :XD-ZIP-CODE-TOKEN,                                       
MFA-TR*               :XD-USPS-DELIV-PT-CD,                                     
MFA-TR*               :XD-ADDR-ST-2                                             
MFA-TR*     FROM CSS_SO_FINAL_BILL                                              
MFA-TR*     WHERE SERV_ORDER_NO = :WS-SERV-ORDER-NO-D                           
MFA-TR*         QUERYNO 5155                                                    
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

REARCH                                                                  
REARCH     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE   
REARCH                                          WS-FETCH-SQLCODE.       
REARCH                                                                  
REARCH     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
REARCH                              OR    NOT-FOUND                     
REARCH        NEXT SENTENCE                                             
REARCH     ELSE                                                         
REARCH        MOVE '5155'                    TO ACTIVE-PARAGRAPH        
REARCH        MOVE 'CSS_SO_FINAL_BILL'       TO CMN-TABLE-1             
REARCH        MOVE 'ADDR_COUNTRY'            TO CMN-TABLE-ELEMENT-1     
REARCH        MOVE 'ADDR_ST'                 TO CMN-TABLE-ELEMENT-2     
REARCH        MOVE WS-ADDR-COUNTRY           TO CMN-HOSTVAR-ELEMENT-1   
REARCH        MOVE WS-ADDR-ST                TO CMN-HOSTVAR-ELEMENT-2   
REARCH        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
REARCH     END-IF.                                                      
                                                                        
REARCH 5155-EXIT.                                                       
REARCH     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5210-PROCESS-SO-FB-UMCNTRCT.                                   *        
      * PERFORMED BY 5000-UPDATE.                                      *        
      ******************************************************************        
       5210-PROCESS-SO-FB-UMCNTRCT.                                     
                                                                        
           MOVE '5210'                    TO ACTIVE-PARAGRAPH.          
                                                                        
REARCH     PERFORM 5221-OPEN-SO-FB-UMCNTRCT THRU 5221-EXIT.             
REARCH     PERFORM 5222-FETCH-SO-FB-UMCNTRCT THRU 5222-EXIT             
REARCH     PERFORM UNTIL WS-FETCH-SQLCODE = NOT-FOUND                   
REARCH     IF  WS-FETCH-SQLCODE = NOT-FOUND                             
REARCH         CONTINUE                                                 
REARCH     ELSE                                                         
                                                                        
      *                                                                         
      *       PROCESS REVISED LIGHTING CNT AMOUNT.                              
      *       NOTE: THIS LOGIC WILL BE COMMENTED OUT UNTIL THE CHANGES          
      *       FOR PCR 557 ARE APPLIED.                                          
      *                                                                         
REARCH        PERFORM 5260-PROCESS-REV-AMT      THRU 5260-EXIT          
REARCH     END-IF                                                       
REARCH         PERFORM 5222-FETCH-SO-FB-UMCNTRCT THRU 5222-EXIT         
REARCH     END-PERFORM.                                                 
REARCH     PERFORM 5223-CLOSE-SO-FB-UMCNTRCT THRU 5223-EXIT.            
                                                                        
       5210-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
REARCH* 5221-OPEN-SO-FB-UMCNTRCT.                                               
      ******************************************************************        
REARCH 5221-OPEN-SO-FB-UMCNTRCT.                                        
REARCH     EXEC SQL                                                     
REARCH        OPEN CSS-SO-FB-UMCNTRCT                                   
REARCH     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

REARCH                                                                  
REARCH     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE   
REARCH                                          WS-FETCH-SQLCODE.       
REARCH                                                                  
REARCH     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
REARCH        NEXT SENTENCE                                             
REARCH     ELSE                                                         
REARCH        MOVE '5221'                    TO ACTIVE-PARAGRAPH        
REARCH        MOVE 'CSS_SO_FB_UMCNTRCT'      TO CMN-TABLE-1             
REARCH        MOVE 'IC_NO'                   TO CMN-TABLE-ELEMENT-2     
REARCH        MOVE XF-IC-NO                  TO CMN-HOSTVAR-ELEMENT-2   
REARCH        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
REARCH     END-IF.                                                      
REARCH                                                                  
REARCH 5221-EXIT.                                                       
REARCH     EXIT.                                                        
                                                                        
      ******************************************************************        
REARCH* 5222-FETCH-SO-FB-UMCNTRCT.                                              
      ******************************************************************        
REARCH 5222-FETCH-SO-FB-UMCNTRCT.                                       
REARCH     EXEC SQL                                                     
REARCH        FETCH CSS-SO-FB-UMCNTRCT                                  
REARCH         INTO :XF-REV-INSTALL-AMT,                                
REARCH              :XF-IC-NO                                           
REARCH     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

REARCH                                                                  
REARCH     MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE       
REARCH                                      WS-FETCH-SQLCODE.           
REARCH                                                                  
REARCH     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
REARCH                              OR    NOT-FOUND                     
REARCH        NEXT SENTENCE                                             
REARCH     ELSE                                                         
REARCH        MOVE '5222'                    TO ACTIVE-PARAGRAPH        
REARCH        MOVE 'CSS_SO_FB_UMCNTRCT'      TO CMN-TABLE-1             
REARCH        MOVE 'IC_NO'                   TO CMN-TABLE-ELEMENT-2     
REARCH        MOVE XF-IC-NO                  TO CMN-HOSTVAR-ELEMENT-2   
REARCH        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
REARCH     END-IF.                                                      
REARCH                                                                  
REARCH 5222-EXIT.                                                       
REARCH     EXIT.                                                        
                                                                        
      ******************************************************************        
REARCH* 5223-CLOSE-SO-FB-UMCNTRCT.                                              
      ******************************************************************        
REARCH 5223-CLOSE-SO-FB-UMCNTRCT.                                       
REARCH     EXEC SQL                                                     
REARCH        CLOSE CSS-SO-FB-UMCNTRCT                                  
REARCH     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

REARCH                                                                  
REARCH     MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE       
REARCH                                      WS-FETCH-SQLCODE.           
REARCH                                                                  
REARCH     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
REARCH        NEXT SENTENCE                                             
REARCH     ELSE                                                         
REARCH        MOVE '5223'                    TO ACTIVE-PARAGRAPH        
REARCH        MOVE 'CSS_SO_FB_UMCNTRCT'      TO CMN-TABLE-1             
REARCH        MOVE 'IC_NO'                   TO CMN-TABLE-ELEMENT-2     
REARCH        MOVE XF-IC-NO                  TO CMN-HOSTVAR-ELEMENT-2   
REARCH        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
REARCH     END-IF.                                                      
REARCH                                                                  
REARCH 5223-EXIT.                                                       
REARCH     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5260-PROCESS-REV-AMT.                                          *        
      * PERFORMED BY 5210-PROCESS-SO-FB-UMCNTRCT.                      *        
T21446* IF CONTRACT AMT > 0 CREATE A CONTRACT OF NAME LIGHTING         *        
T21446* CANCELLATION CHARGES OF ONE TIME PAYMENT AND CREATE            *        
T21446* CONTRACT RECEIVABLE OF AMT EQUAL TO THE FINAL BILLED AMT IN    *        
T21446* PANEL046                                                       *        
T21446* IF CONTRACT AMT = 0, AR TRANS HIST ROW WRITTEN AND CONTRACT NOT*        
T21446* CREATED                                                        *        
      ******************************************************************        
       5260-PROCESS-REV-AMT.                                            
                                                                        
T21446     MOVE '5260'                         TO ACTIVE-PARAGRAPH.     
T21446*    GET CODE-SERVICE-TYPE OF UNMETERED LIGHTING CONTRACT.                
T21446     MOVE AT-ACCOUNT-NO                  TO AC-ACCOUNT-NO         
T21446                                            CP-ACCOUNT-NO.        
REARCH     MOVE XF-IC-NO                       TO CP-IC-NO.             
T21446     PERFORM 7550-GET-CUST-PLAN-INFO     THRU 7550-EXIT.          
T21446     MOVE WS-CNT-NAME-CD-LITE            TO K6-CNT-NAME-CD.       
T21446                                                                  
T21446     PERFORM 8200-SELECT-CONTRACT-INFO THRU 8200-EXIT.            
T21446     MOVE K6-GL-ACCT-NO                  TO EA-GL-ACCT-NO         
T21446     MOVE WS-E                           TO CT-CODE-CONTRACT-TYPE.
T21446*                                                                         
REARCH     IF  XF-REV-INSTALL-AMT             = 0                       
t21446         MOVE ZERO        TO CT-CNT-ITEM-ID                       
T21446         PERFORM  5295-CREATE-AR-TRANS-HIST                       
T21446             THRU 5295-EXIT                                       
T21446     ELSE                                                         
T22303         MOVE 'Y' TO  WS-CNTRCT-CREATED                           
T21446         PERFORM  5280-PROCESS-CONTRACT                           
T21446             THRU 5280-EXIT                                       
T21446         PERFORM  5285-PROCESS-CONTRACT-DET                       
T21446             THRU 5285-EXIT                                       
T21446         PERFORM  5295-CREATE-AR-TRANS-HIST                       
T21446             THRU 5295-EXIT                                       
T21446     END-IF.                                                      
T21446                                                                  
T21446 5260-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 10240000
T21446* 5280-PROCESS-CONTRACT                                         * 10250000
T21446* GET THE MAXIMUM ITEM ID ALREADY USED AND ADD 1 TO IT TO GET   * 10270000
T21446* NEXT CONTRACT-ITEM-ID TO BE USED. INITIALIZE ALL THE REQUIRED * 10280000
T21446* COLUMNS FOR THE CSS_CONTRACT TABLE AND INSERT THE CONTRACT    * 10290000
T21446***************************************************************** 10300000
T21446 5280-PROCESS-CONTRACT.                                           
T21446     MOVE CMN-ACCOUNT-NO           TO CT-ACCOUNT-NO.              
T21446     MOVE 100                      TO CT-PYMT-PRIORITY-LVL.       
REARCH     MOVE XF-REV-INSTALL-AMT                                      
T21446                                   TO CT-AMT-MO-PYMT.             
T21446     IF WS-CNT-ITEM-ID = 0                                        
T21446        PERFORM 8050-SELECT-MAX-CNT-ITEM-ID THRU 8050-EXIT        
T21446        IF WS-NULL-IND01 < 0 OR WS-CNT-ITEM-ID = 0                
T21446           MOVE 5000000            TO WS-CNT-ITEM-ID              
T21446        ELSE                                                      
T21446           ADD +1                  TO WS-CNT-ITEM-ID              
T21446        END-IF                                                    
T21446     ELSE                                                         
T21446        ADD +1                     TO WS-CNT-ITEM-ID              
T21446     END-IF.                                                      
T21446                                                                  
T21446     MOVE WS-CNT-ITEM-ID           TO CT-CNT-ITEM-ID.             
T21446     MOVE WS-CURRENT-DATE          TO CT-DATE-CONTRACT            
T21446                                      CT-DATE-PYMT-START.         
T21446     MOVE CT-AMT-MO-PYMT           TO CT-AMT-ORIG-ENTERED.        
T21446     MOVE +1                       TO CT-NO-SCHED-PYMTS.          
T21446     MOVE WS-B                     TO CT-CNT-STATUS-CD.           
T21446                                                                  
T21446     MOVE WS-CNT-NAME-CD-LITE      TO CT-CNT-NAME-CD              
T21446     MOVE ZEROES                   TO CT-AMT-TAX-STATE            
T21446                                      CT-AMT-TAX-CITY             
T21446                                      CT-AMT-TAX-OTHER.           
T21446     MOVE K6-REBATE-CD             TO CT-REBATE-CD.               
T21446     MOVE K6-INTEREST-CD           TO CT-CODE-INTRST-METH.        
T21446     MOVE K6-DFLT-INTRST-RT        TO CT-INTRST-RATE.             
T21446     MOVE CMN-USER-ID              TO CT-USER-ID.                 
T21446     MOVE WS-N                     TO CT-LIEN-CD.                 
T21446     MOVE WS-A                     TO CT-CODE-BILL-TYPE.          
T21446     MOVE WS-COMMENTS              TO CT-CONTRACT-COMMENTS-TEXT.  
T21446     MOVE LENGTH OF WS-COMMENTS    TO CT-CONTRACT-COMMENTS-LEN.   
T21446                                                                  
T21446     PERFORM 8100-INSERT-CONTRACT    THRU 8100-EXIT.              
T21446     PERFORM 5290-CREATE-AR-CONTROL  THRU 5290-EXIT.              
T21446                                                                  
T21446 5280-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 11220000
T21446* 5285-PROCESS-CNT-DETAIL                                       * 11230000
T21446* THIS PARA CREATES RECORDS IN CSS_CNT_DETAIL TABLE WITH DATA   * 11250000
T21446* RETRIEVED FROM CSS_CONTRACT_INFO FOR THE CHARGE-TYPE          * 11260000
T21446***************************************************************** 11270000
T21446 5285-PROCESS-CONTRACT-DET.                                       
T21446                                                                  
T21446     MOVE CT-ACCOUNT-NO                 TO EA-ACCOUNT-NO          
T21446     MOVE CT-CNT-ITEM-ID                TO EA-CNT-ITEM-ID         
           MOVE CT-PYMT-PRIORITY-LVL          TO EA-PYMT-PRIORITY-LVL   
T21446     MOVE CP-CODE-SERVICE-TYPE          TO EA-CODE-SERVICE-TYPE   
REARCH     MOVE XF-REV-INSTALL-AMT            TO EA-CHARGE-AM.          
T21446     MOVE K6-COST-CENTER                TO EA-COST-CENTER         
T21446     MOVE K6-CHARGE-TYPE-CD             TO EA-CHARGE-TYPE-CD      
T21446     MOVE K6-GL-ACCT-NO                 TO EA-GL-ACCT-NO          
T21446     MOVE K6-WRT-OFF-GL-ACCT-NO         TO EA-WRT-OFF-GL-ACCT-NO  
T21446                                                                  
T21446     PERFORM 8125-INSERT-CNT-DETAIL     THRU 8125-EXIT.           
T21446                                                                  
T21446 5285-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 10810000
T21446* 5290-CREATE-AR-CONTROL                                        * 10820000
T21446* THIS PARA INSERTS AR-CONTROL DETAIL RECORD FOR EACH CONTRACT  * 10840000
T21446* IF SUMMARY AR-CNTL RECORD DOES NOT EXIST THEN INSERT A SUMMARY* 10860000
T21446* RECORD.                                                       * 10870000
T21446***************************************************************** 10880000
T21446 5290-CREATE-AR-CONTROL.                                          
T21446                                                                  
T21446     MOVE CT-ACCOUNT-NO             TO AC-ACCOUNT-NO              
T21446     MOVE CT-PYMT-PRIORITY-LVL      TO AC-PYMT-PRIORITY-LVL       
T21446     MOVE CT-CNT-ITEM-ID            TO AC-ITEM-ID                 
T21446     MOVE CT-AMT-ORIG-ENTERED       TO AC-AMT-TRAN-BALANCE        
T21446                                                                  
T21446     MOVE ZEROES                    TO AC-AMT-AR-DAY-00,          
T21446                                       AC-AMT-AR-DAY-30,          
T21446                                       AC-AMT-AR-DAY-60,          
T21446                                       AC-AMT-AR-DAY-90,          
T21446                                       AC-TOT-SUMM-UNBILLED,      
T21446                                       AC-AMT-UNUSED-CR.          
T21446                                                                  
T21446     MOVE WS-CURRENT-TIMESTAMP      TO AC-LAST-UPDATE-TS.         
T21446     PERFORM  8600-INSERT-SUMM-AR-CNTL                            
T21446         THRU 8600-EXIT                                           
T21446                                                                  
T21446     MOVE ZEROES                    TO AC-ITEM-ID.                
T21446     PERFORM  6682-SELECT-AR-CNTL-NO-TS                           
T21446         THRU 6682-SELECT-NO-TS-EXIT.                             
T21446     IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
T21446        MOVE ZEROES                 TO AC-AMT-TRAN-BALANCE        
T21446        PERFORM  8600-INSERT-SUMM-AR-CNTL                         
T21446            THRU 8600-EXIT                                        
T21446     END-IF.                                                      
T21446                                                                  
T21446 5290-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 11570000
T21446* 5295-CREATE-AR-TRANS-HIST                                      *11580000
T21446* THIS PARA INITIALIZES VALUES FOR AR-TRANS-HIST-DETAIL TABLE   * 11600000
T21446* AND INSERTS ROW IN THE TABLE.                                 * 11610000
T21446***************************************************************** 11620000
T21446 5295-CREATE-AR-TRANS-HIST.                                       
                                                                        
      *    GET NEW TIMESTAMP.                                                   
           PERFORM 7200-SELECT-TIMESTAMP THRU 7200-EXIT.                
           MOVE WS-CURRENT-TIMESTAMP     TO AR-TRANS-HIST-SEQ-NO        
                                            AU-TRANS-HIST-SEQ-NO.       
                                                                        
REARCH     MOVE XF-REV-INSTALL-AMT                                      
T21446                                   TO AU-AMT-POSTED               
T21446                                      AU-CURRENCY-AMT.            
           MOVE AT-TOTAL-AR-BALANCE      TO AR-AMT-BILLED-UNPAID.       
                                                                        
      *    FORMAT AR_TRANS_HIST VARIABLES.                                      
           MOVE AT-ACCOUNT-NO            TO AR-ACCOUNT-NO.              
           MOVE WS-PROG-FINAL-BILL-LGHTG TO AR-APPL-PROGRAM-ID.         
           MOVE AU-AMT-POSTED            TO AR-AMT-ORIG-ENTERED.        
           MOVE WS-S                     TO AR-CODE-TRAN-TYPE.          
           MOVE AT-COMPANY-NO            TO AR-COMPANY-NO.              
           MOVE SPACES                   TO AR-DATE-ORIG-PYMT.          
           MOVE -1                       TO WS-DATE-ORIG-PYMT-IND.      
           MOVE WS-TODAYS-DATE           TO AR-DATE-TRANS.              
           MOVE SPACES                   TO AR-PYMT-FACILITY-CD.        
           MOVE WS-N                     TO AR-RECORD-ONLY-FL.          
           MOVE PF-RESP-AREA-ID          TO AR-RESP-AREA-ID.            
T21446     MOVE WS-COMMENTS              TO AR-TRAN-COMMENT-TEXT.       
T21446     MOVE LENGTH OF WS-COMMENTS    TO AR-TRAN-COMMENT-LEN.        
           MOVE WS-USER-ID               TO AR-USER-ID.                 
           MOVE '01'                     TO AR-CASH-COMPANY-NO.         
           MOVE '998'                    TO AR-CASH-LOCAL-OFFICE.       
           MOVE '998'                    TO AR-CASH-REPORT-NO.          
           MOVE WS-TODAYS-DATE           TO AR-DATE-CASH-REPORT.        
           MOVE +9999                    TO AR-CASH-DRAWER-ID.          
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           PERFORM 5030-LOAD-COMMON-100  THRU 5030-EXIT.                
           MOVE 1                        TO WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-DATE-LAST-ACTION      TO WS-100-DATE-LAST-ACTION.    
                                                                        
           INITIALIZE CJF00101.                                         
                                                                        
      *    FORMAT AR_TRN_HST_DET VARIABLES.                                     
           MOVE 1                        TO AU-TRAN-APPL-NO.            
           MOVE AT-ACCOUNT-NO            TO AU-ACCOUNT-NO.              
           MOVE SPACES                   TO AU-CODE-AR-AGE              
                                            WS-101-AR-AGE               
                                            AU-CURRENCY-TYPE.           
T21446     MOVE  CT-CODE-CONTRACT-TYPE   TO AU-CODE-CONTRACT-TYPE       
T21446     MOVE  CT-CNT-ITEM-ID          TO AU-ITEM-ID.                 
T21446     MOVE 'AR-CNT'                 TO GO-GL-ACCT-NAME.            
           PERFORM 7600-SELECT-GL        THRU 7600-EXIT.                
T22269     MOVE GO-GL-ACCT-NO            TO WS-101-ACCT-GEN-LED-DR      
T22269                                      AU-GL-ACCT-DEBIT.           
T22269     MOVE EA-GL-ACCT-NO            TO WS-101-ACCT-GEN-LED-CR      
                                            AU-GL-ACCT-CREDIT.          
           MOVE AR-AMT-BILLED-UNPAID     TO WS-101-ACCT-END-AR-BAL      
                                            AT-TOTAL-AR-BALANCE.        
T22294     MOVE AU-AMT-POSTED            TO WS-101-AMT-POSTED.          
T22294     MOVE AR-AMT-ORIG-ENTERED      TO WS-101-AMOUNT-ENTERED.      
                                                                        
           MOVE WS-TODAYS-DATE           TO AT-DATE-LAST-ACTION.        
           MOVE '101'                    TO WS-101-JRNL-FORMAT-NO.      
           MOVE CJF00101                 TO WS-100-USER-DEFINED-AREA.   
           MOVE AU-AMT-POSTED            TO WS-JRNL-RCV-DEBIT-AMT       
                                            WS-JRNL-GEN-LEG-CREDIT-AMT. 
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-ONLY              TO WS-JRNL-OPERATION-RQST.    
           PERFORM 6400-ONLINE-JRNL-ROUTINE      THRU 6400-EXIT.        
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                    TO WS-JRNL-WRITTEN            
           ELSE                                                         
              MOVE PROGRAM-NAME           TO ABEND-PROGRAM              
              MOVE 'USERABEN'             TO ABEND-FUNCTION             
              PERFORM 9900-SQL-ERROR-ROUTINE     THRU 9900-EXIT         
           END-IF.                                                      
                                                                        
      *    PROCESS AR TRANSACTION HISTORY.                                      
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
                                                                        
      * RESET THE PAR APPL PROGRAM VARIABLE.                                    
           MOVE PROGRAM-NAME                TO WS-PAR-APPL-PROG-ID.     
                                                                        
T21446 5295-EXIT.                                                       
           EXIT.                                                        
                                                                        
T17639******************************************************************        
T17639* 5300-LIGHTING-CONTRACT.                                        *        
T17639* PERFORMED BY 5000-UPDATE.                                      *        
T17639******************************************************************        
T17639 5300-LIGHTING-CONTRACT.                                          
T17639                                                                  
T17639     MOVE '5300' TO ACTIVE-PARAGRAPH.                             
T17639     EXEC SQL                                                     
T17639         SELECT COUNT(*)                                          
T17639           INTO :WS-LC-EXISTS                                     
T17639           FROM CSS_BILL_CONTRACT A,                              
T22325                CSS_UTIL_ENVRNMT B                                
T17639          WHERE A.ACCOUNT_NO       = :AT-ACCOUNT-NO               
T17639            AND A.CODE_UTIL_TYPE   = 'U'                          
T22325            AND A.ACCOUNT_NO       = B.ACCOUNT_NO                 
T22325            AND A.CODE_UTIL_TYPE   = B.CODE_UTIL_TYPE             
T22325            AND A.IC_NO            = B.IC_NO                      
T22325            AND B.RATE_PLAN_NO NOT IN ('025','026',               
A00759                                       '017','018',               
A00759                                       '062','067')               
T17639            AND A.CNTRCT_END_DT > IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )                
                                                            
T17639     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT COUNT(*)                                                  
MFA-TR*          INTO :WS-LC-EXISTS                                             
MFA-TR*          FROM CSS_BILL_CONTRACT A,                                      
MFA-TR*               CSS_UTIL_ENVRNMT B                                        
MFA-TR*         WHERE A.ACCOUNT_NO       = :AT-ACCOUNT-NO                       
MFA-TR*           AND A.CODE_UTIL_TYPE   = 'U'                                  
MFA-TR*           AND A.ACCOUNT_NO       = B.ACCOUNT_NO                         
MFA-TR*           AND A.CODE_UTIL_TYPE   = B.CODE_UTIL_TYPE                     
MFA-TR*           AND A.IC_NO            = B.IC_NO                              
MFA-TR*           AND B.RATE_PLAN_NO NOT IN ('025','026',                       
MFA-TR*                                      '017','018',                       
MFA-TR*                                      '062','067')                       
MFA-TR*           AND A.CNTRCT_END_DT > :WS-CURRENT-DATE                        
MFA-TR*         QUERYNO 5300                                                    
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17639     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
T17639     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T17639         NEXT SENTENCE                                            
T17639     ELSE                                                         
T17639        MOVE 'CSS_BILL_CONTRACT'        TO CMN-TABLE-1            
T17639        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T17639        MOVE 'CODE_UTIL_TYPE'           TO CMN-TABLE-ELEMENT-2    
T17639        MOVE 'CNTRCT_END_DT'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T17639        MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T17639        MOVE 'U'                        TO CMN-HOSTVAR-ELEMENT-2  
T17639        MOVE WS-CURRENT-DATE            TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
T17639        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT
           END-IF.           
T17639                                                                  
T17639     IF WS-LC-EXISTS > 0                                          
T17639         PERFORM 5310-FORMAT-WQ THRU 5310-EXIT
           END-IF.                   
T17639                                                                  
T17639 5300-EXIT.                                                       
T17639     EXIT.                                                        
                                                                        
T17639******************************************************************        
T17639* 5310-FORMAT-WQ.                                                *        
T17639* PERFORMED BY 5300-LIGHTING-CONTRACT.                           *        
T17639******************************************************************        
T17639 5310-FORMAT-WQ.                                                  
T17639                                                                  
T17639     MOVE '5310'                        TO ACTIVE-PARAGRAPH.      
ACT103     INITIALIZE CWS00077-FIELDS.                                  
T17639                                                                  
T17639     EXEC SQL                                                     
ACT103         SELECT
              CAST(SYSDATETIMEOFFSET() AS DATE)
            INTO
              :WS-77-DATE-CREATED                   
T17639     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                     39770000
MFA-TR*        SET :WS-77-DATE-CREATED = CURRENT DATE                   39780000
MFA-TR*    END-EXEC.                                                    39790000

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17639                                                                  
T17639     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T17639                                                                  
T17639     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T17639        NEXT SENTENCE                                             
T17639     ELSE                                                         
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-1  
T17639        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T17639     END-IF.                                                      
ACT103     MOVE 28                        TO WS-77-CATEGORY-ID.         
ACT103     MOVE PF-RESP-AREA-ID           TO WS-77-RESP-AREA-ID.        
ACT103     MOVE CMN-SERV-ORDER-NO         TO WS-77-SERV-ORDER-NO.       
ACT103     MOVE CMN-USER-ID               TO WS-77-USER-ID-ORIG.        
ACT103     MOVE WS-77-DATE-CREATED        TO WS-77-DATE-REQUIRED.       
ACT103     MOVE AT-ACCOUNT-NO             TO WS-77-ACCOUNT-NO.          
ACT103     MOVE PR-PREMISE-NO             TO WS-77-PREMISE-NO.          
ACT103     MOVE CU-CUSTOMER-NO            TO WS-77-CUSTOMER-NO.         
ACT103     MOVE AT-LOCAL-OFFICE           TO WS-77-LOCAL-OFFICE.        
ACT103     MOVE '1'                       TO WS-77-ROUTE-CATEGORY.      
ACT103     MOVE 'N'                       TO WS-77-PRIORITY.            
ACT103     MOVE WS-LC-MESSAGE             TO WS-77-COMMENTS-TEXT.       
ACT103     MOVE LENGTH OF WS-LC-MESSAGE   TO WS-77-COMMENTS-LEN.        
ACT103     MOVE SPACES                    TO WS-77-FREE-FORM-TXT.       
ACT103     MOVE ZERO                      TO WS-77-FREE-FORM-LEN.       
ACT103     MOVE PROGRAM-NAME              TO WS-77-CREATED-BY.          
T17639     PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT.               
T17639                                                                  
T17639 5310-EXIT.                                                       
T17639     EXIT.                                                        
                                                                        
T20243*****************************************************************         
T20243* 5315- CREATE-CIA-RECORD                                                 
T20243*****************************************************************         
T20243 5315-CREATE-CIA-RECORD.                                          
           MOVE 0                         TO AC-AMT-AR-DAY-00           
T20243     MOVE WS-AMT-POSTED             TO AC-AMT-UNUSED-CR           
T17989     MOVE 'A'                       TO WS-CODE-CIA                
T17989     PERFORM 7997-CIA-SUMM-EXISTS   THRU 7997-EXIT                
T17989     IF  WS-ACTIVE-RETURN-CODE = NOT-FOUND                        
T17989         MOVE AT-ACCOUNT-NO         TO AC-ACCOUNT-NO              
T17989         MOVE 70                    TO AC-PYMT-PRIORITY-LVL       
T17989         MOVE 0                     TO AC-ITEM-ID                 
T17989                                       AC-AMT-AR-DAY-30           
T17989                                       AC-AMT-AR-DAY-60           
T17989                                       AC-AMT-AR-DAY-90           
T17989                                       AC-AMT-TRAN-BALANCE        
T17989                                       AC-TOT-SUMM-UNBILLED       
T17989         MOVE WS-PROGRAM-TIMESTAMP  TO AC-LAST-UPDATE-TS          
T17989         PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT       
T17989         MOVE 1                     TO AC-ITEM-ID                 
T17989         MOVE AC-AMT-UNUSED-CR      TO AC-AMT-TRAN-BALANCE        
T17989         MOVE WS-PROGRAM-TIMESTAMP  TO AC-LAST-UPDATE-TS          
T17989         PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT       
T17989         MOVE 0                     TO AC-AMT-TRAN-BALANCE        
T17989                                       AC-AMT-UNUSED-CR           
T17989     ELSE                                                         
T17989         MOVE AT-ACCOUNT-NO         TO AC-ACCOUNT-NO              
T17989         MOVE 70                    TO AC-PYMT-PRIORITY-LVL       
T17989         MOVE 0                     TO AC-ITEM-ID                 
T17989                                       AC-AMT-AR-DAY-30           
T17989                                       AC-AMT-AR-DAY-60           
T17989                                       AC-AMT-AR-DAY-90           
T17989                                       AC-AMT-TRAN-BALANCE        
T17989                                       AC-TOT-SUMM-UNBILLED       
T17989         MOVE WS-PROGRAM-TIMESTAMP  TO AC-LAST-UPDATE-TS          
T17989         PERFORM 8470-UPDATE-CIA    THRU 8470-EXIT                
T17989         MOVE 1                     TO AC-ITEM-ID                 
T17989         MOVE AC-AMT-UNUSED-CR      TO AC-AMT-TRAN-BALANCE        
T17989         MOVE WS-PROGRAM-TIMESTAMP  TO AC-LAST-UPDATE-TS          
T17989         PERFORM 7998-CIA-DET1-EXISTS        THRU 7998-EXIT       
T17989         IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
T17989             PERFORM 8470-UPDATE-CIA             THRU 8470-EXIT   
T17989         ELSE                                                     
T17989             PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT   
T17989         END-IF                                                   
T17989         MOVE 0                      TO AC-AMT-TRAN-BALANCE       
T17989                                        AC-AMT-UNUSED-CR          
T17989     END-IF.                                                      
       5315-EXIT.                                                       
           EXIT.                                                        
                                                                        
T20243******************************************************************        
T20243* CREATE A DUMMMY ROW FOR UTE AND UTG IN CSS-AR-CNTL             *        
T20243******************************************************************        
       5316-CREATE-UTE-UTG-AR.                                          
           MOVE AT-ACCOUNT-NO         TO AC-ACCOUNT-NO                  
           MOVE 0                     TO AC-ITEM-ID                     
                                         AC-AMT-AR-DAY-00               
                                         AC-AMT-AR-DAY-30               
                                         AC-AMT-AR-DAY-60               
                                         AC-AMT-AR-DAY-90               
                                         AC-AMT-TRAN-BALANCE            
                                         AC-TOT-SUMM-UNBILLED           
           IF  UTE-EXISTS                                               
               MOVE 40                   TO AC-PYMT-PRIORITY-LVL        
               PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT       
           END-IF.                                                      
           IF  UTG-EXISTS                                               
               MOVE 45                   TO AC-PYMT-PRIORITY-LVL        
               PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT       
           END-IF.                                                      
                                                                        
       5316-EXIT.                                                       
           EXIT.                                                        
                                                                        
T22976 5400-UPDATE-LIGHTING-CONTRACT.                                   
T22976                                                                  
T22976     MOVE AT-ACCOUNT-NO TO UT-ACCOUNT-NO.                         
T22976     PERFORM 7900-OPEN-LIGHT-CURSOR THRU 7900-EXIT.               
T22976     PERFORM 7910-FETCH-LIGHT-CURSOR THRU 7910-EXIT.              
T22976     PERFORM UNTIL WS-FETCH-SQLCODE = NOT-FOUND                   
T22976         PERFORM 8250-UPDATE-CONTRACT    THRU 8250-EXIT           
T22976         PERFORM 7910-FETCH-LIGHT-CURSOR THRU 7910-EXIT           
T22976     END-PERFORM.                                                 
T22976     PERFORM 7920-CLOSE-LIGHT-CURSOR THRU 7920-EXIT.              
T22976                                                                  
T22976 5400-EXIT.                                                       
T22976     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5500-UPDATE-THD-PRTY.           *                                       
      * MAKE THIRD PARTY INACITVE WHEN ACCOUNT IS FINAL-BILLED         *        
      ******************************************************************        
C32832 5500-UPDATE-THD-PRTY.                                            
                                                                        
C32832     PERFORM 7940-OPEN-THD-PRTY-CURSOR           THRU 7940-EXIT.  
C32832     PERFORM 7950-FETCH-THD-PRTY-CURSOR          THRU 7950-EXIT.  
C32832     PERFORM UNTIL WS-FETCH-SQLCODE = NOT-FOUND                   
C32832     MOVE SPACES         TO ZW-DATE-NEXT-ANNIV                    
C32832     IF ZW-DATE-NEXT-ANNIV      EQUAL SPACES                      
C32832       MOVE -1           TO WS-NULL-DATE-NEXT-ANNIV               
C32832     END-IF                                                       
C32832     PERFORM 8560-UPDATE-THD-PRTY                THRU 8560-EXIT   
C32832     MOVE ZW-THD-PRTY-ID TO ZX-THD-PRTY-ID                        
C32832     IF WS-CODE-SO-ACCT-XFER NOT EQUAL WS-A                       
C32832     PERFORM 7965-OPEN-TP-HIST-CURSOR            THRU 7965-EXIT   
C32832     PERFORM 7970-FETCH-TP-HIST-CURSOR           THRU 7970-EXIT   
C32832     PERFORM UNTIL WS-FETCH-SQLCODE = NOT-FOUND                   
C32832     IF (ZX-LETTER-TYPE-CD = 'A' OR ZX-LETTER-TYPE-CD = 'C')      
C32832      AND ZX-LETTER-STATUS = 'P'                                  
C32832     PERFORM 8570-UPDATE-THD-PRTY-HIST           THRU 8570-EXIT   
C32832     END-IF                                                       
C32832     PERFORM 7970-FETCH-TP-HIST-CURSOR           THRU 7970-EXIT   
C32832     END-PERFORM                                                  
                                                                        
C32832     MOVE WS-CURRENT-TIMESTAMP     TO ZX-DATE-TRANS               
C32832     MOVE 'I'                      TO ZX-LETTER-TYPE-CD           
C32832     MOVE 'P'                      TO ZX-LETTER-STATUS            
C32832     MOVE CMN-USER-ID              TO ZX-USER-ID                  
C32832     MOVE SPACES                   TO ZX-DATE-MAILED              
C32832     IF ZX-DATE-MAILED       EQUAL SPACES                         
C32832     MOVE -1                       TO WS-NULL-DATE-MAILED         
C32832     END-IF                                                       
C32832     PERFORM 8580-INSERT-THD-PRTY-HIST           THRU 8580-EXIT   
C32832     PERFORM 7975-CLOSE-TP-HIST-CURSOR           THRU 7975-EXIT   
C32832     END-IF                                                       
C32832     PERFORM 7950-FETCH-THD-PRTY-CURSOR          THRU 7950-EXIT   
C32832     END-PERFORM.                                                 
C32832     PERFORM 7960-CLOSE-THD-PRTY-CURSOR          THRU 7960-EXIT.  
                                                                        
C32832  5500-EXIT.                                                      
C32832     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5600-PROCESS-FINAL-BILL.                                       *        
      * PERFORMED BY 5000-UPDATE.                                      *        
      ******************************************************************        
       5600-PROCESS-FINAL-BILL.                                         
                                                                        
           MOVE '5600'                   TO ACTIVE-PARAGRAPH.           
                                                                        
T17984     PERFORM 8700-SEARCH-FOR-RCC         THRU 8700-EXIT.          
T17984     IF WS-RCC-FOUND = 'Y'                                        
              PERFORM 5700-CHECK-FOR-FACTOR    THRU 5700-EXIT           
T17984        PERFORM 8710-DELETE-RCC          THRU 8710-EXIT
           END-IF.          
                                                                        
      *    OPEN CURSOR OF SUMMARY AR RECEIVABLES.                               
           MOVE AT-ACCOUNT-NO            TO AC-ACCOUNT-NO.              
           MOVE 0                        TO AC-ITEM-ID.                 
           PERFORM 7000-OPEN-SUMM-AR-CNTL            THRU 7000-EXIT.    
                                                                        
      *    APPLY ALL RECEIVABLE CREDIT BALANCES.                                
           MOVE WS-NO                    TO WS-IS-THIS-DIRECTED-PYMT.   
           MOVE WS-I                     TO WS-PAR-CODE-TRAN-TYPE.      
                                                                        
           PERFORM 5601-USE-CREDIT-BALANCES          THRU 5601-EXIT     
              UNTIL NO-MORE-CREDIT.                                     
                                                                        
      *    CLOSE CURSOR OF SUMMARY AR RECEIVABLES.                              
           PERFORM 7001-CLOSE-SUMM-AR-CNTL           THRU 7001-EXIT.    
                                                                        
           PERFORM 5010-PREPARE-JOURNAL              THRU 5010-EXIT.    
                                                                        
T22772*    OPEN CURSOR OF AR RECEIVABLES.                                       
T22772     MOVE WS-ACCOUNT-NO            TO AC-ACCOUNT-NO.              
T22772     PERFORM 7060-OPEN-AMT-TRAN                THRU 7060-EXIT.    
T22772     PERFORM 5605-USE-AMT-TRAN                 THRU 5605-EXIT.    
T22772     PERFORM 7061-CLOSE-AMT-TRAN               THRU 7061-EXIT.    
T22772*                                                                         
      *    SELECT BILL HOOK HEADER.                                             
           MOVE AT-ACCOUNT-NO            TO BI-ACCOUNT-NO.              
           PERFORM 7300-SELECT-CSS-BILLING-HDR       THRU 7300-EXIT.    
                                                                        
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
              NEXT SENTENCE                                             
           ELSE                                                         
      *       PROCESS BILL HEADER AND DETAILS.                                  
              MOVE AT-ACCOUNT-NO         TO BG-ACCOUNT-NO               
              MOVE BI-BILL-NO            TO BG-BILL-NO                  
              PERFORM 7020-OPEN-CSS-BILLING-DET      THRU 7020-EXIT     
              PERFORM 7120-FETCH-CSS-BILLING-DET     THRU 7120-EXIT     
T22600        IF WS-ACTIVE-RETURN-CODE = 0 AND                          
T19715           WS-BTU-FACTOR GREATER THAN 0 THEN                      
                    MOVE WS-BTU-FACTOR      TO BG-BTU-FACTOR            
                    PERFORM 8420-UPDATE-CSS-BILLING-DET                 
                                                  THRU 8420-EXIT        
T19715        END-IF                                                    
      *       CANCEL BILLING DETAIL RECORDS IF NO CONSUMPTION EXISTS.           
              PERFORM 5610-CHECK-FOR-CNSMPTN-HIST    THRU 5610-EXIT     
                 UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND                
                 OR    (CNSMPTN-HIST-WAS-FOUND)                         
                                                                        
              PERFORM 7021-CLOSE-CSS-BILLING-DET     THRU 7021-EXIT     
                                                                        
T19626        MOVE WS-B                TO BI-CODE-BILL-STATUS           
T19758                                    BI-CODE-BILL-TYPE             
T19626        PERFORM 8400-UPDATE-CSS-BILLING-HDR THRU 8400-EXIT        
T19626     END-IF.                                                      
                                                                        
      *    RESET TRANSACTION HISTORY COUNTER.                                   
           MOVE 0                        TO WS-TRAN-APPL-NO.            
                                                                        
      *    CHECK FOR DFA/DPP RECEIVABLE.                                        
           MOVE AT-ACCOUNT-NO            TO AC-ACCOUNT-NO               
           MOVE WS-90                    TO AC-PYMT-PRIORITY-LVL        
           MOVE 0                        TO AC-ITEM-ID                  
           MOVE WS-PROG-FINAL-BILL-DFA   TO WS-PAR-APPL-PROG-ID.        
                                                                        
           PERFORM 7240-SELECT-SUMM-AR-CNTL          THRU 7240-EXIT     
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              PERFORM 7200-SELECT-TIMESTAMP          THRU 7200-EXIT     
              MOVE WS-CURRENT-TIMESTAMP     TO WS-DFA-TIMESTAMP         
              MOVE AC-ACCOUNT-NO            TO WS-AC-ACCOUNT-NO         
              MOVE AC-PYMT-PRIORITY-LVL     TO WS-AC-PYMT-PRIORITY-LVL  
              MOVE 0                        TO WS-AC-ITEM-ID            
T23010        MOVE 'N'                      TO WS-END-OF-PROCESS-DFA    
              PERFORM 7010-OPEN-DET-AR-CNTL        THRU 7010-EXIT       
              PERFORM 5651-PROCESS-DFA-BILL        THRU 5651-EXIT       
T23010          UNTIL WS-END-OF-PROCESS-DFA = 'Y'                       
              PERFORM 7015-CLOSE-DET-AR-CNTL       THRU 7015-EXIT       
           END-IF.                                                      
                                                                        
      *    RESET TRANSACTION HISTORY COUNTER.                                   
           MOVE 0                        TO WS-TRAN-APPL-NO.            
                                                                        
      *    CHECK FOR CONTRACT RECEIVABLE.                                       
           MOVE AT-ACCOUNT-NO            TO AC-ACCOUNT-NO               
           MOVE WS-100                   TO AC-PYMT-PRIORITY-LVL        
           MOVE 0                        TO AC-ITEM-ID                  
           MOVE WS-PROG-FINAL-BILL-CNT   TO WS-PAR-APPL-PROG-ID.        
                                                                        
           PERFORM 7240-SELECT-SUMM-AR-CNTL          THRU 7240-EXIT     
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              PERFORM 5650-BILL-FULL-AMOUNT          THRU 5650-EXIT     
           END-IF.                                                      
                                                                        
           IF AT-MST-SUB-ACCT-IND = 'S'                                 
              MOVE AT-ACCOUNT-NO         TO CT-ACCOUNT-NO               
                                            WS-HOLD-ACCOUNT-NO          
                                                                        
              MOVE WS-HOLD-ACCOUNT-NO    TO AT-ACCOUNT-NO               
                                            AC-ACCOUNT-NO               
           END-IF.                                                      
                                                                        
      *    PROCESS OFF CYCLE ACCOUNT.                                           
           PERFORM 7200-SELECT-TIMESTAMP             THRU 7200-EXIT.    
           MOVE WS-CURRENT-TIMESTAMP     TO OC-LAST-UPDATE-TS.          
REARCH     IF WS-CREDIT-LETTER-IND         = WS-YES                     
              MOVE WS-YES                TO OC-CREDIT-LETTER-IND        
           ELSE                                                         
              MOVE WS-NO                 TO OC-CREDIT-LETTER-IND        
           END-IF.                                                      
           MOVE WS-B                     TO OC-CODE-BILL-OFF-CYCL.      
           MOVE WS-NO                    TO WS-ROWS-FOUND.              
           MOVE AT-ACCOUNT-NO            TO OC-ACCOUNT-NO.              
           MOVE AT-CUSTOMER-NO           TO OC-CUSTOMER-NO.             
           MOVE 0                        TO OC-ITEM-ID.                 
BILGEN*    PERFORM 8510-INSERT-CSS-OFF-CYCL-ACCT  THRU 8510-EXIT.               
BILGEN*    DO NOT INSERT CSS_OFF_CYCL_ACCT FOR BILLGEN ACCOUNT                  
BILGEN     IF AT-EXT-BILLING-FL = 'Y' OR                                
C27363        AT-CODE-ACCT-BILLED = 'H' OR                              
P00914        MN-ACCOUNT-NO > ZEROES                                    
BILGEN            NEXT SENTENCE                                         
BILGEN     ELSE                                                         
BILGEN        PERFORM 8510-INSERT-CSS-OFF-CYCL-ACCT                     
BILGEN                                            THRU 8510-EXIT        
BILGEN     END-IF.                                                      
                                                                        
           IF WS-JRNL-WRITTEN = 'Y'                                     
              PERFORM 5020-TERMINATE-JOURNAL      THRU 5020-EXIT        
           END-IF.                                                      
                                                                        
A00581     IF WS-CODE-MEDICAL = 'A'                                     
A00581      PERFORM 8490-UPDATE-MED-CERT      THRU 8490-EXIT            
A00581      MOVE AT-CODES-DATA-PRESENT        TO WS-CODES-DATA-PRESENT  
A00581      MOVE SPACES                       TO WS-CODE-MEDICAL        
A00581      MOVE WS-CODES-DATA-PRESENT        TO AT-CODES-DATA-PRESENT  
A00581      PERFORM 8311-UPDATE-AT-CODES      THRU 8311-EXIT            
A00581     END-IF.                                                      
                                                                        
      *    PROCESS APPLYING DEPOSITS TO BILL.                                   
           PERFORM 5660-APPLY-DEPOSIT-TO-BILL     THRU 5660-EXIT.       
      *                                                                         
       5600-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5601-USE-CREDIT-BALANCES.                                      *        
      * APPLIES UNSUSED CREDIT BALANCES.                               *        
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                          *        
      ******************************************************************        
       5601-USE-CREDIT-BALANCES.                                        
                                                                        
           MOVE '5601'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           MOVE 0                        TO WS-PAR-TYPE-NO              
                                            WS-PAR-TRAN-APPL-NO         
                                            AU-TRAN-APPL-NO.            
                                                                        
      *    FETCH SUMMARY AR RECEIVABLE.                                         
           PERFORM 7100-FETCH-SUMM-AR-CNTL           THRU 7100-EXIT.    
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
      *       EXIT IF RECEIVABLE IS UTILITY ELECTRIC OR GAS.                    
              IF AC-PYMT-PRIORITY-LVL = WS-40 OR WS-45 OR WS-70         
                 GO TO 5601-EXIT                                        
              ELSE                                                      
                 CONTINUE                                               
              END-IF                                                    
           ELSE                                                         
      *       EXIT IF NO MORE SUMMARY ROWS ARE FOUND.                           
              MOVE WS-YES                TO WS-NO-MORE-CREDIT           
              GO TO 5601-EXIT                                           
           END-IF.                                                      
                                                                        
           MOVE AT-CODES-DATA-PRESENT    TO WS-CODES-DATA-PRESENT.      
                                                                        
      *    CHECK IF UNUSED CREDIT EXISTS.                                       
           IF AC-AMT-UNUSED-CR < 0                                      
              MULTIPLY AC-AMT-UNUSED-CR BY -1 GIVING WS-PAYMENT-AMOUNT  
              MOVE 0                     TO AC-AMT-UNUSED-CR            
              ADD WS-PAYMENT-AMOUNT      TO AT-TOTAL-AR-BALANCE         
                                                                        
      *       DELETE SUMMARY RECEIVABLE.                                        
              PERFORM 8860-DELETE-SUMM-AR-CNTL       THRU 8860-EXIT     
              EVALUATE AC-PYMT-PRIORITY-LVL                             
              WHEN WS-19                                                
                 MOVE SPACES             TO WS-CODE-NSF-CHK-CHG         
              WHEN WS-20                                                
                 MOVE SPACES             TO WS-CODE-NSF-CHK-AMT         
              WHEN WS-29                                                
                 MOVE SPACES             TO WS-CODE-NSF-CHK-AMT         
              WHEN WS-30                                                
                 MOVE SPACES             TO WS-CODE-LPC                 
              WHEN WS-39                                                
                 MOVE SPACES             TO WS-CODE-LPC                 
              END-EVALUATE                                              
                                                                        
      *       UPDATE CSS_ACCOUNT SO 6700 DOES NOT OVERLAY FIELDS.               
              MOVE WS-CODES-DATA-PRESENT TO AT-CODES-DATA-PRESENT       
                                                                        
              IF WS-ACCT-CHG-JRNL-DONE = 'N'                            
                 PERFORM 8305-JRNL-ACCT-STAT-CHG     THRU 8305-EXIT     
              END-IF                                                    
                                                                        
              PERFORM 8310-UPDATE-CSS-ACCOUNT        THRU 8310-EXIT     
C32671        MOVE AT-ACCOUNT-NO                     TO PJ-ACCOUNT-NO   
C32671        PERFORM 8480-UPDATE-PJS                THRU 8480-EXIT     
                                                                        
              EVALUATE AC-PYMT-PRIORITY-LVL                             
              WHEN WS-19                                                
                 MOVE WS-AR-NSC-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-20                                                
                 MOVE WS-AR-NSA-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-29                                                
                 MOVE WS-AR-NSN-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-30                                                
                 MOVE WS-AR-LPC-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-39                                                
                 MOVE WS-AR-LPN-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-60                                                
                 MOVE WS-AR-CCC-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-80                                                
                 MOVE WS-AR-DEP-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-90                                                
                 MOVE WS-AR-DFA-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-100                                               
                 MOVE WS-AR-CNT-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-129                                               
                 MOVE WS-AR-PJS-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              WHEN WS-999                                               
                 MOVE WS-AR-ADJ-GL-NO (WS-GL-SUB) TO WS-PAR-GEN-LEDG-DB 
              END-EVALUATE                                              
                                                                        
      *       LOAD PAYMENT PRIORITY TABLE FOR UNDIRECTED PAYMENT.               
              IF PPL-TABLE-LOADED                                       
                 CONTINUE                                               
              ELSE                                                      
                 MOVE 1                  TO C9-PMT-PRTY-SCHEDULE        
                 PERFORM 6722B-OPEN-AR-PMT-PRTY      THRU 6722B-EXIT    
                 PERFORM 6722C-FETCH-AR-PMT-PRTY     THRU 6722C-EXIT    
                 PERFORM 6722D-LOAD-AR-PMT-PRTY      THRU 6722D-EXIT    
                    VARYING WS-PAR-SUB FROM 1 BY 1                      
                       UNTIL WS-PAR-SUB GREATER THAN 52                 
                       OR WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND         
                 PERFORM 6722E-CLOSE-AR-PMT-PRTY     THRU 6722E-EXIT    
                 MOVE WS-YES             TO WS-PPL-TABLE-LOADED         
              END-IF                                                    
                                                                        
      *       APPLY UNUSED CREDIT PAYMENT.                                      
              MOVE WS-PAYMENT-AMOUNT     TO WS-AMT-CASH                 
                                            WS-PAYMENT-AMOUNT-TOTAL     
              PERFORM 6700-APPLY-PAYMENT             THRU 6700-EXIT     
              IF PYMT-WAS-SUCCESSFUL                                    
      *          PROCESS CASH DRAWER JOURNAL.                                   
                 MOVE WS-JRNL-CNTRL-ONLY TO WS-JRNL-OPERATION-RQST      
                 PERFORM 6400-ONLINE-JRNL-ROUTINE    THRU 6400-EXIT     
                 IF WS-JRNL-RTRN-CODE EQUAL SPACES                      
                    CONTINUE                                            
                 ELSE                                                   
                    MOVE PROGRAM-NAME    TO ABEND-PROGRAM               
                    MOVE 'USERABEN'      TO ABEND-FUNCTION              
                    PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT     
                 END-IF                                                 
              ELSE                                                      
                 MOVE PROGRAM-NAME       TO ABEND-PROGRAM               
                 MOVE 'USERABEN'         TO ABEND-FUNCTION              
                 PERFORM 9900-SQL-ERROR-ROUTINE      THRU 9900-EXIT     
              END-IF                                                    
           END-IF.                                                      
                                                                        
       5601-EXIT.                                                       
           EXIT.                                                        
                                                                        
T22772******************************************************************        
T22772* 5605-USE-AMT-TRAN.                                             *        
T22772* PERFORMED BY 5600-PROCESS-FINAL-BILL.                          *        
T22772******************************************************************        
T22772 5605-USE-AMT-TRAN.                                               
T22772     PERFORM 7160-FETCH-AMT-TRAN             THRU 7160-EXIT.      
T22772     PERFORM UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND              
T22772       COMPUTE  WS-CREDIT-BALANCE =                               
T22772                        WS-CREDIT-BALANCE + AC-AMT-TRAN-BALANCE   
T22772       PERFORM 8900-DELETE-AR-CNTL           THRU 8900-EXIT       
T22772       PERFORM 7160-FETCH-AMT-TRAN           THRU 7160-EXIT       
T22772     END-PERFORM.                                                 
T22772     MOVE AT-ACCOUNT-NO              TO AC-ACCOUNT-NO.            
T23387     PERFORM 8910-CHK-RCC-DEBIT              THRU 8910-EXIT.      
T22772     IF  WS-CREDIT-BALANCE < 0                                    
T22772         INITIALIZE CJF00101                                      
T22772                                                                  
T22772         MOVE WS-CREDIT-BALANCE      TO WS-AMT-POSTED             
T22772         MOVE 101                    TO WS-101-JRNL-FORMAT-NO     
T22772         MOVE SPACES                 TO WS-101-CASH-DRAWER-USED   
T22772         MOVE 0                      TO WS-101-ITEM-ID-NO         
T22772         MOVE PR-REV-DISTRICT-CD     TO                           
T22772                                    WS-101-CODE-REVENUE-DISTRICT  
T22772         MOVE CU-CODE-EMPL-ACCT      TO WS-101-CODE-EMPL-ACCT     
T22772         MOVE AT-CODE-COMPANY-ACCT   TO WS-101-CODE-COMPANY-ACCT  
T22772         MOVE PR-CODE-PREMISE-STAT   TO WS-101-CODE-PREMISE-STATUS
T22772                                                                  
T22772         PERFORM 7200-SELECT-TIMESTAMP       THRU 7200-EXIT       
T22772         MOVE WS-CURRENT-TIMESTAMP   TO WS-PROGRAM-TIMESTAMP      
T22772                                        AR-TRANS-HIST-SEQ-NO      
T22772                                        AU-TRANS-HIST-SEQ-NO      
T22772         COMPUTE WS-CREDIT-BALANCE = WS-CREDIT-BALANCE * -1       
T22772                                                                  
T22772*       FORMAT AR_TRN_HST_DET VARIABLES.                                  
T22772         MOVE AT-ACCOUNT-NO          TO AU-ACCOUNT-NO             
T22772         MOVE SPACES                 TO AU-CURRENCY-TYPE          
T22772         MOVE 0                      TO AU-ITEM-ID                
T22772                                        AU-TRAN-APPL-NO           
T22772         MOVE WS-CREDIT-BALANCE      TO AU-AMT-POSTED,            
T22772                                        AU-CURRENCY-AMT           
T22772                                                                  
T22772*       FORMAT AR_TRANS_HIST VARIABLES.                                   
T22772         MOVE AT-ACCOUNT-NO          TO AR-ACCOUNT-NO             
T22772         MOVE WS-D                   TO AR-CODE-TRAN-TYPE         
T22772         MOVE AT-COMPANY-NO          TO AR-COMPANY-NO             
T22772         MOVE SPACES                 TO AR-DATE-ORIG-PYMT         
T22772         MOVE -1                     TO WS-DATE-ORIG-PYMT-IND     
T22772         MOVE WS-TODAYS-DATE         TO AR-DATE-TRANS             
T22772         MOVE SPACES                 TO AR-PYMT-FACILITY-CD       
T22772         MOVE WS-N                   TO AR-RECORD-ONLY-FL         
T22772         MOVE WS-PROG-RCC-TO-CIA     TO AR-APPL-PROGRAM-ID        
T22772         MOVE PF-RESP-AREA-ID        TO AR-RESP-AREA-ID           
T22772         MOVE WS-USER-ID             TO AR-USER-ID                
T22772         MOVE '01'                   TO AR-CASH-COMPANY-NO        
T22772         MOVE '998'                  TO AR-CASH-LOCAL-OFFICE      
T22772         MOVE '998'                  TO AR-CASH-REPORT-NO         
T22772         MOVE WS-TODAYS-DATE         TO AR-DATE-CASH-REPORT       
T22772         MOVE +9999                  TO AR-CASH-DRAWER-ID         
T22772         MOVE WS-CREDIT-BALANCE      TO AR-AMT-ORIG-ENTERED       
T22772         COMPUTE AT-TOTAL-AR-BALANCE =  AT-TOTAL-AR-BALANCE +     
T22772                                        WS-AMT-POSTED             
T22772         MOVE AT-TOTAL-AR-BALANCE    TO AR-AMT-BILLED-UNPAID      
T22772         PERFORM 5840-UPDATE-TOTAL-AR-BALANCE THRU 5840-EXIT      
T22772         PERFORM 5827-RCC-TO-CIA-PROCESS      THRU 5827-EXIT      
T22772     END-IF.                                                      
T22772                                                                  
T22772 5605-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5610-CHECK-FOR-CNSMPTN-HIST.                                   *        
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                          *        
      ******************************************************************        
       5610-CHECK-FOR-CNSMPTN-HIST.                                     
                                                                        
           MOVE '5610'                   TO ACTIVE-PARAGRAPH.           
                                                                        
      *    DETERMINE IF CONSUMPTION RECORDS EXIST.                              
           MOVE AT-ACCOUNT-NO            TO CX-ACCOUNT-NO.              
           MOVE BG-BILL-NO               TO CX-BILL-NO.                 
           MOVE BG-CODE-UTIL-TYPE        TO CX-CODE-UTIL-TYPE.          
           MOVE BG-IC-NO                 TO CX-IC-NO.                   
           MOVE WS-NO                    TO WS-ROWS-FOUND.              
           PERFORM 7310-SELECT-CSS-CNSMPTN-HIST   THRU 7310-EXIT.       
                                                                        
      *    CANCEL BILLING DETAIL IF NO CONSUMPTION RECORDS EXIST.               
           IF NO-ROWS-FOUND                                             
              PERFORM 7120-FETCH-CSS-BILLING-DET  THRU 7120-EXIT        
           ELSE                                                         
              MOVE WS-YES                TO WS-CNSMPTN-HIST-WAS-FOUND   
           END-IF.                                                      
                                                                        
       5610-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5650-BILL-FULL-AMOUNT.                                         *        
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                          *        
      ******************************************************************        
       5650-BILL-FULL-AMOUNT.                                           
                                                                        
           MOVE '5650'                   TO ACTIVE-PARAGRAPH.           
                                                                        
      *    OPEN DETAIL AR CURSOR.                                               
           MOVE AC-ACCOUNT-NO            TO WS-AC-ACCOUNT-NO.           
           MOVE AC-PYMT-PRIORITY-LVL     TO WS-AC-PYMT-PRIORITY-LVL.    
           MOVE 0                        TO WS-AC-ITEM-ID.              
           PERFORM 7010-OPEN-DET-AR-CNTL        THRU 7010-EXIT.         
                                                                        
           EVALUATE WS-AC-PYMT-PRIORITY-LVL                             
                                                                        
           WHEN WS-100                                                  
      *       PROCESS CONTRACT RECEIVABLE.                                      
              PERFORM 5652-PROCESS-CNT-BILL     THRU 5652-EXIT          
                 UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND                
                                                                        
           END-EVALUATE.                                                
                                                                        
           PERFORM 7015-CLOSE-DET-AR-CNTL       THRU 7015-EXIT.         
                                                                        
       5650-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5651-PROCESS-DFA-BILL.                                         *        
      * PERFORMED BY 5650-BILL-FULL-AMOUNT.                            *        
      ******************************************************************        
       5651-PROCESS-DFA-BILL.                                           
                                                                        
           MOVE '5651'                      TO ACTIVE-PARAGRAPH.        
                                                                        
           PERFORM 7110-FETCH-DET-AR-CNTL            THRU 7110-EXIT     
                                                                        
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
T23010        MOVE 'Y'                      TO WS-END-OF-PROCESS-DFA    
           ELSE                                                         
              MOVE WS-AC-ITEM-ID            TO WS-DFA-ITEM-ID           
T18175        PERFORM 7200-SELECT-TIMESTAMP          THRU 7200-EXIT     
T18175        MOVE WS-CURRENT-TIMESTAMP     TO WS-DFA-TIMESTAMP         
T18175        MOVE 0                        TO WS-DFA-OUTSTANDING       
              PERFORM 6630-REVERSE-DFA THRU 6630-EXIT                   
           END-IF.                                                      
                                                                        
       5651-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5652-PROCESS-CNT-BILL.                                         *        
      * PERFORMED BY 5650-BILL-FULL-AMOUNT.                            *        
      ******************************************************************        
       5652-PROCESS-CNT-BILL.                                           
                                                                        
           MOVE '5652'                      TO ACTIVE-PARAGRAPH.        
                                                                        
           PERFORM 7110-FETCH-DET-AR-CNTL            THRU 7110-EXIT     
                                                                        
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
              NEXT SENTENCE                                             
           ELSE                                                         
      *       SELECT CONTRACT DETAILS.                                          
              MOVE WS-AC-ACCOUNT-NO         TO CT-ACCOUNT-NO            
              MOVE WS-AC-PYMT-PRIORITY-LVL  TO CT-PYMT-PRIORITY-LVL     
              MOVE WS-AC-ITEM-ID            TO CT-CNT-ITEM-ID           
              PERFORM 7330-SELECT-CSS-CONTRACT       THRU 7330-EXIT     
                                                                        
C26298*       CHECK FOR THE CONTRACT STATUS AND RESTRICT THE OFF ORDER,         
C26298*       IF PENDING CONTRACT EXISTS AND CREATE WQ                          
C26298        IF CT-CNT-STATUS-CD = WS-A AND AT-COMPANY-NO = '26'       
C26298           MOVE 'PENDING CONTRACT'         TO CMN-TABLE-1         
C26298           MOVE 'ON OFF ORDER'             TO CMN-TABLE-2         
C26298           MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1 
C26298           MOVE 8000                      TO WS-ACTIVE-RETURN-CODE
C26298           MOVE AT-ACCOUNT-NO              TO                     
C26298                                           CMN-HOSTVAR-ELEMENT-1  
C26298           PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT         
C26298        END-IF                                                    
      *       PROCESS MAINTENANCE JOURNAL.                                      
              MOVE CT-AMT-MO-PYMT           TO WS-AMT-MO-PYMT           
              MOVE WS-AC-AMT-TRAN-BALANCE   TO WS-AMT-BILL-FULL         
              MOVE WS-CNT                   TO WS-RCV-TYPE              
              MOVE WS-A                     TO WS-PAR-CODE-TRAN-TYPE    
              MOVE WS-PROG-CLOSE-CONTRACT   TO WS-PAR-APPL-PROG-ID      
              PERFORM 5654-JRNL-BILL-FULL   THRU 5654-EXIT              
              MOVE WS-I                     TO WS-PAR-CODE-TRAN-TYPE    
                                                                        
              MOVE 99999.99                 TO CT-AMT-MO-PYMT           
T16187        MOVE 'E'                      TO CT-CNT-STATUS-CD         
              MOVE WS-CURRENT-TIMESTAMP     TO CT-LAST-UPDATE-TS        
              MOVE WS-USER-ID               TO CT-USER-ID               
              MOVE WS-TODAYS-DATE           TO CT-STATUS-CHANGE-DT      
              MOVE 0                        TO WS-REBATE-AMOUNT         
                                                                        
T19105        IF CT-DATE-PYMT-START > WS-CURRENT-DATE                   
T19105           MOVE WS-CURRENT-DATE TO CT-DATE-PYMT-START             
T19105        END-IF                                                    
                                                                        
      *       REBATE ANY ADD-ON INTEREST.                                       
              IF CT-CODE-INTRST-METH = WS-B                             
                 IF WS-AC-AMT-TRAN-BALANCE > 0                          
                    MOVE CT-DATE-PYMT-START TO WS-DATE-CCYY             
                    MOVE CT-INTRST-PRIOR-YR TO WS-FINANCE-CHARGE        
                    MOVE CT-NO-SCHED-PYMTS  TO WS-NO-OF-PYMTS           
                    PERFORM 5680-REBATE-CALC-CONTROL THRU 5680-EXIT     
                                                                        
                    COMPUTE CT-AMT-DEF-INTEREST = CT-AMT-DEF-INTEREST - 
                                                  WS-REBATE-AMOUNT      
                 END-IF                                                 
              END-IF                                                    
                                                                        
      *       UPDATE AMT MONTHLY PYMT AND INTEREST PRIOR YEAR.                  
              PERFORM 8360-UPDATE-CSS-CONTRACT       THRU 8360-EXIT     
                                                                        
      *       UPDATE AGING BUCKETS AND AMT TRAN BALANCE.                        
A02004        IF   (WS-AC-AMT-AR-DAY-00 = 0                             
A02004          AND WS-AC-AMT-AR-DAY-30 = 0                             
A02004          AND WS-AC-AMT-AR-DAY-60 = 0                             
A02004          AND WS-AC-AMT-AR-DAY-90 = 0                             
A02004          AND WS-AC-AMT-TRAN-BALANCE = 0)                         
A02004          PERFORM 8880-DELETE-DET-AR-CNTL      THRU 8880-EXIT     
A02004          MOVE ZEROES                          TO WS-ROW-COUNT    
A02004          PERFORM 6796A-SELECT-CSS-AR-ACCT THRU 6796A-EXIT        
A02004          IF WS-ROW-COUNT EQUAL ZEROES                            
A02004             PERFORM 6797-DELETE-CSS-AR-ACCT   THRU 6797-EXIT     
A02004             MOVE AT-CODES-DATA-PRESENT  TO WS-CODES-DATA-PRESENT 
A02004             MOVE SPACES                 TO WS-CODE-CONTRACT      
A02004             MOVE WS-CODES-DATA-PRESENT  TO AT-CODES-DATA-PRESENT 
A02004             PERFORM 8311-UPDATE-AT-CODES THRU 8311-EXIT          
A02004          END-IF                                                  
A02004        ELSE                                                      
A02004          PERFORM 8450-UPDATE-DET-AR-CNTL      THRU 8450-EXIT     
A02004        END-IF                                                    
           END-IF.                                                      
                                                                        
      * RESET THE PAR APPL PROGRAM VARIABLE.                                    
           MOVE PROGRAM-NAME                TO WS-PAR-APPL-PROG-ID.     
                                                                        
       5652-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5654-JRNL-BILL-FULL.                                           *        
      * PERFORMED BY 5651-PROCESS-DFA-BILL                             *        
      *              5652-PROCESS-CNT-BILL                             *        
      *              5653-PROCESS-CIA-BILL.                            *        
      ******************************************************************        
       5654-JRNL-BILL-FULL.                                             
                                                                        
           MOVE '5654'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           ADD +1                        TO WS-TRAN-APPL-NO.            
           MOVE WS-TRAN-APPL-NO          TO MI-TRAN-APPL-NO.            
                                                                        
      *    CHECK IF THE HEADER HAS ALREADY BEEN JOURNALED.                      
           IF WS-TRAN-APPL-NO > 1                                       
              NEXT SENTENCE                                             
           ELSE                                                         
T18095        MOVE WS-PROG-CLOSE-CONTRACT TO MH-APPL-PROGRAM-ID         
              PERFORM 5120-JRNL-TRAN-HEAD       THRU 5120-EXIT          
              MOVE +0                    TO MH-TRAN-COMMENT-LEN         
              MOVE SPACES                TO MH-TRAN-COMMENT-TEXT        
           END-IF.                                                      
                                                                        
      *    PROCESS MAINTENANCE JOURNAL.                                         
           MOVE +12                      TO MI-PRV-COLUMN-VALUE-LEN.    
           MOVE +12                      TO MI-CHG-COLUMN-VALUE-LEN.    
T22289     MOVE WS-AMT-BILL-FULL         TO WS-AMT-BILL-FULL-C.         
T22289     MOVE WS-AMT-MO-PYMT           TO WS-AMT-MO-PYMT-C.           
           MOVE WS-AMT-BILL-FULL-C       TO MI-CHG-COLUMN-VALUE-TEXT.   
           MOVE WS-AMT-MO-PYMT-C         TO MI-PRV-COLUMN-VALUE-TEXT.   
           MOVE WS-RCV-TYPE              TO MI-COLUMN-DESC.             
           MOVE SPACES                   TO MI-TABLE-ID.                
           PERFORM 6530-LOAD-MNT-TRANS-HIST     THRU 6530-EXIT.         
                                                                        
       5654-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5660-APPLY-DEPOSIT-TO-BILL.                                    *        
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                          *        
      ******************************************************************        
       5660-APPLY-DEPOSIT-TO-BILL.                                      
                                                                        
           MOVE '5660'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           MOVE AT-ACCOUNT-NO            TO DO-ACCOUNT-NO.              
           PERFORM 7030-OPEN-CSS-DEP-ON-HAND    THRU 7030-EXIT.         
           PERFORM 7130-FETCH-CSS-DEP-ON-HAND   THRU 7130-EXIT.         
                                                                        
      *    PROCESS DEPOSITS ON HAND FOR THE ACCOUNT.                            
           PERFORM 5661-DETERMINE-DEPOSIT       THRU 5661-EXIT          
              UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND.                  
                                                                        
           PERFORM 7031-CLOSE-CSS-DEP-ON-HAND   THRU 7031-EXIT.         
                                                                        
      *    DELETE ALL DEPOSIT AR CONTROL ROWS.                                  
           MOVE AT-ACCOUNT-NO            TO AC-ACCOUNT-NO.              
           MOVE WS-80                    TO AC-PYMT-PRIORITY-LVL.       
           PERFORM 8890-DELETE-AR-CNTL-DEP      THRU 8890-EXIT.         
                                                                        
       5660-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5661-DETERMINE-DEPOSIT.                                        *        
      * PERFORMED BY 5660-APPLY-DEPOSIT-TO-BILL.                       *        
      ******************************************************************        
       5661-DETERMINE-DEPOSIT.                                          
                                                                        
           MOVE '5661'                    TO ACTIVE-PARAGRAPH.          
                                                                        
           MOVE WS-NO                     TO WS-CERT-ISSUED             
                                             WS-DEP-DET-EXISTS.         
           MOVE 0                         TO WS-SAVE-DET-BALANCE        
                                             WS-SAVE-DO-INTEREST        
                                             WS-MONTHS-OF-INTEREST.     
                                                                        
      *    CHECK IF A DEPOSIT CERTIFICATE HAS BEEN ISSUED.                      
           IF DO-DATE-CERT-ISSUE > SPACES                               
              MOVE WS-YES                 TO WS-CERT-ISSUED             
           END-IF.                                                      
                                                                        
      *    CHECK IF THE DEPOSIT DETAIL EXISTS.                                  
           MOVE AT-ACCOUNT-NO             TO WS-AC-ACCOUNT-NO.          
           MOVE WS-80                     TO WS-AC-PYMT-PRIORITY-LVL.   
           MOVE DO-DEPOSIT-CERT-NO        TO WS-AC-ITEM-ID.             
                                                                        
           PERFORM 7380-SELECT-DET-AR-CNTL        THRU 7380-EXIT.       
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              MOVE WS-YES                         TO WS-DEP-DET-EXISTS  
              MOVE WS-AC-AMT-TRAN-BALANCE         TO WS-SAVE-DET-BALANCE
           END-IF.                                                      
                                                                        
      *    CALCULATE THE DEPOSIT REFUND.                                        
           IF CERT-ISSUED                                               
              PERFORM 5662-CALC-REFUND            THRU 5662-EXIT        
      *    CALCULATE THE AMOUNT PAID.                                           
           ELSE                                                         
              IF DEP-DET-EXISTS                                         
PCR482           MOVE DO-DEPOSIT-CERT-NO          TO DP-DEPOSIT-CERT-NO 
PCR482           MOVE WS-ACCOUNT-NO               TO DP-ACCOUNT-NO      
PCR482           PERFORM 7990-SELECT-DEP-PAY-AMT  THRU 7990-EXIT        
PCR482*          COMPUTE WS-PAYMENT-AMOUNT = DO-AMT-DEPOSIT -                   
      *                                      WS-TOTAL-PAYMENTS                  
                 COMPUTE WS-PAYMENT-AMOUNT = WS-TOTAL-PAYMENTS          
              ELSE                                                      
      *          MOVE DO-AMT-DEPOSIT              TO WS-PAYMENT-AMOUNT          
                 MOVE 0                           TO WS-PAYMENT-AMOUNT  
              END-IF                                                    
           END-IF.                                                      
                                                                        
      *    UPDATE DEPOSIT ON HAND RECORDS.                                      
           PERFORM 5665-UPDATE-DEPOSIT-RECORDS    THRU 5665-EXIT.       
                                                                        
      *    UPDATE CSS_ACCOUNT SO 6700 DOES NOT OVERLAY FIELDS.                  
                                                                        
           IF WS-ACCT-CHG-JRNL-DONE = 'N'                               
              PERFORM 8305-JRNL-ACCT-STAT-CHG     THRU 8305-EXIT        
           END-IF.                                                      
                                                                        
           PERFORM 8310-UPDATE-CSS-ACCOUNT        THRU 8310-EXIT.       
C32671     MOVE AT-ACCOUNT-NO                     TO PJ-ACCOUNT-NO      
C32671     PERFORM 8480-UPDATE-PJS                THRU 8480-EXIT        
                                                                        
           MOVE WS-NO                     TO WS-IS-THIS-DIRECTED-PYMT.  
                                                                        
           IF WS-INTEREST-CALC > 0                                      
              MOVE WS-PROG-CREDIT-DEPOSIT-INT TO WS-PAR-APPL-PROG-ID    
           ELSE                                                         
              MOVE WS-PROG-CREDIT-DEPOSIT     TO WS-PAR-APPL-PROG-ID    
           END-IF.                                                      
                                                                        
           MOVE 0                         TO WS-PAR-TYPE                
                                             WS-PAR-TYPE-NO             
                                             WS-PAR-TRAN-APPL-NO        
                                             AU-TRAN-APPL-NO            
                                             WS-100-JRNL-TRAN-APPL-NO.  
           MOVE WS-DEP-DEP-GL-NO (WS-GL-SUB)                            
                                          TO WS-PAR-GEN-LEDG-DB.        
                                                                        
      *    LOAD PAYMENT PRIORITY TABLE FOR UNDIRECTED PAYMENT.                  
           IF PPL-TABLE-LOADED                                          
              CONTINUE                                                  
           ELSE                                                         
              MOVE 1                      TO C9-PMT-PRTY-SCHEDULE       
              PERFORM 6722B-OPEN-AR-PMT-PRTY      THRU 6722B-EXIT       
              PERFORM 6722C-FETCH-AR-PMT-PRTY     THRU 6722C-EXIT       
              PERFORM 6722D-LOAD-AR-PMT-PRTY      THRU 6722D-EXIT       
                 VARYING WS-PAR-SUB FROM 1 BY 1                         
                    UNTIL WS-PAR-SUB GREATER THAN 52                    
                    OR WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND            
              PERFORM 6722E-CLOSE-AR-PMT-PRTY     THRU 6722E-EXIT       
              MOVE WS-YES                 TO WS-PPL-TABLE-LOADED        
           END-IF.                                                      
                                                                        
           IF WS-PAYMENT-AMOUNT > 0                                     
              IF WS-PAYMENT-AMOUNT > DO-AMT-DEPOSIT                     
                 MOVE WS-PAYMENT-AMOUNT      TO WS-PAYMENT-AMOUNT-TOTAL 
                 MOVE DO-AMT-DEPOSIT         TO WS-AMT-CASH             
                                                WS-PAYMENT-AMOUNT       
      *       APPLY PAID IN-FULL DEPOSIT.                                       
                 MOVE 'Y'                    TO WS-DEPOSIT-REFUND-SW    
                                                                        
                 PERFORM 6700-APPLY-PAYMENT  THRU 6700-EXIT             
                 IF PYMT-WAS-SUCCESSFUL                                 
                    CONTINUE                                            
                 ELSE                                                   
                    MOVE PROGRAM-NAME        TO ABEND-PROGRAM           
                    MOVE 'USERABEN'          TO ABEND-FUNCTION          
                    PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT     
                 END-IF                                                 
                                                                        
      *       PROCESS CASH DRAWER JOURNAL.                                      
                 MOVE WS-JRNL-CNTRL-ONLY     TO WS-JRNL-OPERATION-RQST  
                 PERFORM 6400-ONLINE-JRNL-ROUTINE    THRU 6400-EXIT     
                 IF WS-JRNL-RTRN-CODE EQUAL SPACES                      
                    CONTINUE                                            
                 ELSE                                                   
                    MOVE PROGRAM-NAME        TO ABEND-PROGRAM           
                    MOVE 'USERABEN'          TO ABEND-FUNCTION          
                    PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT     
                 END-IF                                                 
                                                                        
                 MOVE WS-DEP-INT-GL-NO (WS-GL-SUB)                      
                                             TO WS-PAR-GEN-LEDG-DB      
                 MOVE WS-INTEREST-CALC       TO WS-AMT-CASH             
                                                WS-PAYMENT-AMOUNT       
      *       APPLY PAID IN-FULL DEPOSIT INTEREST.                              
                 PERFORM 6700-APPLY-PAYMENT          THRU 6700-EXIT     
                 IF PYMT-WAS-SUCCESSFUL                                 
                    CONTINUE                                            
                 ELSE                                                   
                    MOVE PROGRAM-NAME        TO ABEND-PROGRAM           
                    MOVE 'USERABEN'          TO ABEND-FUNCTION          
                    PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT     
                 END-IF                                                 
              ELSE                                                      
                 MOVE WS-PAYMENT-AMOUNT      TO WS-AMT-CASH             
                                                WS-PAYMENT-AMOUNT-TOTAL 
                 MOVE 'Y'                    TO WS-DEPOSIT-REFUND-SW    
      *       APPLY PARTIALLY PAID DEPOSIT                                      
                 PERFORM 6700-APPLY-PAYMENT          THRU 6700-EXIT     
                 IF PYMT-WAS-SUCCESSFUL                                 
                    CONTINUE                                            
                 ELSE                                                   
                    MOVE PROGRAM-NAME        TO ABEND-PROGRAM           
                    MOVE 'USERABEN'          TO ABEND-FUNCTION          
                    PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT     
                 END-IF                                                 
              END-IF                                                    
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
              MOVE WS-JRNL-CNTRL-ONLY        TO WS-JRNL-OPERATION-RQST  
              PERFORM 6400-ONLINE-JRNL-ROUTINE       THRU 6400-EXIT     
              IF WS-JRNL-RTRN-CODE EQUAL SPACES                         
                 CONTINUE                                               
              ELSE                                                      
                 MOVE PROGRAM-NAME           TO ABEND-PROGRAM           
                 MOVE 'USERABEN'             TO ABEND-FUNCTION          
                 PERFORM 9900-SQL-ERROR-ROUTINE      THRU 9900-EXIT     
              END-IF                                                    
           END-IF.                                                      
                                                                        
           MOVE 'N'                       TO WS-DEPOSIT-REFUND-SW       
                                                                        
           PERFORM 7130-FETCH-CSS-DEP-ON-HAND     THRU 7130-EXIT.       
                                                                        
       5661-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5662-CALC-REFUND.                                              *        
      * PERFORMED BY 5661-DETERMINE-DEPOSIT.                           *        
      ******************************************************************        
       5662-CALC-REFUND.                                                
                                                                        
           MOVE '5662'                    TO ACTIVE-PARAGRAPH.          
                                                                        
           IF DEP-DET-EXISTS                                            
              SUBTRACT DO-TOTAL-INTRST FROM DO-AMT-DEPOSIT              
                 GIVING WS-PAYMENT-AMOUNT                               
           ELSE                                                         
              MOVE WS-TODAYS-DATE         TO WS-CURRENT-DATE            
              MOVE WS-N                   TO WS-BILL-IMMEDIATELY        
              PERFORM 5995-DEPOSIT-INTEREST-CALC   THRU 5995-EXIT       
              COMPUTE WS-PAYMENT-AMOUNT =                               
                 DO-AMT-DEPOSIT + WS-INTEREST-CALC                      
           END-IF.                                                      
                                                                        
       5662-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5665-UPDATE-DEPOSIT-RECORDS.                                   *        
      * PERFORMED BY 5661-DETERMINE-DEPOSIT.                           *        
      ******************************************************************        
       5665-UPDATE-DEPOSIT-RECORDS.                                     
                                                                        
           MOVE '5665'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           MOVE DO-TOTAL-INTRST          TO WS-SAVE-DO-INTEREST.        
                                                                        
      *    COMPUTE TOTAL INTEREST AMOUNT.                                       
           IF DO-AMT-DEPOSIT > WS-PAYMENT-AMOUNT                        
              MOVE 0                     TO DO-TOTAL-INTRST             
           ELSE                                                         
              SUBTRACT DO-AMT-DEPOSIT FROM WS-PAYMENT-AMOUNT            
                 GIVING DO-TOTAL-INTRST                                 
           END-IF.                                                      
                                                                        
C30300     ADD WS-SAVE-DO-INTEREST       TO DO-TOTAL-INTRST             
           MOVE WS-TODAYS-DATE           TO WS-DATE-BREAKDOWN           
                                            DO-DATE-REFUNDED.           
           MOVE 0                        TO WS-NULL-DT-IND-8.           
                                                                        
      *    COMPUTE INTEREST YTD.                                                
C30300     IF WS-PAYMENT-AMOUNT > DO-AMT-DEPOSIT                        
C30300        MOVE WS-TODAYS-DATE        TO DO-DATE-INTST-CALC-TO       
C30300        COMPUTE DO-INTRST-YTD ROUNDED =                           
C30300           ((WS-PAYMENT-AMOUNT - DO-AMT-DEPOSIT) + DO-INTRST-YTD) 
C30300     END-IF.                                                      
C30300     IF DO-DATE-INTST-CALC-TO EQUAL SPACES                        
C30300        MOVE -1                    TO WS-NULL-DT-IND-7            
C30300     ELSE                                                         
C30300        MOVE 0                     TO WS-NULL-DT-IND-7            
C30300     END-IF.                                                      
                                                                        
      *    UPDATE DEPOSIT RECORD TO FINAL BILLED.                               
           MOVE SPACES                   TO DO-EMPL-HOLD-INIT           
C30300     ADD  DO-AMT-DEPOSIT           TO WS-AMT-REFUNDED.            
           MOVE 0                        TO WS-AMT-DEPOSIT.             
           MOVE WS-A                     TO DO-CODE-REFUND-FROM         
           MOVE WS-R                     TO DO-DEPOSIT-STATUS-CD        
           PERFORM 8380-UPDATE-CSS-DEP-ON-HAND  THRU 8380-EXIT          
                                                                        
PCR052*    ROW WILL BE INSERTED INTO CSS_REFUND TABLE FOR EVERY                 
PCR052*    ROW UPDATED IN CSS_DEP_ON_HAND.                                      
PCR052     PERFORM 5670-INSERT-CSS-REFUND       THRU 5670-EXIT          
                                                                        
           IF DEP-DET-EXISTS                                            
              PERFORM 5010-PREPARE-JOURNAL      THRU 5010-EXIT          
                                                                        
      *       PERFORM FILE MAINTENANCE ON DEPOSIT.                              
              PERFORM 5666-PAY-DEP-DET-FM       THRU 5666-EXIT          
                                                                        
              IF WS-JRNL-WRITTEN = 'Y'                                  
                 PERFORM 5020-TERMINATE-JOURNAL THRU 5020-EXIT          
              END-IF                                                    
           END-IF.                                                      
                                                                        
       5665-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5666-PAY-DEP-DET-FM.                                           *        
      * PERFORMED BY 5665-UPDATE-DEPOSIT-RECORDS.                      *        
      ******************************************************************        
       5666-PAY-DEP-DET-FM.                                             
                                                                        
           MOVE '5666'                   TO ACTIVE-PARAGRAPH.           
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           MOVE +1                       TO WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-DATE-LAST-ACTION      TO WS-100-DATE-LAST-ACTION.    
                                                                        
      *    GET NEW TIMESTAMP.                                                   
           PERFORM 7200-SELECT-TIMESTAMP THRU 7200-EXIT.                
           MOVE WS-CURRENT-TIMESTAMP     TO WS-PROGRAM-TIMESTAMP        
                                            AR-TRANS-HIST-SEQ-NO        
                                            AU-TRANS-HIST-SEQ-NO.       
                                                                        
      *    FORMAT AR_TRANS_HIST VARIABLES.                                      
           MOVE AT-ACCOUNT-NO            TO AR-ACCOUNT-NO.              
           MOVE WS-AC-AMT-TRAN-BALANCE   TO AR-AMT-ORIG-ENTERED.        
           MOVE WS-DATE-BREAKDOWN        TO AT-DATE-LAST-ACTION         
                                            AR-DATE-TRANS.              
           MOVE WS-I                     TO AR-CODE-TRAN-TYPE.          
NEWNEW     SUBTRACT WS-AC-AMT-AR-DAY-00 FROM AT-TOTAL-AR-BALANCE.       
NEWNEW     SUBTRACT WS-AC-AMT-AR-DAY-30 FROM AT-TOTAL-AR-BALANCE.       
NEWNEW     SUBTRACT WS-AC-AMT-AR-DAY-60 FROM AT-TOTAL-AR-BALANCE.       
NEWNEW     SUBTRACT WS-AC-AMT-AR-DAY-90 FROM AT-TOTAL-AR-BALANCE.       
           MOVE AT-TOTAL-AR-BALANCE      TO AR-AMT-BILLED-UNPAID        
                                            WS-101-ACCT-END-AR-BAL.     
           MOVE SPACES                   TO AR-DATE-ORIG-PYMT.          
           MOVE -1                       TO WS-DATE-ORIG-PYMT-IND.      
           MOVE SPACES                   TO AR-PYMT-FACILITY-CD.        
           MOVE WS-USER-ID               TO AR-USER-ID.                 
           MOVE AT-COMPANY-NO            TO AR-COMPANY-NO.              
           MOVE SPACES                   TO AR-RECORD-ONLY-FL.          
           MOVE SPACES                   TO AR-TRAN-COMMENT-TEXT.       
           MOVE +0                       TO AR-TRAN-COMMENT-LEN.        
           MOVE PF-RESP-AREA-ID          TO AR-RESP-AREA-ID.            
                                                                        
P00307     MOVE WS-PROG-CREDIT-DEPOSIT-AR  TO AR-APPL-PROGRAM-ID.       
                                                                        
           MOVE SPACES                   TO AR-PYMT-REFUNDED-IND.       
           MOVE '01'                     TO AR-CASH-COMPANY-NO.         
           MOVE '998'                    TO AR-CASH-LOCAL-OFFICE.       
           MOVE '998'                    TO AR-CASH-REPORT-NO.          
           MOVE WS-TODAYS-DATE           TO AR-DATE-CASH-REPORT.        
           MOVE +9999                    TO AR-CASH-DRAWER-ID.          
                                                                        
      *    FORMAT AR_TRN_HST_DET VARIABLES.                                     
           MOVE +1                       TO AU-TRAN-APPL-NO.            
           MOVE AT-ACCOUNT-NO            TO AU-ACCOUNT-NO.              
           MOVE WS-AC-AMT-TRAN-BALANCE   TO AU-CURRENCY-AMT             
                                            AU-AMT-POSTED.              
           MOVE DO-DEPOSIT-CERT-NO       TO AU-ITEM-ID                  
                                            WS-DEP-ID-NO.               
           MOVE WS-AR-DEP-GL-NO (WS-GL-SUB)                             
                                         TO AU-GL-ACCT-CREDIT           
                                            WS-101-ACCT-GEN-LED-CR.     
           MOVE WS-DEP-DEP-GL-NO (WS-GL-SUB)                            
                                         TO AU-GL-ACCT-DEBIT            
                                            WS-101-ACCT-GEN-LED-DR.     
           MOVE WS-F                     TO AU-CODE-AR-AGE.             
           MOVE SPACES                   TO AU-CODE-CONTRACT-TYPE       
                                            AU-CURRENCY-TYPE.           
                                                                        
      *    LOAD COMMON 101-FORMAT VARIABLES.                                    
           PERFORM 5050-LOAD-COMMON-101  THRU 5050-EXIT.                
           MOVE CJF00101                 TO WS-100-USER-DEFINED-AREA.   
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-ONLY             TO WS-JRNL-OPERATION-RQST.     
                                                                        
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
           MOVE WS-JRNL-CASH-UPDATE      TO WS-JRNL-OL-AUTH-TYPE.       
                                                                        
      *    PROCESS AR TRANSACTION HISTORY.                                      
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
                                                                        
      *    DELETE DEPOSIT DETAIL ROW.                                           
           PERFORM 8880-DELETE-DET-AR-CNTL       THRU 8880-EXIT.        
                                                                        
      *    SELECT DEPOSIT SUMMARY ROW.                                          
           MOVE WS-AC-ACCOUNT-NO             TO AC-ACCOUNT-NO.          
           MOVE WS-AC-PYMT-PRIORITY-LVL      TO AC-PYMT-PRIORITY-LVL.   
           MOVE 0                            TO AC-ITEM-ID.             
           PERFORM 7240-SELECT-SUMM-AR-CNTL  THRU 7240-EXIT.            
                                                                        
           SUBTRACT WS-AC-AMT-AR-DAY-00 FROM AC-AMT-AR-DAY-00.          
           SUBTRACT WS-AC-AMT-AR-DAY-30 FROM AC-AMT-AR-DAY-30.          
           SUBTRACT WS-AC-AMT-AR-DAY-60 FROM AC-AMT-AR-DAY-60.          
           SUBTRACT WS-AC-AMT-AR-DAY-90 FROM AC-AMT-AR-DAY-90.          
                                                                        
           IF (AC-AMT-AR-DAY-00 = 0) AND (AC-AMT-AR-DAY-30 = 0) AND     
              (AC-AMT-AR-DAY-60 = 0) AND (AC-AMT-AR-DAY-90 = 0) AND     
              (AC-AMT-UNUSED-CR = 0)                                    
              MOVE AT-CODES-DATA-PRESENT TO WS-CODES-DATA-PRESENT       
              MOVE SPACES                TO WS-CODE-DEP-REQ             
              MOVE WS-CODES-DATA-PRESENT TO AT-CODES-DATA-PRESENT       
                                                                        
      *       DELETE DEPOSIT SUMMARY ROW.                                       
              PERFORM 8850-DELETE-SUMM-AR-CNTL   THRU 8850-EXIT         
           ELSE                                                         
      *       UPDATE DEPOSIT SUMMARY ROW.                                       
              PERFORM 8440-UPDATE-SUMM-AR-CNTL   THRU 8440-EXIT         
           END-IF.                                                      
                                                                        
       5666-EXIT.                                                       
           EXIT.                                                        
                                                                        
PCR052****************************************************************  17371000
PCR052* 5670-INSERT-CSS-REFUND.                                      *  17372000
PCR052*     -- THIS MODULES GETS THE REFUND ITEM NUMBER AND POPULATES*  17373000
PCR052*        FIELDS REQUIRED FOR INSERT INTO CSS_REFUND.           *  17374000
PCR052****************************************************************  17375000
PCR052 5670-INSERT-CSS-REFUND.                                          
PCR052                                                                  
PCR052     MOVE '0'                   TO WS-ORIGINAL-CHECK-NO           
PCR052                                   WS-REFUND-CHECK-NO.            
PCR052     MOVE ' '                   TO WS-RETURNED-REASON             
PCR052     MOVE 'SYSTEM'              TO WS-USER-ID-APPRVD-BY.          
PCR052     MOVE 'SYSTEM'              TO WS-USER-ID-RQSTED-BY.          
PCR052     MOVE DO-DEPOSIT-CERT-NO    TO WS-DEPOSIT-CERT-NUMBER.        
PCR482     MOVE 'A'                   TO WS-MANUAL-INDICATOR.           
PCR052     MOVE ' '                   TO WS-COMMENT-TEXT.               
PCR052     MOVE 0                     TO WS-COMMENT-LEN-NUMBER.         
PCR482     MOVE 'B'                   TO WS-CHECK-ISS-REAS-CD.          
PCR482     MOVE WS-PAYMENT-AMOUNT     TO WS-AMT-REFUND.                 
PCR052     MOVE DO-DATE-REFUNDED      TO WS-DATE-REFUNDED.              
PCR052     MOVE AT-ACCOUNT-NO         TO WS-ACCOUNT-NO-NUM.             
PCR052     MOVE AT-LOCAL-OFFICE       TO WS-LOCAL-OFF.                  
PCR052     MOVE AT-ADDRESS-ID         TO WS-ADDRESS-ID.                 
PCR482     MOVE SPACES                TO RN-CHECK-STATUS-CD.            
PCR052     PERFORM 5950-INSERT-REFUND THRU 5950-EXIT.                   
PCR052                                                                  
PCR052 5670-EXIT.                                                       
PCR052     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5680-REBATE-CALC-CONTROL.                                      *        
      * PERFORMED BY 5652-PROCESS-CNT-BILL.                            *        
      ******************************************************************        
       5680-REBATE-CALC-CONTROL.                                        
                                                                        
           MOVE '5680'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           MOVE 01                       TO WS-DATE-DD.                 
           MOVE WS-DATE-BREAKDOWN        TO WS-INITIAL-DATE.            
                                                                        
      *    COMPUTE REBATE AMOUNT FOR EARLY PAYOFF.                              
           PERFORM 6100-COMPUTE-REBATE-AMOUNT   THRU 6100-EXIT          
t18555     IF WS-CT-AMT-DEF-INTEREST > WS-AC-AMT-TRAN-BALANCE           
t18555        NEXT SENTENCE                                             
t18555     ELSE                                                         
             IF WS-REBATE-AMOUNT > 0                                    
      *         APPLY EXISTING REBATE TO CONTRACT AND FINANCE.                  
                PERFORM 5681-APPLY-REBATE         THRU 5681-EXIT        
             END-IF                                                     
           END-IF.                                                      
                                                                        
       5680-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5681-APPLY-REBATE.                                             *        
      * PERFORMED BY 5680-REBATE-CALC-CONTROL.                         *        
      ******************************************************************        
       5681-APPLY-REBATE.                                               
                                                                        
           MOVE '5681'                  TO ACTIVE-PARAGRAPH.            
                                                                        
      *    LOAD COMMON 101-FORMAT VARIABLES.                                    
AS0996     PERFORM 5045-LOAD-COMMON-105         THRU 5045-EXIT.         
AS0996     MOVE WS-TODAYS-DATE          TO WS-105-DATE-AR-BILLED.       
AS0996     MOVE WS-AC-ITEM-ID           TO WS-105-ITEM-ID-NO.           
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           PERFORM 5030-LOAD-COMMON-100         THRU 5030-EXIT.         
           MOVE WS-TODAYS-DATE          TO WS-100-DATE-LAST-ACTION.     
                                                                        
      *    GET NEW TIMESTAMP.                                                   
           PERFORM 7200-SELECT-TIMESTAMP  THRU 7200-EXIT.               
           MOVE WS-CURRENT-TIMESTAMP      TO WS-PROGRAM-TIMESTAMP       
                                             AR-TRANS-HIST-SEQ-NO       
                                             AU-TRANS-HIST-SEQ-NO.      
                                                                        
      *    FORMAT AR_TRANS_HIST VARIABLES.                                      
           MOVE AT-ACCOUNT-NO             TO AR-ACCOUNT-NO.             
           MOVE WS-PROG-CREDIT-CNT-INTRST TO AR-APPL-PROGRAM-ID.        
           MOVE WS-I                      TO AR-CODE-TRAN-TYPE.         
           MOVE AT-COMPANY-NO             TO AR-COMPANY-NO.             
           MOVE SPACES                    TO AR-DATE-ORIG-PYMT.         
           MOVE -1                        TO WS-DATE-ORIG-PYMT-IND.     
           MOVE WS-TODAYS-DATE            TO AR-DATE-TRANS.             
           MOVE SPACES                    TO AR-PYMT-FACILITY-CD.       
           MOVE WS-N                      TO AR-RECORD-ONLY-FL.         
           MOVE PF-RESP-AREA-ID           TO AR-RESP-AREA-ID.           
           MOVE SPACES                    TO AR-TRAN-COMMENT-TEXT.      
           MOVE +0                        TO AR-TRAN-COMMENT-LEN.       
           MOVE WS-USER-ID                TO AR-USER-ID.                
           MOVE '01'                      TO AR-CASH-COMPANY-NO.        
           MOVE '998'                     TO AR-CASH-LOCAL-OFFICE.      
           MOVE '998'                     TO AR-CASH-REPORT-NO.         
           MOVE WS-TODAYS-DATE            TO AR-DATE-CASH-REPORT.       
           MOVE +9999                     TO AR-CASH-DRAWER-ID.         
           MOVE SPACES                    TO AR-PYMT-REFUNDED-IND.      
                                                                        
      *    FORMAT AR_TRN_HST_DET VARIABLES.                                     
           MOVE 1                         TO AU-TRAN-APPL-NO.           
           MOVE AT-ACCOUNT-NO             TO AU-ACCOUNT-NO.             
           MOVE SPACES                    TO AU-CODE-CONTRACT-TYPE      
                                             AU-CURRENCY-TYPE.          
           MOVE WS-AC-ITEM-ID             TO AU-ITEM-ID.                
                                                                        
           IF (WS-AC-AMT-TRAN-BALANCE - WS-REBATE-AMOUNT) <             
             (WS-AC-AMT-AR-DAY-90 + WS-AC-AMT-AR-DAY-60 +               
              WS-AC-AMT-AR-DAY-30 + WS-AC-AMT-AR-DAY-00)                
      *       APPLY REBATE AMOUNT TO CONTRACT/CONTRACT.                         
              PERFORM 5682-FM-TO-WRITE-OFF-EXTRA  THRU 5682-EXIT        
           END-IF.                                                      
                                                                        
           MOVE WS-REBATE-AMOUNT          TO AU-AMT-POSTED              
                                             AU-CURRENCY-AMT            
                                             AR-AMT-ORIG-ENTERED        
AS0996                                       WS-105-AMT-POSTED          
AS0996                                       WS-105-AMOUNT-ENTERED      
                                             WS-JRNL-GEN-LEG-DEBIT-AMT  
                                             WS-JRNL-RCV-CREDIT-AMT.    
                                                                        
      *    GET REBATE INTEREST GL NUMBER.                                       
           MOVE CT-CNT-NAME-CD          TO K6-CNT-NAME-CD.              
AS0996     MOVE CT-GL-ACCT-NO-DEF-INT   TO AU-GL-ACCT-DEBIT             
AS0996                                     WS-105-ACCT-GEN-LED-DR.      
                                                                        
           MOVE WS-AR-CNT-GL-NO (WS-GL-SUB)                             
                                        TO AU-GL-ACCT-CREDIT            
AS0996                                     WS-105-ACCT-GEN-LED-CR.      
           SUBTRACT WS-REBATE-AMOUNT FROM WS-AC-AMT-TRAN-BALANCE.       
                                                                        
           MOVE 0                        TO CT-INTRST-PRIOR-YR          
           MOVE WS-P                     TO AU-CODE-AR-AGE              
AS0996                                      WS-105-AR-AGE               
                                                                        
AS0996     COMPUTE WS-105-DETAIL-END-AR-BAL =                           
              (AC-AMT-AR-DAY-00 + AC-AMT-AR-DAY-30 +                    
               AC-AMT-AR-DAY-60 + AC-AMT-AR-DAY-90).                    
AS0996     MOVE WS-AC-AMT-TRAN-BALANCE   TO WS-105-DETAIL-END-BAL.      
           MOVE 1                        TO WS-100-JRNL-TRAN-APPL-NO    
                                            WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-TOTAL-AR-BALANCE      TO AR-AMT-BILLED-UNPAID        
AS0996                                      WS-105-ACCT-END-AR-BAL.     
                                                                        
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT.       
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
AS0996     MOVE CJF00105                 TO WS-100-USER-DEFINED-AREA.   
           MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       5681-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5682-FM-TO-WRITE-OFF-EXTRA.                                    *        
      * PERFORMED BY 5681-APPLY-REBATE.                                *        
      ******************************************************************        
       5682-FM-TO-WRITE-OFF-EXTRA.                                      
                                                                        
           MOVE '5682'                   TO ACTIVE-PARAGRAPH.           
                                                                        
           COMPUTE AU-AMT-POSTED =                                      
              (WS-AC-AMT-TRAN-BALANCE - WS-REBATE-AMOUNT) -             
              (WS-AC-AMT-AR-DAY-90 + WS-AC-AMT-AR-DAY-60 +              
               WS-AC-AMT-AR-DAY-30 + WS-AC-AMT-AR-DAY-00).              
                                                                        
AS0996     MOVE AU-AMT-POSTED            TO WS-105-AMOUNT-ENTERED       
                                            AR-AMT-ORIG-ENTERED.        
           IF AU-AMT-POSTED < 0                                         
AS0996        MULTIPLY AU-AMT-POSTED BY -1 GIVING WS-105-AMT-POSTED     
AS0996        MOVE WS-105-AMT-POSTED     TO AU-AMT-POSTED               
           ELSE                                                         
AS0996        MOVE AU-AMT-POSTED         TO WS-105-AMT-POSTED           
           END-IF.                                                      
                                                                        
           MOVE WS-AR-CNT-GL-NO (WS-GL-SUB)                             
                                         TO AU-GL-ACCT-DEBIT            
                                            AU-GL-ACCT-CREDIT           
AS0996                                      WS-105-ACCT-GEN-LED-DR      
AS0996                                      WS-105-ACCT-GEN-LED-CR      
                                                                        
           MOVE WS-F                     TO AU-CODE-AR-AGE              
AS0996                                      WS-105-AR-AGE.              
                                                                        
           SUBTRACT AU-AMT-POSTED FROM AT-TOTAL-AR-BALANCE.             
           IF WS-AC-AMT-AR-DAY-90 > 0                                   
              IF AU-AMT-POSTED > WS-AC-AMT-AR-DAY-90                    
                 SUBTRACT WS-AC-AMT-AR-DAY-90 FROM AU-AMT-POSTED        
                 SUBTRACT WS-AC-AMT-AR-DAY-90 FROM AC-AMT-AR-DAY-90     
                 MOVE 0                  TO WS-AC-AMT-AR-DAY-90         
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED FROM WS-AC-AMT-AR-DAY-90        
                 SUBTRACT AU-AMT-POSTED FROM AC-AMT-AR-DAY-90           
                 MOVE 0                  TO AU-AMT-POSTED               
              END-IF                                                    
           END-IF.                                                      
                                                                        
           IF WS-AC-AMT-AR-DAY-60 > 0                                   
              IF AU-AMT-POSTED > WS-AC-AMT-AR-DAY-60                    
                 SUBTRACT WS-AC-AMT-AR-DAY-60 FROM AU-AMT-POSTED        
                 SUBTRACT WS-AC-AMT-AR-DAY-60 FROM AC-AMT-AR-DAY-60     
                 MOVE 0                  TO WS-AC-AMT-AR-DAY-60         
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED FROM WS-AC-AMT-AR-DAY-60        
                 SUBTRACT AU-AMT-POSTED FROM AC-AMT-AR-DAY-60           
                 MOVE 0                  TO AU-AMT-POSTED               
              END-IF                                                    
           END-IF.                                                      
                                                                        
           IF WS-AC-AMT-AR-DAY-30 > 0                                   
              IF AU-AMT-POSTED > WS-AC-AMT-AR-DAY-30                    
                 SUBTRACT WS-AC-AMT-AR-DAY-30 FROM AU-AMT-POSTED        
                 SUBTRACT WS-AC-AMT-AR-DAY-30 FROM AC-AMT-AR-DAY-30     
                 MOVE 0                  TO WS-AC-AMT-AR-DAY-30         
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED FROM WS-AC-AMT-AR-DAY-30        
                 SUBTRACT AU-AMT-POSTED FROM AC-AMT-AR-DAY-30           
                 MOVE 0                  TO AU-AMT-POSTED               
              END-IF                                                    
           END-IF.                                                      
                                                                        
           IF AU-AMT-POSTED > 0                                         
              IF WS-AC-AMT-AR-DAY-00 > AU-AMT-POSTED                    
                 OR WS-AC-AMT-AR-DAY-00 = AU-AMT-POSTED                 
                 SUBTRACT AU-AMT-POSTED FROM WS-AC-AMT-AR-DAY-00        
                 SUBTRACT AU-AMT-POSTED FROM AC-AMT-AR-DAY-00           
              ELSE                                                      
                 MOVE PROGRAM-NAME            TO ABEND-PROGRAM          
                 MOVE WS-Y                    TO WS-USER-FORCE-ABEND    
                 MOVE 'ABEND BALANCE PROBLEM' TO DSNTIAR-MESSAGE-1      
                 PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT        
           END-IF
           END-IF.                                                      
                                                                        
AS0996     MOVE WS-105-AMT-POSTED        TO AU-AMT-POSTED.              
AS0996     COMPUTE WS-105-DETAIL-END-AR-BAL =                           
              (AC-AMT-AR-DAY-00 + AC-AMT-AR-DAY-30 +                    
               AC-AMT-AR-DAY-60 + AC-AMT-AR-DAY-90).                    
AS0996     MOVE WS-AC-AMT-TRAN-BALANCE   TO WS-105-DETAIL-END-BAL.      
           ADD 1                         TO AU-TRAN-APPL-NO.            
           MOVE AU-TRAN-APPL-NO          TO WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-TOTAL-AR-BALANCE      TO AR-AMT-BILLED-UNPAID        
AS0996                                      WS-105-ACCT-END-AR-BAL.     
           MOVE AT-ACCOUNT-NO            TO AU-ACCOUNT-NO.              
                                                                        
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT.       
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
AS0996     MOVE CJF00105                 TO WS-100-USER-DEFINED-AREA.   
           MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
           PERFORM 8440-UPDATE-SUMM-AR-CNTL  THRU 8440-EXIT.            
                                                                        
       5682-EXIT.                                                       
           EXIT.                                                        
                                                                        
C37422*****************************************************************         
C37422* 5700-CHECK-FOR-FACTOR.                                                  
C37422*     LOOK FOR EXISTENCE OF UNBILLED RECCHGTAX FACTOR                     
C37422*     IF IT EXISTS, CREATE WQ AND PLACE BILLING ON HOLD                   
C37422* PERFORMED BY 5600-PROCESS-FINAL-BILL                          *         
C37422*****************************************************************         
C37422 5700-CHECK-FOR-FACTOR.                                           
C37422                                                                  
C37422     MOVE '5700'                   TO ACTIVE-PARAGRAPH.           
C37422                                                                  
C37422     MOVE AT-ACCOUNT-NO            TO FF-ACCOUNT-NO.              
C37422     MOVE WS-DATETIME-SETUP        TO WS-SETUP-TS-DATE.           
C37422     MOVE WS-SETUP-TS              TO FF-LAST-UPDATE-TS.          
C37422     PERFORM 7710-FIND-FACTOR-ROW THRU 7710-EXIT.                 
C37422                                                                  
C37422     IF WS-FCTRROW-EXIST = 'Y'                                    
ACT103        INITIALIZE CWS00077-FIELDS                                
ACT103        MOVE ZERO                TO WS-77-SERV-ORDER-NO           
C37422        PERFORM 2501-GET-DATE-TIME  THRU 2501-EXIT                
ACT103        MOVE WS-CURRENT-DATE     TO WS-77-DATE-REQUIRED           
ACT103        MOVE 500                 TO WS-77-CATEGORY-ID             
ACT103        MOVE 61                  TO WS-77-COMMENTS-LEN            
C37422        MOVE WS-RCCCHG-COMMENTS-TEXT                              
ACT103                                 TO WS-77-COMMENTS-TEXT           
C37422        PERFORM 6672-SELECT-ACCOUNT THRU 6672-EXIT                
ACT103        MOVE AT-ACCOUNT-NO       TO WS-77-ACCOUNT-NO              
ACT103        MOVE AT-PREMISE-NO       TO WS-77-PREMISE-NO              
ACT103        MOVE AT-CUSTOMER-NO      TO WS-77-CUSTOMER-NO             
ACT103        MOVE 'SYSTEM'            TO WS-77-USER-ID-ORIG            
ACT103        MOVE SPACES              TO WS-77-RESP-AREA-ID            
ACT103        MOVE AT-LOCAL-OFFICE     TO WS-77-LOCAL-OFFICE            
ACT103        MOVE '4'                 TO WS-77-ROUTE-CATEGORY          
ACT103        MOVE 'N'                 TO WS-77-PRIORITY                
ACT103        MOVE ZERO                TO WS-77-FREE-FORM-LEN           
ACT103        MOVE LOW-VALUES          TO WS-77-FREE-FORM-TXT           
ACT103        MOVE PROGRAM-NAME        TO WS-77-CREATED-BY              
C37422        PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT             
C37422        PERFORM 8896-UPDATE-ACCOUNT-H  THRU 8896-EXIT             
C37422     END-IF.                                                      
C37422                                                                  
C37422 5700-EXIT.                                                       
C37422     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 5800-PROCESS-EPP.                                             *         
      *  SPLIT EPP RECEIVABLE INTO UTE & UTG RECEIVABLES.             *         
      *****************************************************************         
       5800-PROCESS-EPP.                                                
                                                                        
      *    SELECT EPP SUMMARY ROW                                               
           MOVE AT-ACCOUNT-NO                   TO AC-ACCOUNT-NO.       
           MOVE 50                              TO AC-PYMT-PRIORITY-LVL.
           MOVE 0                               TO AC-ITEM-ID.          
           MOVE WS-PROG-FINAL-BILL-EPP          TO AR-APPL-PROGRAM-ID.  
                                                                        
           PERFORM 7240-SELECT-SUMM-AR-CNTL     THRU 7240-EXIT.         
                                                                        
      *    CHECK IF EPP AR EXISTS.                                              
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              MOVE AT-CODES-DATA-PRESENT        TO WS-CODES-DATA-PRESENT
              MOVE SPACES                       TO WS-CODE-BUDGET       
              MOVE 'A'                          TO WS-CODE-UTL          
                                                                        
      *       DETERMINE DATE THREE MONTHS PRIOR TO TODAY.                       
              MOVE CMN-TODAYS-DATE              TO WS-CURR-DATE         
                                                                        
      *       PROCESS FILE MAINTENANCE ON EPP.                                  
              PERFORM 5811-EPP-FILE-MAINT       THRU 5811-EXIT          
              PERFORM 5812-SETUP-ADJ-JRNL       THRU 5812-EXIT          
                                                                        
      *       TRANSFER EPP INFORMATION TO BUDGET HISTORY.                       
              PERFORM 5820-TRANSFER-EPP-TO-HIST THRU 5820-EXIT          
                                                                        
      *       DETERMINE THE UTILITY ELECTRIC AND GAS RATIOS.                    
              PERFORM 5821-DETERMINE-UTL-RATIOS THRU 5821-EXIT          
                                                                        
      *       PROCESS EPP TRANSFER TO UTILITY RECEIVABLES.                      
              PERFORM 5825-TRANSFER-EPP-TO-UTL  THRU 5825-EXIT          
                                                                        
      *       DELETE EPP DETAIL ROW.                                            
              PERFORM 8880-DELETE-DET-AR-CNTL   THRU 8880-EXIT          
                                                                        
      *       DELETE EPP SUMMARY ROW.                                           
              MOVE 50                           TO AC-PYMT-PRIORITY-LVL 
              PERFORM 8850-DELETE-SUMM-AR-CNTL  THRU 8850-EXIT          
                                                                        
              MOVE WS-CODES-DATA-PRESENT        TO AT-CODES-DATA-PRESENT
              PERFORM 8311-UPDATE-AT-CODES      THRU 8311-EXIT          
                                                                        
           END-IF.                                                      
                                                                        
       5800-EXIT.                                                       
           EXIT.                                                        
                                                                        
P00453*****************************************************************         
P00453* 5805-PROCESS-PRP.                                             *         
P00453*  PREPAY PLAN USES SAME PPL AS BUDGET BILLING (EPP) SO USE SAME*         
P00453*  PROCEDURE FOR SPLITTING MONEY AS IN 5800.   MAIN DIFFERENCES *         
P00453*  IS UPDATE TO CDP AND NO CALL TO 5820 TO UPDATE BUDGET HIST   *         
P00453*  WHICH NECESSITATES POPULATING BG-ACCOUNT-NO IN THIS PARA     *         
P00453*****************************************************************         
P00453 5805-PROCESS-PRP.                                                
P00453                                                                  
P00453*    SELECT PRP SUMMARY ROW                                               
P00453     MOVE AT-ACCOUNT-NO                   TO AC-ACCOUNT-NO        
P00453                                             BG-ACCOUNT-NO.       
P00453     MOVE 50                              TO AC-PYMT-PRIORITY-LVL.
P00453     MOVE 0                               TO AC-ITEM-ID.          
P00453     MOVE WS-PROG-FINAL-BILL-PRP          TO AR-APPL-PROGRAM-ID.  
P00453                                                                  
P00453     PERFORM 7240-SELECT-SUMM-AR-CNTL     THRU 7240-EXIT.         
P00453                                                                  
P00453*    CHECK IF PRP AR EXISTS.                                              
P00453     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
P00453        MOVE AT-CODES-DATA-PRESENT        TO WS-CODES-DATA-PRESENT
P00453        MOVE SPACES                       TO WS-CODE-PRE-PAY-PLAN 
P00453        MOVE 'A'                          TO WS-CODE-UTL          
P00453                                                                  
P00453*       DETERMINE DATE THREE MONTHS PRIOR TO TODAY.                       
P00453        MOVE CMN-TODAYS-DATE              TO WS-CURR-DATE         
P00453                                                                  
P00453*       PROCESS FILE MAINTENANCE ON EPP.                                  
P00453        PERFORM 5811-EPP-FILE-MAINT       THRU 5811-EXIT          
P00453        PERFORM 5812-SETUP-ADJ-JRNL       THRU 5812-EXIT          
P00453                                                                  
P00453*       DETERMINE THE UTILITY ELECTRIC AND GAS RATIOS.                    
P00453        PERFORM 5821-DETERMINE-UTL-RATIOS THRU 5821-EXIT          
P00453                                                                  
P00453*       PROCESS PRP TRANSFER TO UTILITY RECEIVABLES.                      
P00453        PERFORM 5825-TRANSFER-EPP-TO-UTL  THRU 5825-EXIT          
P00453                                                                  
P00453*       DELETE PRP DETAIL ROW.                                            
P00453        PERFORM 8880-DELETE-DET-AR-CNTL   THRU 8880-EXIT          
P00453                                                                  
P00453*       DELETE PRP SUMMARY ROW.                                           
P00453        MOVE 50                           TO AC-PYMT-PRIORITY-LVL 
P00453        PERFORM 8850-DELETE-SUMM-AR-CNTL  THRU 8850-EXIT          
P00453                                                                  
P00453        MOVE WS-CODES-DATA-PRESENT        TO AT-CODES-DATA-PRESENT
P00453        PERFORM 8311-UPDATE-AT-CODES      THRU 8311-EXIT          
P00453                                                                  
P00453     END-IF.                                                      
P00453                                                                  
P00453 5805-EXIT.                                                       
P00453     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5811-EPP-FILE-MAINT.                                           *        
      * PERFORM EPP AGEING BUCKET FILE MAINTENANCE.                    *        
      ******************************************************************        
       5811-EPP-FILE-MAINT.                                             
                                                                        
           MOVE CMN-TODAYS-DATE         TO AT-DATE-LAST-ACTION.         
                                                                        
      *    GET NEW TIMESTAMP.                                                   
           PERFORM 7200-SELECT-TIMESTAMP THRU 7200-EXIT.                
           MOVE WS-CURRENT-TIMESTAMP     TO WS-PROGRAM-TIMESTAMP        
                                            AR-TRANS-HIST-SEQ-NO        
                                            AU-TRANS-HIST-SEQ-NO.       
                                                                        
      *    FORMAT AR_TRANS_HIST VARIABLES.                                      
           MOVE AT-ACCOUNT-NO           TO AR-ACCOUNT-NO.               
           MOVE WS-A                    TO AR-CODE-TRAN-TYPE.           
           MOVE AT-COMPANY-NO           TO AR-COMPANY-NO.               
           MOVE SPACES                  TO AR-DATE-ORIG-PYMT.           
           MOVE -1                      TO WS-DATE-ORIG-PYMT-IND.       
           MOVE CMN-TODAYS-DATE         TO AR-DATE-TRANS                
                                           AR-DATE-CASH-REPORT.         
           MOVE SPACES                  TO AR-PYMT-FACILITY-CD.         
           MOVE WS-N                    TO AR-RECORD-ONLY-FL.           
           MOVE CMN-USER-ID             TO PF-USER-ID.                  
           PERFORM 7080-SELECT-RESP-AREA-ID   THRU 7080-EXIT.           
           MOVE PF-RESP-AREA-ID         TO AR-RESP-AREA-ID.             
           MOVE SPACES                  TO AR-TRAN-COMMENT-TEXT.        
           MOVE +0                      TO AR-TRAN-COMMENT-LEN.         
           MOVE CMN-USER-ID             TO AR-USER-ID.                  
           MOVE '01'                    TO AR-CASH-COMPANY-NO.          
           MOVE '998'                   TO AR-CASH-LOCAL-OFFICE.        
           MOVE '998'                   TO AR-CASH-REPORT-NO.           
           MOVE +9999                   TO AR-CASH-DRAWER-ID.           
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           MOVE 1                       TO WS-100-JRNL-TRAN-APPL-NO.    
           MOVE AT-DATE-LAST-ACTION     TO WS-100-DATE-LAST-ACTION.     
                                                                        
      *    SELECT EPP RECEIVABLE DETAILS.                                       
           MOVE AT-ACCOUNT-NO               TO WS-AC-ACCOUNT-NO.        
           MOVE 50                          TO WS-AC-PYMT-PRIORITY-LVL. 
           MOVE 1                           TO WS-AC-ITEM-ID.           
           PERFORM 7380-SELECT-DET-AR-CNTL  THRU 7380-EXIT.             
                                                                        
           MOVE WS-AC-AMT-AR-DAY-00         TO WS-AMT-AR-DAY-00-EPP.    
           MOVE WS-AC-AMT-AR-DAY-30         TO WS-AMT-AR-DAY-30-EPP.    
           MOVE WS-AC-AMT-AR-DAY-60         TO WS-AMT-AR-DAY-60-EPP.    
           MOVE WS-AC-AMT-AR-DAY-90         TO WS-AMT-AR-DAY-90-EPP.    
           MOVE WS-AC-AMT-UNUSED-CR         TO WS-AMT-UNUSED-CR-EPP.    
                                                                        
      *    LOAD COMMON 113-FORMAT VARIABLES.                                    
           MOVE AT-TOTAL-AR-BALANCE         TO AR-AMT-BILLED-UNPAID.    
                                                                        
      *    FORMAT AR_TRN_HST_DET VARIABLES.                                     
           MOVE AT-ACCOUNT-NO               TO AU-ACCOUNT-NO.           
           MOVE WS-F                        TO AU-CODE-AR-AGE.          
           MOVE SPACES                      TO AU-CODE-CONTRACT-TYPE    
                                               AU-CURRENCY-TYPE.        
           MOVE WS-AR-BUD-GL-NO (WS-GL-SUB)                             
                                            TO AU-GL-ACCT-CREDIT        
                                               AU-GL-ACCT-DEBIT.        
           MOVE 0                           TO AU-ITEM-ID.              
           MOVE 1                           TO AU-TRAN-APPL-NO.         
                                                                        
      *    COMPUTE AMOUNT POSTED.                                               
           COMPUTE AU-AMT-POSTED =                                      
              (WS-AC-AMT-AR-DAY-00 + WS-AC-AMT-AR-DAY-30 +              
               WS-AC-AMT-AR-DAY-60 + WS-AC-AMT-AR-DAY-90 +              
               AC-AMT-UNUSED-CR).                                       
                                                                        
           IF AU-AMT-POSTED < 0                                         
              COMPUTE AU-AMT-POSTED = (AU-AMT-POSTED * -1)              
              COMPUTE AR-AMT-BILLED-UNPAID =                            
                 (AR-AMT-BILLED-UNPAID + AU-AMT-POSTED)                 
           ELSE                                                         
              COMPUTE AR-AMT-BILLED-UNPAID =                            
                 (AR-AMT-BILLED-UNPAID - AU-AMT-POSTED)                 
           END-IF.                                                      
                                                                        
           MOVE AU-AMT-POSTED           TO AR-AMT-ORIG-ENTERED.         
           MOVE AR-AMT-BILLED-UNPAID    TO AT-TOTAL-AR-BALANCE.         
                                                                        
      *    PROCESS AGING BUCKETS.                                               
           MOVE 0                       TO WS-AC-AMT-AR-DAY-90          
                                           WS-AC-AMT-AR-DAY-60          
                                           WS-AC-AMT-AR-DAY-30          
                                           AC-AMT-AR-DAY-90             
                                           AC-AMT-AR-DAY-60             
                                           AC-AMT-AR-DAY-30             
                                                                        
           MOVE AR-AMT-ORIG-ENTERED     TO AU-CURRENCY-AMT.             
                                                                        
       5811-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5812-SETUP-ADJ-JRNL.                                           *        
      ******************************************************************        
       5812-SETUP-ADJ-JRNL.                                             
                                                                        
           MOVE 0                             TO AU-TRAN-APPL-NO.       
           MOVE 1                             TO AU-ITEM-ID.            
           MOVE WS-A                          TO AR-CODE-TRAN-TYPE.     
                                                                        
           IF WS-AMT-AR-DAY-00-EPP NOT = 0                              
              MOVE '0'                        TO AU-CODE-AR-AGE         
              MOVE WS-AMT-AR-DAY-00-EPP       TO AU-AMT-POSTED          
              PERFORM 5813-JRNL-ADJ           THRU 5813-JRNL-ADJ        
           END-IF.                                                      
                                                                        
           IF WS-AMT-AR-DAY-30-EPP NOT = 0                              
              MOVE '3'                        TO AU-CODE-AR-AGE         
              MOVE WS-AMT-AR-DAY-30-EPP       TO AU-AMT-POSTED          
              PERFORM 5813-JRNL-ADJ           THRU 5813-JRNL-ADJ        
           END-IF.                                                      
                                                                        
           IF WS-AMT-AR-DAY-60-EPP NOT = 0                              
              MOVE '6'                        TO AU-CODE-AR-AGE         
              MOVE WS-AMT-AR-DAY-60-EPP       TO AU-AMT-POSTED          
              PERFORM 5813-JRNL-ADJ           THRU 5813-JRNL-ADJ        
           END-IF.                                                      
                                                                        
           IF WS-AMT-AR-DAY-90-EPP NOT = 0                              
              MOVE '9'                        TO AU-CODE-AR-AGE         
              MOVE WS-AMT-AR-DAY-90-EPP       TO AU-AMT-POSTED          
              PERFORM 5813-JRNL-ADJ           THRU 5813-JRNL-ADJ        
           END-IF.                                                      
                                                                        
           IF WS-AMT-UNUSED-CR-EPP NOT = 0                              
              MOVE 'P'                        TO AU-CODE-AR-AGE         
              MOVE WS-AMT-UNUSED-CR-EPP       TO AU-AMT-POSTED          
              PERFORM 5813-JRNL-ADJ           THRU 5813-JRNL-ADJ        
           END-IF.                                                      
                                                                        
           MOVE 0                             TO AU-TRAN-APPL-NO.       
           MOVE SPACES                        TO AU-CODE-AR-AGE.        
                                                                        
       5812-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5813-JRNL-ADJ.                                                 *        
      ******************************************************************        
       5813-JRNL-ADJ.                                                   
                                                                        
           ADD +1                             TO AU-TRAN-APPL-NO.       
                                                                        
           IF AU-TRAN-APPL-NO = 1                                       
              PERFORM 7200-SELECT-TIMESTAMP   THRU 7200-EXIT            
              MOVE WS-CURRENT-TIMESTAMP       TO AR-TRANS-HIST-SEQ-NO   
                                                 AU-TRANS-HIST-SEQ-NO   
           END-IF.                                                      
                                                                        
           IF AU-AMT-POSTED < 0                                         
              MULTIPLY -1                     BY AU-AMT-POSTED          
           END-IF.                                                      
                                                                        
           MOVE WS-AR-BUD-GL-NO (WS-GL-SUB)   TO AU-GL-ACCT-CREDIT      
                                                 AU-GL-ACCT-DEBIT       
                                                 WS-101-ACCT-GEN-LED-DR 
                                                 WS-101-ACCT-GEN-LED-CR.
                                                                        
           MOVE SPACES                  TO WS-101-CASH-DRAWER-USED.     
                                                                        
           MOVE WS-AMT-POSTED           TO WS-101-AMT-POSTED            
                                           WS-JRNL-RCV-DEBIT-AMT        
                                           WS-JRNL-RCV-CREDIT-AMT.      
           MOVE AR-AMT-ORIG-ENTERED     TO WS-101-AMOUNT-ENTERED.       
           MOVE AT-TOTAL-AR-BALANCE     TO WS-101-ACCT-END-AR-BAL.      
           MOVE AU-CODE-AR-AGE          TO WS-101-AR-AGE.               
           MOVE WS-CURRENT-DATE         TO WS-101-DATE-AR-BILLED.       
           MOVE 0                       TO WS-101-ITEM-ID-NO.           
                                                                        
           IF AC-PYMT-PRIORITY-LVL < 50                                 
              MOVE 0                    TO WS-101-DETAIL-END-AR-BAL     
                                           WS-101-DETAIL-END-BAL        
           ELSE                                                         
              MOVE AC-AMT-TRAN-BALANCE  TO WS-101-DETAIL-END-BAL        
              COMPUTE WS-101-DETAIL-END-AR-BAL = AC-AMT-AR-DAY-00 +     
                                                 AC-AMT-AR-DAY-30 +     
                                                 AC-AMT-AR-DAY-60 +     
                                                 AC-AMT-AR-DAY-90       
           END-IF.                                                      
                                                                        
           MOVE SPACES                  TO WS-101-FUNCTION-CODE.        
           MOVE PR-REV-DISTRICT-CD      TO WS-101-CODE-REVENUE-DISTRICT.
           MOVE CU-CODE-EMPL-ACCT       TO WS-101-CODE-EMPL-ACCT.       
           MOVE AT-CODE-COMPANY-ACCT    TO WS-101-CODE-COMPANY-ACCT.    
           MOVE AT-CODE-ACCT-STAT       TO WS-101-CODE-ACCOUNT-STATUS.  
           MOVE PR-CODE-PREMISE-STAT    TO WS-101-CODE-PREMISE-STATUS.  
           MOVE 101                     TO WS-101-JRNL-FORMAT-NO.       
           MOVE SPACES                  TO WS-101-CASH-DRAWER-USED.     
                                                                        
           MOVE CJF00101                TO WS-100-USER-DEFINED-AREA.    
                                                                        
           MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
           PERFORM 6400-ONLINE-JRNL-ROUTINE       THRU 6400-EXIT.       
                                                                        
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                            TO WS-JRNL-WRITTEN    
           ELSE                                                         
              MOVE PROGRAM-NAME                   TO ABEND-PROGRAM      
              MOVE 'USERABEN'                     TO ABEND-FUNCTION     
              PERFORM 9900-SQL-ERROR-ROUTINE      THRU 9900-EXIT        
           END-IF.                                                      
                                                                        
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT.       
                                                                        
       5813-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5820-TRANSFER-EPP-TO-HIST.                                     *        
      * TRANSFER EPP (BUDGET PLAN) INFORMATION TO BUDGET HISTORY.      *        
      ******************************************************************        
       5820-TRANSFER-EPP-TO-HIST.                                       
                                                                        
      *    SELECT BUDGET PLAN ROW.                                              
           MOVE AT-ACCOUNT-NO            TO BU-ACCOUNT-NO.              
           MOVE 50                       TO BU-PYMT-PRIORITY-LVL.       
           MOVE +1                       TO BU-BP-ITEM-ID.              
           PERFORM 7340-SELECT-BUDGET-PLAN      THRU 7340-EXIT.         
                                                                        
      *    INSERT BUDGET HISTORY ROW.                                           
           MOVE AT-ACCOUNT-NO            TO BH-ACCOUNT-NO.              
           MOVE 50                       TO BH-PYMT-PRIORITY-LVL.       
           MOVE +1                       TO BH-ITEM-ID.                 
           MOVE BU-AMT-MO-PYMT           TO BH-AMT-MO-PYMT.             
           MOVE 0                        TO BH-BALANCE-FORWARD.         
           MOVE WS-PROGRAM-TIMESTAMP     TO BH-BUD-HIST-SEQ-NO.         
           MOVE WS-D                     TO BH-CHANGE-REASON.           
           MOVE BU-DATE-PYMT-STRT        TO BH-DATE-PYMT-STRT.          
           IF BU-DATE-PYMT-STRT > SPACES                                
              MOVE 0                     TO WS-NULL-DT-IND-1            
           ELSE                                                         
              MOVE -1                    TO WS-NULL-DT-IND-1            
           END-IF.                                                      
           MOVE 0                        TO BH-EPP-ESTIMATE.            
           MOVE WS-PROGRAM-TIMESTAMP     TO BH-LAST-UPDATE-TS.          
           MOVE SPACES                   TO BH-METHOD-OF-ESTIMATE.      
           MOVE WS-TRANSFER-EPP-DESC     TO BH-REMARKS-TEXT.            
           MOVE +28                      TO BH-REMARKS-LEN.             
           MOVE WS-AC-AMT-TRAN-BALANCE   TO BH-UTILITY-BALANCE.         
      *    SELECT BILL HOOK HEADER.                                             
           MOVE AT-ACCOUNT-NO            TO BI-ACCOUNT-NO.              
           PERFORM 7331-SELECT-CSS-BILLING-HDR  THRU 7331-EXIT.         
                                                                        
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
              NEXT SENTENCE                                             
           ELSE                                                         
      *       PROCESS BILL HEADER AND DETAILS.                                  
              MOVE AT-ACCOUNT-NO                TO BG-ACCOUNT-NO        
              MOVE BI-BILL-NO                   TO BG-BILL-NO           
T20499        IF AT-REV-MTH-LST-NRML  > 0                               
T20499           MOVE AT-REV-MTH-LST-NRML TO   BG-REVENUE-MONTH         
T20499        ELSE                                                      
                 PERFORM 7700-SELECT-BILLING-DET THRU 7700-EXIT         
T20499        END-IF                                                    
           END-IF.                                                      
                                                                        
           MOVE BG-REVENUE-MONTH                TO WS-REVENUE-MONTH.    
           PERFORM 5822-COMPUTE-FIELDS          THRU 5822-EXIT.         
           PERFORM 8520-INSERT-CSS-BUDGET-HIST  THRU 8520-EXIT.         
                                                                        
       5820-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5821-DETERMINE-UTL-RATIOS.                                     *        
      * CHECK FOR THE SPLIT PERCENTAGE.                                *        
      ******************************************************************        
       5821-DETERMINE-UTL-RATIOS.                                       
                                                                        
           MOVE AT-ACCOUNT-NO               TO AR-ACCOUNT-NO            
                                               AU-ACCOUNT-NO.           
                                                                        
T20243*    PERFORM 7921-FETCH-ACCOUNT           THRU 7921-EXIT.                 
T20243*    MOVE AT-LAST-NRML-BILL-NO            TO  BG-BILL-NO.                 
A04847*    MOVE 'E'                             TO  BG-CODE-UTIL-TYPE.          
A04847*    PERFORM 7922-READ-BILLING-DET        THRU 7922-EXIT.                 
A04847*    IF  WS-ELECGAS-EXISTS = 'Y'                                          
A04847*        SET  UTE-EXISTS                  TO  TRUE                        
A04847*        MOVE  'N'                        TO  WS-ELECGAS-EXISTS           
A04847*    END-IF                                                               
A04847*    MOVE 'G'                             TO BG-CODE-UTIL-TYPE.           
A04847*    PERFORM 7922-READ-BILLING-DET        THRU 7922-EXIT.                 
A04847*    IF  WS-ELECGAS-EXISTS = 'Y'                                          
A04847*        SET  UTG-EXISTS                  TO  TRUE                        
A04847*        MOVE  'N'                        TO  WS-ELECGAS-EXISTS           
A04847*    END-IF                                                               
A04847*    PERFORM 7930-SUM-AMT-BILL-ITEM       THRU 7930-EXIT.                 
A04847*    MOVE 'U'                             TO  BG-CODE-UTIL-TYPE.          
A04847*    IF UTE-EXISTS AND UTG-EXISTS                                         
A04847*       NEXT SENTENCE                                                     
A04847*    ELSE                                                                 
A04847*        MOVE AT-ACCOUNT-NO               TO CP-ACCOUNT-NO                
A04847*    PERFORM 7924-DECLARE-CUST-PLAN   THRU 7924-EXIT.                     
A04847*    PERFORM 7926-OPEN-CUST-PLAN      THRU 7926-EXIT.                     
A04847*    PERFORM 7927-FETCH-CUST-PLAN     THRU 7927-EXIT                      
A04847*                            UNTIL SQLCODE = NOT-FOUND                    
A04847*                            OR (UTE-EXISTS AND UTG-EXISTS).              
A04847*    PERFORM 7928-CLOSE-CUST-PLAN     THRU 7928-EXIT.                     
A04847*    END-IF.                                                              
T20243     MOVE WS-AC-AMT-TRAN-BALANCE             TO WS-AMT-POSTED     
T20243     IF WS-AC-AMT-TRAN-BALANCE > 0                                
T20243        PERFORM 7929-SPLIT-AMT            THRU 7929-EXIT          
T20243     ELSE                                                         
T20243        MOVE WS-AMT-POSTED                TO  AU-AMT-POSTED       
           END-IF.                                                      
                                                                        
       5821-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5822-COMPUTE-FIELDS                                            *        
      ******************************************************************        
       5822-COMPUTE-FIELDS.                                             
                                                                        
           MOVE BU-DATE-PYMT-STRT    TO WS-START-DATE.                  
           MOVE BU-ANNIVERSARY-DATE  TO WS-ANNIVERSARY-DATE.            
           MOVE WS-AD-MONTH          TO WS-AD-MONTH-X.                  
           MOVE WS-AD-YEAR           TO WS-AD-YEAR-X.                   
           MOVE WS-AD-MONTH-RED      TO WS-MONTH1.                      
           MOVE WS-AD-YEAR-RED       TO WS-YEAR1.                       
           MOVE WS-REVENUE-MONTH     TO WS-REVENUE-MONTH-X.             
           MOVE WS-REVENUE-MONTH-X   TO WS-YEAR-MONTH2.                 
           IF WS-MONTH2 = 12 AND WS-YEAR1 = WS-YEAR2 + 2                
              ADD  1                    TO WS-MONTH2
           END-IF.                   
           IF WS-MONTH2 > 12                                            
              COMPUTE WS-MONTH2 = WS-MONTH2 - 12                        
              COMPUTE WS-YEAR2  = WS-YEAR2 + 1                          
           END-IF.                                                      
           IF WS-YEAR1 > WS-YEAR2                                       
              ADD +12 TO WS-MONTH1                                      
           END-IF.                                                      
                                                                        
           COMPUTE BH-EPP-MTHS-RMNG-QT = WS-MONTH1 - WS-MONTH2.         
                                                                        
       5822-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5825-TRANSFER-EPP-TO-UTL.                                      *        
      * TRANSFER EPP (BUDGET) TO UTILITY GAS AND/OR ELECTRIC.          *        
      ******************************************************************        
       5825-TRANSFER-EPP-TO-UTL.                                        
                                                                        
      *       FORMAT 101-FORMAT VARIABLES.                                      
              INITIALIZE CJF00101                                       
              MOVE 101                    TO WS-101-JRNL-FORMAT-NO      
              MOVE SPACES                 TO WS-101-CASH-DRAWER-USED    
              MOVE 0                      TO WS-101-ITEM-ID-NO          
              MOVE PR-REV-DISTRICT-CD     TO                            
                                          WS-101-CODE-REVENUE-DISTRICT  
              MOVE CU-CODE-EMPL-ACCT      TO WS-101-CODE-EMPL-ACCT      
              MOVE AT-CODE-COMPANY-ACCT   TO WS-101-CODE-COMPANY-ACCT   
              MOVE PR-CODE-PREMISE-STAT   TO WS-101-CODE-PREMISE-STATUS 
                                                                        
      *       GET NEW TIMESTAMP.                                                
              PERFORM 7200-SELECT-TIMESTAMP  THRU 7200-EXIT             
              MOVE WS-CURRENT-TIMESTAMP   TO WS-PROGRAM-TIMESTAMP       
                                             AR-TRANS-HIST-SEQ-NO       
                                             AU-TRANS-HIST-SEQ-NO       
                                                                        
      *       FORMAT AR_TRANS_HIST VARIABLES.                                   
              MOVE WS-D                   TO AR-CODE-TRAN-TYPE          
              MOVE WS-AC-AMT-TRAN-BALANCE TO AR-AMT-ORIG-ENTERED        
                                             AR-AMT-BILLED-UNPAID       
T19013        ADD AT-TOTAL-AR-BALANCE     TO AR-AMT-BILLED-UNPAID       
T19013        MOVE AR-AMT-BILLED-UNPAID   TO AT-TOTAL-AR-BALANCE        
              IF AR-AMT-ORIG-ENTERED < 0                                
                 COMPUTE AR-AMT-ORIG-ENTERED = AR-AMT-ORIG-ENTERED * -1 
              END-IF                                                    
                                                                        
      *       FORMAT AR_TRN_HST_DET VARIABLES.                                  
              MOVE 0                      TO AU-ITEM-ID                 
                                             AU-TRAN-APPL-NO            
                                                                        
      *       TRANSFER EPP TO UTILITY ELECTRIC.                                 
T20243        IF WS-UTILITY-BALANCE-UTE > 0                             
                 MOVE WS-E                TO WS-UTILITY                 
T20243           MOVE WS-UTILITY-BALANCE-UTE                            
T20243                                    TO AU-AMT-POSTED              
                 PERFORM 5830-LOAD-UTL-FOR-XFR  THRU 5830-EXIT          
              END-IF                                                    
                                                                        
      *       TRANSFER EPP TO UTILITY GAS.                                      
T20243        IF WS-UTILITY-BALANCE-UTG > 0                             
                 MOVE WS-G                TO WS-UTILITY                 
T20243           MOVE WS-UTILITY-BALANCE-UTG                            
T20243                                    TO AU-AMT-POSTED              
                 PERFORM 5830-LOAD-UTL-FOR-XFR  THRU 5830-EXIT          
              END-IF.                                                   
T20243        IF WS-AC-AMT-TRAN-BALANCE < 0                             
T20243           PERFORM 5826-CONTINUE-CIA-PROCESS THRU 5826-EXIT       
T20243        END-IF.                                                   
T20243        PERFORM 5840-UPDATE-TOTAL-AR-BALANCE THRU 5840-EXIT.      
T17989*   END-IF.                                                               
T20243        IF  WS-AC-AMT-TRAN-BALANCE <= 0                           
T17989            MOVE WS-PROGRAM-TIMESTAMP        TO AC-LAST-UPDATE-TS 
T20243            PERFORM 5316-CREATE-UTE-UTG-AR   THRU 5316-EXIT       
T20243        END-IF.                                                   
                                                                        
       5825-EXIT.                                                       
           EXIT.                                                        
                                                                        
T20243*****************************************************************         
T20243* 5826-CONTINUE-CIA-PROCESS.                                              
T20243* WHEN EPP AMOUNT IS < 0 THEN CREATE CIA                                  
T20243*****************************************************************         
T20243 5826-CONTINUE-CIA-PROCESS.                                       
           ADD 1                           TO AU-TRAN-APPL-NO.          
           IF  AU-AMT-POSTED < 0                                        
               COMPUTE AU-AMT-POSTED = AU-AMT-POSTED * -1               
           END-IF.                                                      
           MOVE AU-AMT-POSTED              TO WS-101-AMOUNT-ENTERED     
           MOVE WS-AR-CIA-GL-NO (WS-GL-SUB)                             
                                           TO WS-101-ACCT-GEN-LED-CR    
                                              AU-GL-ACCT-CREDIT         
           MOVE WS-AR-BUD-GL-NO (WS-GL-SUB)                             
                                           TO WS-101-ACCT-GEN-LED-DR    
                                              AU-GL-ACCT-DEBIT          
           MOVE AU-AMT-POSTED              TO WS-JRNL-RCV-CREDIT-AMT    
                                              WS-JRNL-GEN-LEG-DEBIT-AMT 
           MOVE 0                          TO WS-101-AR-AGE             
                                              AU-CODE-AR-AGE.           
           MOVE AT-DATE-BILL-DAY-00        TO WS-101-DATE-AR-BILLED.    
           MOVE 0                          TO WS-101-ITEM-ID-NO.        
           MOVE AU-AMT-POSTED              TO WS-101-AMT-POSTED.        
           MOVE 0                          TO WS-101-DETAIL-END-AR-BAL. 
           MOVE WS-AC-AMT-TRAN-BALANCE     TO WS-101-DETAIL-END-BAL     
           MOVE AT-DATE-LAST-ACTION        TO WS-100-DATE-LAST-ACTION.  
           MOVE CMN-TODAYS-DATE            TO AT-DATE-LAST-ACTION.      
           MOVE CJF00101                   TO WS-100-USER-DEFINED-AREA. 
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                 17942500
           MOVE WS-JRNL-ONLY               TO WS-JRNL-OPERATION-RQST.   
           PERFORM 6400-ONLINE-JRNL-ROUTINE    THRU 6400-EXIT.          
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                         TO WS-JRNL-WRITTEN       
           ELSE                                                         
              MOVE PROGRAM-NAME                TO ABEND-PROGRAM         
              MOVE 'USERABEN'                  TO ABEND-FUNCTION        
              PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT           
           END-IF.                                                      
                                                                        
      *    PROCESS AR TRANSACTION HISTORY.                              17943600
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
                                                                        
           ADD 1                           TO WS-100-JRNL-TRAN-APPL-NO. 
                                                                        
T20243*    CREATE CIA RECEIVABLE.                                       17944300
T20243     PERFORM 5315-CREATE-CIA-RECORD        THRU 5315-EXIT.        
                                                                        
T20243 5826-EXIT.                                                       
T20243     EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 5827-RCC-TO-CIA-PROCESS.                                                
T22772* WHEN RCC AMOUNT IS < 0 THEN CREATE CIA                                  
T22772*****************************************************************         
T22772 5827-RCC-TO-CIA-PROCESS.                                         
T22772                                                                  
T22772     ADD 1                           TO AU-TRAN-APPL-NO.          
T22772     MOVE AU-AMT-POSTED              TO WS-101-AMOUNT-ENTERED     
T22772     MOVE SPACES                     TO WS-101-AR-AGE             
T22772     MOVE WS-AR-CIA-GL-NO (WS-GL-SUB)                             
T22772                                     TO WS-101-ACCT-GEN-LED-CR    
T22772                                        AU-GL-ACCT-CREDIT         
T22772     MOVE WS-AR-CCC-GL-NO (WS-GL-SUB)                             
T22772                                     TO WS-101-ACCT-GEN-LED-DR    
T22772                                        AU-GL-ACCT-DEBIT          
T22772     MOVE AU-AMT-POSTED              TO WS-JRNL-RCV-CREDIT-AMT    
T22772                                        WS-JRNL-GEN-LEG-DEBIT-AMT 
T22772     MOVE 0                          TO WS-101-AR-AGE             
T22772                                        AU-CODE-AR-AGE.           
T22772     MOVE AT-DATE-BILL-DAY-00        TO WS-101-DATE-AR-BILLED.    
T22772     MOVE 0                          TO WS-101-ITEM-ID-NO.        
T22772     MOVE AU-AMT-POSTED              TO WS-101-AMT-POSTED.        
T22772     MOVE 0                          TO WS-101-DETAIL-END-AR-BAL. 
T22772     MOVE WS-AC-AMT-TRAN-BALANCE     TO WS-101-DETAIL-END-BAL     
T22772     MOVE AT-DATE-LAST-ACTION        TO WS-100-DATE-LAST-ACTION.  
T22772     MOVE CMN-TODAYS-DATE            TO AT-DATE-LAST-ACTION.      
T22772     MOVE CJF00101                   TO WS-100-USER-DEFINED-AREA. 
T22772                                                                  
T22772*    PROCESS CASH DRAWER JOURNAL.                                 17942500
T22772     MOVE WS-JRNL-ONLY               TO WS-JRNL-OPERATION-RQST.   
T22772     PERFORM 6400-ONLINE-JRNL-ROUTINE      THRU 6400-EXIT.        
T22772     IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
T22772        MOVE 'Y'                     TO WS-JRNL-WRITTEN           
T22772     ELSE                                                         
T22772        MOVE PROGRAM-NAME            TO ABEND-PROGRAM             
T22772        MOVE 'USERABEN'              TO ABEND-FUNCTION            
T22772        PERFORM 9900-SQL-ERROR-ROUTINE     THRU 9900-EXIT         
T22772     END-IF.                                                      
T22772                                                                  
T22772*    PROCESS AR TRANSACTION HISTORY.                              17943600
T22772     PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
T22772                                                                  
T22772     ADD 1                           TO WS-100-JRNL-TRAN-APPL-NO. 
T22772                                                                  
T22772*    CREATE CIA RECEIVABLE.                                       17944300
T22772     PERFORM 5315-CREATE-CIA-RECORD        THRU 5315-EXIT.        
T22772 5827-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5830-LOAD-UTL-FOR-XFR.                                         *        
      ******************************************************************        
       5830-LOAD-UTL-FOR-XFR.                                           
                                                                        
           ADD 1                           TO AU-TRAN-APPL-NO.          
                                                                        
           IF AU-AMT-POSTED < 0                                         
              COMPUTE AU-AMT-POSTED = AU-AMT-POSTED * -1                
           END-IF.                                                      
                                                                        
           MOVE AU-AMT-POSTED              TO WS-101-AMOUNT-ENTERED.    
                                                                        
      *    ASSIGN GL DEBIT AND CREDIT NUMBERS.                                  
T20243*    IF WS-AC-AMT-TRAN-BALANCE > 0                                        
              IF WS-UTILITY = WS-E                                      
                 MOVE WS-AR-UTE-GL-NO (WS-GL-SUB)                       
                                           TO WS-101-ACCT-GEN-LED-DR    
                                              AU-GL-ACCT-DEBIT          
              ELSE                                                      
                 MOVE WS-AR-UTG-GL-NO (WS-GL-SUB)                       
                                           TO WS-101-ACCT-GEN-LED-DR    
                                              AU-GL-ACCT-DEBIT          
              END-IF                                                    
                                                                        
              MOVE WS-AR-BUD-GL-NO (WS-GL-SUB)                          
                                           TO WS-101-ACCT-GEN-LED-CR    
                                              AU-GL-ACCT-CREDIT         
              MOVE AU-AMT-POSTED           TO WS-JRNL-RCV-DEBIT-AMT     
                                              WS-JRNL-GEN-LEG-CREDIT-AMT
           MOVE AT-TOTAL-AR-BALANCE        TO WS-101-ACCT-END-AR-BAL.   
           MOVE 0                          TO WS-101-AR-AGE             
                                              AU-CODE-AR-AGE.           
           MOVE AT-DATE-BILL-DAY-00        TO WS-101-DATE-AR-BILLED.    
           MOVE 0                          TO WS-101-ITEM-ID-NO.        
           MOVE AU-AMT-POSTED              TO WS-101-AMT-POSTED.        
           MOVE 0                          TO WS-101-DETAIL-END-AR-BAL. 
           MOVE WS-AC-AMT-TRAN-BALANCE     TO WS-101-DETAIL-END-BAL.    
           MOVE AT-DATE-LAST-ACTION        TO WS-100-DATE-LAST-ACTION.  
           MOVE CMN-TODAYS-DATE            TO AT-DATE-LAST-ACTION.      
           MOVE CJF00101                   TO WS-100-USER-DEFINED-AREA. 
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-ONLY               TO WS-JRNL-OPERATION-RQST.   
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
      *    PROCESS AR TRANSACTION HISTORY.                                      
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
                                                                        
           ADD 1                           TO WS-100-JRNL-TRAN-APPL-NO. 
                                                                        
                                                                        
      *    CREATE NEW UTILITY RECEIVABLE.                                       
           PERFORM 5845-CREATE-UTL-RECORD        THRU 5845-EXIT.        
                                                                        
       5830-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5840-UPDATE-TOTAL-AR-BALANCE.                                  *        
      ******************************************************************        
       5840-UPDATE-TOTAL-AR-BALANCE.                                    
                                                                        
           EXEC SQL                                                     
               UPDATE CSS_ACCOUNT                                       
                  SET TOTAL_AR_BALANCE = :AT-TOTAL-AR-BALANCE,          
                      LAST_UPDATE_TS   = CIS.CURRENT$TIMESTAMP()              
                WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                       
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ACCOUNT                                               
MFA-TR*           SET TOTAL_AR_BALANCE = :AT-TOTAL-AR-BALANCE,                  
MFA-TR*               LAST_UPDATE_TS   = CURRENT TIMESTAMP                      
MFA-TR*         WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                               
MFA-TR*         QUERYNO 5840                                                    
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '5840'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_ACCOUNT'             TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
              MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       5840-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 5845-CREATE-UTL-RECORD.                                        *        
      * CREATE UTILITY ELECTRIC OR UTILITY GAS RECEIVABLE.             *        
      ******************************************************************        
       5845-CREATE-UTL-RECORD.                                          
                                                                        
      *    INSERT UTILITY ELECTRIC RECEIVABLE.                                  
T20243     IF  WS-UTILITY = WS-E                                        
T20243         MOVE WS-UTILITY-BALANCE-UTE  TO  AC-AMT-AR-DAY-00        
T20243         MOVE 40                      TO  AC-PYMT-PRIORITY-LVL    
           ELSE                                                         
T20243         MOVE WS-UTILITY-BALANCE-UTG  TO  AC-AMT-AR-DAY-00        
T20243         MOVE 45                      TO  AC-PYMT-PRIORITY-LVL    
T20243     END-IF                                                       
              MOVE 0                     TO  AC-AMT-UNUSED-CR           
              MOVE AT-ACCOUNT-NO         TO AC-ACCOUNT-NO               
              MOVE 0                     TO AC-ITEM-ID                  
                                            AC-AMT-AR-DAY-30            
                                            AC-AMT-AR-DAY-60            
                                            AC-AMT-AR-DAY-90            
                                            AC-AMT-TRAN-BALANCE         
                                            AC-TOT-SUMM-UNBILLED        
              MOVE WS-PROGRAM-TIMESTAMP  TO AC-LAST-UPDATE-TS           
              PERFORM 8600-INSERT-SUMM-AR-CNTL    THRU 8600-EXIT.       
                                                                        
       5845-EXIT.                                                       
           EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 5900-ADJUST-BILLED-BAL                                        *         
T17746*  REMOVE BILLED BALANCE OUT OF DPP/DFA/DEP.                    *         
T17746*****************************************************************         
T17746 5900-ADJUST-BILLED-BAL.                                          
                                                                        
T17746*    SELECT EPP SUMMARY ROW                                               
T17746     MOVE AT-ACCOUNT-NO                   TO AC-ACCOUNT-NO.       
T17746     MOVE 0                               TO AC-ITEM-ID.          
T17746     MOVE WS-PROG-FINAL-BILL-EPP          TO AR-APPL-PROGRAM-ID.  
T17746                                                                  
T17746     PERFORM 7991-OPEN-TOT-AR-CNTL        THRU 7991-EXIT.         
T17746     PERFORM 7992-FETCH-TOT-AR-CNTL       THRU 7992-EXIT.         
T17746     PERFORM UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND              
T17746                                                                  
T17746        MOVE AT-CODES-DATA-PRESENT        TO WS-CODES-DATA-PRESENT
T17746        PERFORM 5910-JOURNAL-BILLED-BAL   THRU 5910-EXIT          
T17746                                                                  
T17746        IF AC-PYMT-PRIORITY-LVL = 90 AND                          
T17746           AC-ITEM-ID < 30000000                                  
T17746*         DELETE DPP EARNEST PAYMENT                                      
T17746          PERFORM 8881-DELETE-AR-CNTL       THRU 8881-EXIT        
T17746*         ADD EARNEST AMT TRAN BALANCE TO REGULAR TRAN BALANCE            
T17746          PERFORM 7996-UPDATE-DPP         THRU 7996-EXIT          
T17746        END-IF                                                    
T17746                                                                  
T17746        PERFORM 7992-FETCH-TOT-AR-CNTL    THRU 7992-EXIT          
T17746                                                                  
T17746     END-PERFORM.                                                 
CBSI          PERFORM 7993-CLOSE-TOT-AR-CNTL    THRU 7993-EXIT.         
T17746                                                                  
T17746 5900-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746******************************************************************        
T17746* 5910-JOURNAL-BILLED-BAL.                                       *        
T17746******************************************************************        
T17746 5910-JOURNAL-BILLED-BAL.                                         
T17746                                                                  
T17746     MOVE 0                             TO AU-TRAN-APPL-NO.       
T17746     MOVE WS-A                          TO AR-CODE-TRAN-TYPE.     
T17746     PERFORM 5912-SETUP-TRANS-HIST      THRU 5912-EXIT.           
T17746                                                                  
T17746     IF AC-AMT-AR-DAY-00 NOT = 0                                  
T17746        MOVE '0'                        TO AU-CODE-AR-AGE         
T17746        MOVE AC-AMT-AR-DAY-00           TO AU-AMT-POSTED          
T17746        PERFORM 5911-JRNL-ADJ           THRU 5911-EXIT            
T17746        MOVE 0                          TO AC-AMT-AR-DAY-00       
T17746        PERFORM 7995-UPDATE-AR-CNTL     THRU 7995-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746     IF AC-AMT-AR-DAY-30 NOT = 0                                  
T17746        MOVE '3'                        TO AU-CODE-AR-AGE         
T17746        MOVE AC-AMT-AR-DAY-30           TO AU-AMT-POSTED          
T17746        PERFORM 5911-JRNL-ADJ           THRU 5911-EXIT            
T17746        MOVE 0                          TO AC-AMT-AR-DAY-30       
T17746        PERFORM 7995-UPDATE-AR-CNTL     THRU 7995-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746     IF AC-AMT-AR-DAY-60 NOT = 0                                  
T17746        MOVE '6'                        TO AU-CODE-AR-AGE         
T17746        MOVE AC-AMT-AR-DAY-60           TO AU-AMT-POSTED          
T17746        PERFORM 5911-JRNL-ADJ           THRU 5911-EXIT            
T17746        MOVE 0                          TO AC-AMT-AR-DAY-60       
T17746        PERFORM 7995-UPDATE-AR-CNTL     THRU 7995-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746     IF AC-AMT-AR-DAY-90 NOT = 0                                  
T17746        MOVE '9'                        TO AU-CODE-AR-AGE         
T17746        MOVE AC-AMT-AR-DAY-90           TO AU-AMT-POSTED          
T17746        PERFORM 5911-JRNL-ADJ           THRU 5911-EXIT            
T17746        MOVE 0                          TO AC-AMT-AR-DAY-90       
T17746        PERFORM 7995-UPDATE-AR-CNTL     THRU 7995-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746                                                                  
T17746 5910-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746******************************************************************        
T17746* 5911-JRNL-ADJ.                                                          
T17746******************************************************************        
T17746 5911-JRNL-ADJ.                                                   
T17746                                                                  
T17746     ADD +1                             TO AU-TRAN-APPL-NO.       
T17746                                                                  
T17746     IF AU-TRAN-APPL-NO = 1                                       
T17746        PERFORM 7200-SELECT-TIMESTAMP   THRU 7200-EXIT            
T17746        MOVE WS-CURRENT-TIMESTAMP       TO AR-TRANS-HIST-SEQ-NO   
T17746                                           AU-TRANS-HIST-SEQ-NO   
T17746     END-IF.                                                      
T17746                                                                  
T17746     IF AU-AMT-POSTED < 0                                         
T17746        MULTIPLY -1                     BY AU-AMT-POSTED          
T17746     END-IF.                                                      
T17746                                                                  
           EVALUATE AC-PYMT-PRIORITY-LVL                                
             WHEN 80                                                    
               MOVE WS-AR-DEP-GL-NO (WS-GL-SUB)    TO AU-GL-ACCT-CREDIT 
T17746         MOVE WS-PROG-CREDIT-DEP-BILLED      TO AR-APPL-PROGRAM-ID
             WHEN 90                                                    
               MOVE WS-AR-DFA-GL-NO (WS-GL-SUB)    TO AU-GL-ACCT-CREDIT 
T19884         IF AC-ITEM-ID GREATER THAN OR EQUAL TO 40000000          
T19884            MOVE WS-PROG-CREDIT-DFA-BILLED   TO AR-APPL-PROGRAM-ID
T19884         ELSE                                                     
T19884            MOVE WS-PROG-CREDIT-DPP-BILLED   TO AR-APPL-PROGRAM-ID
T19884         END-IF                                                   
           END-EVALUATE.                                                
T17746                                                                  
T17746     MOVE AU-GL-ACCT-CREDIT             TO AU-GL-ACCT-DEBIT       
T17746                                           WS-101-ACCT-GEN-LED-DR 
T17746                                           WS-101-ACCT-GEN-LED-CR.
T17746                                                                  
T17746     MOVE SPACES                  TO WS-101-CASH-DRAWER-USED.     
T17746                                                                  
T17746     MOVE WS-AMT-POSTED           TO WS-101-AMT-POSTED            
T17746                                     WS-JRNL-RCV-DEBIT-AMT        
T17746                                     WS-JRNL-RCV-CREDIT-AMT.      
T17746     MOVE AR-AMT-ORIG-ENTERED     TO WS-101-AMOUNT-ENTERED.       
T17746     MOVE AT-TOTAL-AR-BALANCE     TO WS-101-ACCT-END-AR-BAL.      
T17746     MOVE AU-CODE-AR-AGE          TO WS-101-AR-AGE.               
T17746     MOVE WS-CURRENT-DATE         TO WS-101-DATE-AR-BILLED.       
T17746     MOVE 0                       TO WS-101-ITEM-ID-NO.           
T17746                                                                  
T17746     MOVE AC-AMT-TRAN-BALANCE  TO WS-101-DETAIL-END-BAL           
T17746     COMPUTE WS-101-DETAIL-END-AR-BAL = AC-AMT-AR-DAY-00 +        
T17746                                           AC-AMT-AR-DAY-30 +     
T17746                                           AC-AMT-AR-DAY-60 +     
T17746                                           AC-AMT-AR-DAY-90       
T17746     COMPUTE WS-101-DETAIL-END-AR-BAL = WS-101-DETAIL-END-AR-BAL  
T17746                                        - AU-AMT-POSTED           
T17746     END-COMPUTE                                                  
T17746     COMPUTE AT-TOTAL-AR-BALANCE      = AT-TOTAL-AR-BALANCE       
T17746                                        - AU-AMT-POSTED           
T17746     END-COMPUTE                                                  
T17746     PERFORM 7994-UPDATE-ACCT         THRU 7994-EXIT              
T17746     MOVE AT-TOTAL-AR-BALANCE     TO AR-AMT-BILLED-UNPAID         
T17746                                                                  
T17746     MOVE SPACES                  TO WS-101-FUNCTION-CODE.        
T17746     MOVE PR-REV-DISTRICT-CD      TO WS-101-CODE-REVENUE-DISTRICT.
T17746     MOVE CU-CODE-EMPL-ACCT       TO WS-101-CODE-EMPL-ACCT.       
T17746     MOVE AT-CODE-COMPANY-ACCT    TO WS-101-CODE-COMPANY-ACCT.    
T17746     MOVE AT-CODE-ACCT-STAT       TO WS-101-CODE-ACCOUNT-STATUS.  
T17746     MOVE PR-CODE-PREMISE-STAT    TO WS-101-CODE-PREMISE-STATUS.  
T17746     MOVE 101                     TO WS-101-JRNL-FORMAT-NO.       
T17746     MOVE SPACES                  TO WS-101-CASH-DRAWER-USED.     
T17746                                                                  
T17746     MOVE CJF00101                TO WS-100-USER-DEFINED-AREA.    
T17746                                                                  
T17746     MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
T17746     PERFORM 6400-ONLINE-JRNL-ROUTINE       THRU 6400-EXIT.       
T17746                                                                  
T17746     IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
T17746        MOVE 'Y'                            TO WS-JRNL-WRITTEN    
T17746     ELSE                                                         
T17746        MOVE PROGRAM-NAME                   TO ABEND-PROGRAM      
T17746        MOVE 'USERABEN'                     TO ABEND-FUNCTION     
T17746        PERFORM 9900-SQL-ERROR-ROUTINE      THRU 9900-EXIT        
T17746     END-IF.                                                      
T17746                                                                  
T17746     PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT.       
T17746                                                                  
T17746 5911-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746******************************************************************        
T17746* 5912-SETUP-TRANS-HIST.                                         *        
T17746******************************************************************        
T17746 5912-SETUP-TRANS-HIST.                                           
T17746                                                                  
T17746     MOVE CMN-TODAYS-DATE         TO AT-DATE-LAST-ACTION.         
T17746                                                                  
T17746*    GET NEW TIMESTAMP.                                                   
T17746     PERFORM 7200-SELECT-TIMESTAMP THRU 7200-EXIT.                
T17746     MOVE WS-CURRENT-TIMESTAMP     TO WS-PROGRAM-TIMESTAMP        
T17746                                      AR-TRANS-HIST-SEQ-NO        
T17746                                      AU-TRANS-HIST-SEQ-NO.       
T17746                                                                  
T17746*    FORMAT AR_TRANS_HIST VARIABLES.                                      
T17746     MOVE AT-ACCOUNT-NO           TO AR-ACCOUNT-NO.               
T17746     MOVE WS-A                    TO AR-CODE-TRAN-TYPE.           
T17746     MOVE AT-COMPANY-NO           TO AR-COMPANY-NO.               
T17746     MOVE SPACES                  TO AR-DATE-ORIG-PYMT.           
T17746     MOVE -1                      TO WS-DATE-ORIG-PYMT-IND.       
T17746     MOVE CMN-TODAYS-DATE         TO AR-DATE-TRANS                
T17746                                     AR-DATE-CASH-REPORT.         
T17746     MOVE SPACES                  TO AR-PYMT-FACILITY-CD.         
T17746     MOVE WS-N                    TO AR-RECORD-ONLY-FL.           
T17746     MOVE CMN-USER-ID             TO PF-USER-ID.                  
T17746     PERFORM 7080-SELECT-RESP-AREA-ID   THRU 7080-EXIT.           
T17746     MOVE PF-RESP-AREA-ID         TO AR-RESP-AREA-ID.             
T17746     MOVE SPACES                  TO AR-TRAN-COMMENT-TEXT.        
T17746     MOVE +0                      TO AR-TRAN-COMMENT-LEN.         
T17746     MOVE CMN-USER-ID             TO AR-USER-ID.                  
T17746     MOVE '01'                    TO AR-CASH-COMPANY-NO.          
T17746     MOVE '998'                   TO AR-CASH-LOCAL-OFFICE.        
T17746     MOVE '998'                   TO AR-CASH-REPORT-NO.           
T17746     MOVE +9999                   TO AR-CASH-DRAWER-ID.           
T17746                                                                  
T17746*    LOAD COMMON 100-FORMAT VARIABLES.                                    
T17746     MOVE 1                       TO WS-100-JRNL-TRAN-APPL-NO.    
T17746     MOVE AT-DATE-LAST-ACTION     TO WS-100-DATE-LAST-ACTION.     
T17746                                                                  
T17746                                                                  
T17746*    FORMAT AR_TRN_HST_DET VARIABLES.                                     
T17746     MOVE AT-ACCOUNT-NO               TO AU-ACCOUNT-NO.           
T17746     MOVE WS-F                        TO AU-CODE-AR-AGE.          
T17746     MOVE SPACES                      TO AU-CODE-CONTRACT-TYPE    
T17746                                         AU-CURRENCY-TYPE.        
T17746     MOVE AC-ITEM-ID                  TO AU-ITEM-ID.              
T17746     MOVE 0                           TO AU-CURRENCY-AMT          
T17746     COMPUTE AR-AMT-ORIG-ENTERED      =    AC-AMT-AR-DAY-00 +     
T17746                                           AC-AMT-AR-DAY-30 +     
T17746                                           AC-AMT-AR-DAY-60 +     
T17746                                           AC-AMT-AR-DAY-90       
T17746     END-COMPUTE.                                                 
T17746                                                                  
T17746 5912-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
P00547******************************************************************        
P00547* 5920-IAT-WQ.                                                   *        
P00547* CHECKS IF INTERNATIONAL ACH TRANSACTION WQ NEEDS TO BE SENT    *        
P00547******************************************************************        
P00547 5920-IAT-WQ.                                                     
P00547                                                                  
P00547     MOVE '5920'                    TO ACTIVE-PARAGRAPH.          
P00547                                                                  
P00547     MOVE 'N'                       TO WS-IAT-CAT-FOUND.          
P00547     PERFORM 7470-CHECK-IAT-CATEGORY THRU 7470-EXIT.              
P00547                                                                  
P00547     IF WS-IAT-CAT-FOUND = 'N'                                    
P00547                                                                  
ACT103       INITIALIZE CWS00077-FIELDS                                 
P00547       EXEC SQL                                                   
ACT103            SELECT
              CAST(SYSDATETIMEOFFSET() AS DATE)
            INTO
              :WS-77-DATE-CREATED                
P00547       END-EXEC                                                   

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ028
MFA-TR*      EXEC SQL                                                           
MFA-TR*           SET :WS-77-DATE-CREATED = CURRENT DATE                        
MFA-TR*      END-EXEC                                                           

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00547                                                                  
ACT103       MOVE 423                       TO WS-77-CATEGORY-ID        
ACT103       MOVE SPACES                    TO WS-77-RESP-AREA-ID       
ACT103       MOVE CMN-SERV-ORDER-NO         TO WS-77-SERV-ORDER-NO      
ACT103       MOVE CMN-USER-ID               TO WS-77-USER-ID-ORIG       
ACT103       MOVE WS-77-DATE-CREATED        TO WS-77-DATE-REQUIRED      
ACT103       MOVE AT-ACCOUNT-NO             TO WS-77-ACCOUNT-NO         
ACT103       MOVE PR-PREMISE-NO             TO WS-77-PREMISE-NO         
ACT103       MOVE CU-CUSTOMER-NO            TO WS-77-CUSTOMER-NO        
ACT103       MOVE AT-LOCAL-OFFICE           TO WS-77-LOCAL-OFFICE       
ACT103       MOVE '4'                       TO WS-77-ROUTE-CATEGORY     
ACT103       MOVE 'N'                       TO WS-77-PRIORITY           
ACT103       MOVE WS-IAT-MESSAGE            TO WS-77-COMMENTS-TEXT      
ACT103       MOVE 51                        TO WS-77-COMMENTS-LEN       
ACT103       MOVE SPACES                    TO WS-77-FREE-FORM-TXT      
ACT103       MOVE ZERO                      TO WS-77-FREE-FORM-LEN      
ACT103       MOVE PROGRAM-NAME              TO WS-77-CREATED-BY         
P00547       PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT              
P00547                                                                  
P00547     END-IF.                                                      
P00547                                                                  
P00547 5920-EXIT.                                                       
P00547     EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6630-REVERSE-DFA.                                             *        
      *     1. RETRIEVE ACCOUNT.                                       *        
      *     2. RETRIEVE DFA-ACCOUNT.                                   *        
      *     3. PERFORM MISC JOURNALLING.                               *        
      *     4. ACCUMULATE OUTSTANDING AMOUNT.                          *        
      *     5. CALCULATE ORIGINAL AMOUNT.                              *        
      *     6. LOAD STATIC DETAIL AND HEADER COLUMNS FOR JOURNALLING.  *        
      *     7. RETRIEVE FIRST DFA-RECV.                                *        
      *     8. IF ORIGINAL AND OUSTANDING AMOUNTS ARE EQUAL,           *        
      *        NO PAYMENTS HAVE BEEN MADE. MOVE DFA-RECV BACK TO       *        
      *        ORIGINAL AGING BUCKETS.                                 *        
      *        ELSE MOVE ALL TO 30-DAY AGING SO CREDIT COLLECTIONS     *        
      *        WILL BE SET TO ARREARS.                                 *        
      *     9. REVERSE/DELETE OTHER APPROPRIATE ROWS.                  *        
      *    10. UPDATE ACCOUNT.                                         *        
      *    11. CLOSE CASH DRAWER.                                      *        
      *    12. REMOVE CREDIT COLLECTION INFO                           *        
      ******************************************************************        
       6630-REVERSE-DFA.                                                
      *1.                                                                       
T20721     MOVE 0                           TO WS-AU-AMT-TOTAL.         
           MOVE WS-ACCOUNT-NO               TO AT-ACCOUNT-NO.           
           PERFORM 6672-SELECT-ACCOUNT    THRU 6672-EXIT.               
           MOVE AT-CODES-DATA-PRESENT       TO WS-CODES-DATA-PRESENT.   
      *2.                                                                       
           MOVE WS-ACCOUNT-NO               TO DA-ACCOUNT-NO.           
           MOVE +90                         TO DA-PYMT-PRIORITY-LVL.    
           MOVE WS-AC-ITEM-ID               TO DA-DFA-ITEM-ID.          
           PERFORM 6676-SELECT-DFA-ACCT     THRU 6676-EXIT.             
                                                                        
           MOVE DA-FRST-ERNST-PAY-DT TO WS-DFA-1ST-ERNST-PAY-DT.        
           MOVE DA-SCND-ERNST-PAY-DT TO WS-DFA-2ND-ERNST-PAY-DT.        
      *3.                                                                       
           MOVE 0                           TO WS-TRAN-APPL-NO.         
           MOVE WS-R                        TO DA-CODE-DFA-STATUS.      
           MOVE 'ACCOUNT FINALED; FORCED REVERSAL'                      
                                            TO DA-REVERSE-REASON.       
           PERFORM 6685-UPDATE-DFA-ACCT     THRU 6685-EXIT.             
      *4.                                                                       
           MOVE WS-ACCOUNT-NO               TO AC-ACCOUNT-NO.           
           MOVE +90                         TO AC-PYMT-PRIORITY-LVL.    
           IF DA-CODE-DFA-TYPE = WS-B                                   
              IF WS-DFA-1ST-ERNST-PAY-DT > SPACES                       
                 MOVE WS-DFA-1ST-ERNST-PAY-DT                           
                                            TO WS-ERNST-DATE            
                 MOVE WS-DFA-DATE-1-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-1-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-1-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AC-ITEM-ID               
                 PERFORM 6682-SELECT-AR-CNTL-NO-TS                      
                                            THRU 6682-SELECT-NO-TS-EXIT 
                 IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL         
                    ADD AC-AMT-TRAN-BALANCE                             
                                            TO WS-DFA-OUTSTANDING       
                    MOVE AC-AMT-TRAN-BALANCE                            
                                            TO WS-JRNL-1ST-ERNST-PAY-AMT
                                               WS-DFA-TOTAL-ERNST-AMT   
                 END-IF                                                 
                 IF WS-DFA-2ND-ERNST-PAY-DT > SPACES                    
                    MOVE WS-DFA-2ND-ERNST-PAY-DT                        
                                            TO WS-ERNST-DATE            
                    MOVE WS-DFA-DATE-2-MM   TO WS-DATE-6-MM             
                    MOVE WS-DFA-DATE-2-DD   TO WS-DATE-6-DD             
                    MOVE WS-DFA-DATE-2-YY   TO WS-DATE-6-YY             
                    MOVE WS-DATE-6-NUM      TO AC-ITEM-ID               
                    PERFORM 6682-SELECT-AR-CNTL-NO-TS                   
                                            THRU 6682-SELECT-NO-TS-EXIT 
                    IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL      
                       ADD AC-AMT-TRAN-BALANCE                          
                                            TO WS-DFA-OUTSTANDING       
                       ADD AC-AMT-TRAN-BALANCE                          
                                            TO WS-DFA-TOTAL-ERNST-AMT   
                       MOVE AC-AMT-TRAN-BALANCE                         
                                            TO WS-JRNL-2ND-ERNST-PAY-AMT
                                                                        
           MOVE SPACES                      TO WS-ERNST-DATE
                    END-IF
                 END-IF
              END-IF
           END-IF.           
           MOVE WS-DFA-ITEM-ID              TO AC-ITEM-ID.              
           PERFORM 6682-SELECT-AR-CNTL-NO-TS                            
                                          THRU  6682-SELECT-NO-TS-EXIT  
           ADD AC-AMT-AR-DAY-00                                         
               AC-AMT-AR-DAY-30                                         
               AC-AMT-AR-DAY-60                                         
               AC-AMT-AR-DAY-90             TO WS-DFA-TOTAL-ERNST-AMT.  
                                                                        
           ADD AC-AMT-TRAN-BALANCE          TO WS-DFA-OUTSTANDING.      
      *5.                                                                       
           COMPUTE WS-AMT-RECV-ORIG-ENTERED = DA-AMT-ORIG-ENTERED       
      *6.                                                                       
           PERFORM 6634-SUMMARY-AR-JRNL-REV                             
                                            THRU 6634-EXIT.             
      *7.                                                                       
           MOVE WS-ACCOUNT-NO               TO DV-ACCOUNT-NO            
PCR393                                         CT-ACCOUNT-NO.           
           MOVE WS-DFA-ITEM-ID              TO DV-AGREEMENT-NO.         
PCR393     MOVE 90                          TO DV-PYMT-PRIORITY-LVL.    
PCR393     MOVE 100                         TO DV-DFA-PYMT-PRIORITY     
PCR393                                         CT-PYMT-PRIORITY-LVL.    
PCR393     PERFORM 6650-OPEN-CNT-CURSOR     THRU 6650-EXIT.             
PCR393     PERFORM 6660-FETCH-CNT-CURSOR    THRU 6660-EXIT              
PCR393        VARYING SUB-RECV FROM 1 BY 1                              
PCR393        UNTIL SUB-RECV > 20 OR WS-ACTIVE-RETURN-CODE = NOT-FOUND. 
PCR393     PERFORM 6670-CLOSE-CNT-CURSOR    THRU 6670-EXIT.             
                                                                        
           PERFORM 6681-OPEN-DFA-REC-CURSOR                             
                                          THRU 6681-OPEN-EXIT.          
           PERFORM 6681-FETCH-DFA-REC-CURSOR                            
                                          THRU 6681-FETCH-EXIT.         
      *8.                                                                       
           IF WS-AMT-RECV-ORIG-ENTERED = WS-DFA-OUTSTANDING             
              PERFORM 6632-MOVE-AS-IS     THRU 6632-EXIT                
                UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND                 
           ELSE                                                         
T19884        MOVE WS-N TO WS-DFA-RECV-SW                               
              PERFORM 6631-PROCESS-DFA-RECV  THRU 6631-EXIT             
                UNTIL RECV-DONE                                         
           END-IF.                                                      
                                                                        
           PERFORM 6681-CLOSE-DFA-REC-CURSOR THRU 6681-CLOSE-EXIT.      
                                                                        
      *9.                                                                       
PCR393     PERFORM                                                      
PCR393        VARYING SUB-RECV FROM 1 BY 1                              
PCR393        UNTIL SUB-RECV > 20 OR                                    
PCR393              TB-CNT-ITEM-ID(SUB-RECV) = ZERO                     
PCR393        MOVE TB-CNT-ITEM-ID(SUB-RECV)    TO CT-CNT-ITEM-ID        
PCR393                                                                  
PCR393        PERFORM 7250-SELECT-CONTRACT     THRU 7250-EXIT           
PCR393        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                
PCR393           MOVE 'B'                       TO CT-CNT-STATUS-CD     
PCR393           MOVE CT-CONTRACT-COMMENTS-TEXT TO WS-HOLD-COMMENTS     
PCR393           MOVE WS-XFR-FROM-COMMENT                               
PCR393                               TO CT-CONTRACT-COMMENTS-TEXT       
PCR393           MOVE WS-HOLD-COMMENTS                                  
PCR393                               TO CT-CONTRACT-COMMENTS-TEXT(14:36)
PCR393           MOVE WS-HOLD-COMMENTS                                  
PCR393                               TO CT-CONTRACT-COMMENTS-TEXT(14:36)
PCR393           MOVE 50             TO CT-CONTRACT-COMMENTS-LEN        
PCR393           MOVE WS-DFA-TIMESTAMP    TO CT-LAST-UPDATE-TS          
PCR393           MOVE WS-CURRENT-DATE     TO CT-STATUS-CHANGE-DT        
PCR393           PERFORM 8000-UPDATE-CONTRACT  THRU 8000-EXIT           
PCR393        END-IF                                                    
PCR393     END-PERFORM.                                                 
                                                                        
           PERFORM 6638-REVERSE           THRU 6638-EXIT.               
      *10.                                                                      
           IF DA-CODE-DFA-TYPE = WS-B                                   
              MOVE SPACES            TO AT-CODE-DISC-OK                 
           END-IF.                                                      
           MOVE WS-CODES-DATA-PRESENT       TO AT-CODES-DATA-PRESENT.   
           MOVE WS-DFA-TIMESTAMP            TO AT-LAST-UPDATE-TS.       
           MOVE AR-AMT-BILLED-UNPAID        TO AT-TOTAL-AR-BALANCE.     
           PERFORM 6692-UPDATE-ACCOUNT    THRU 6692-EXIT.               
      *11.                                                                      
           PERFORM 6699-CLOSE-CSH-DRWR    THRU 6699-EXIT.               
      *12.                                                                      
           IF DA-CODE-DFA-TYPE = WS-B                                   
              MOVE WS-ACCOUNT-NO             TO CL-ACCOUNT-NO           
              MOVE 'F'                       TO CL-CODE-NOTICE-TYPE     
              PERFORM 6697-SELECT-CL THRU 6697-EXIT                     
              IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                
                 IF CL-DATE-NOTICE-MAIL > WS-CURRENT-DATE               
                    PERFORM 6696-DELETE-D-CL THRU 6696-EXIT             
                    MOVE 'G'         TO CL-CODE-NOTICE-TYPE             
                    PERFORM 6696-DELETE-D-CL THRU 6696-EXIT             
                 ELSE                                                   
                    IF CL-DATE-CREDIT-ACTION > WS-CURRENT-DATE          
                       MOVE 'G'      TO CL-CODE-NOTICE-TYPE             
                       PERFORM 6696-DELETE-D-CL THRU 6696-EXIT          
                    END-IF                                              
                 END-IF                                                 
              END-IF                                                    
           END-IF.                                                      
                                                                        
       6630-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6631-PROCESS-DFA-RECV.                                        *        
      *     1. COMPUTE THE AMOUNT TO BE TRANSFERED.                    *        
      *        THIS AMOUNT IS CALCULATED BY FINDING THE PERCENTAGE OF  *        
      *        THE OUTSTANDING RECIEVABLE TO BE RESET TO THE REC.      *        
      *     2. CHECK FOR THE LAST RECEIVABLE.                          *        
      *     3. IF THE LAST RECIEVABLE IS BEING PROCESSED, MOVE THE     *        
      *        REMAINING AMOUNT TO BE TRANSFERRED TO THE RECEIVABLE.   *        
      *        THERE WILL ONLY BE A COUPLE OF CENTS DIFFERENCE EITHER  *        
      *        WAY, BUT THIS RESOLVES ANY ROUNDING ERRORS FROM THE     *        
      *        PERCENTAGE CALULATION IN STEP 1.                        *        
      *        WAY, BUT THIS RESOLVES ANY ROUNDING ERRORS FROM THE     *        
      *     4. IF DFA, MOVE TRANSFER AMOUNTS TO 00-DAY AGING.          *        
      *        IF DPP, MOVE TRANSFER AMOUNTS TO 30-DAY AGING.          *        
      *     5. CREATE/UPDATE AR-CNTL.                                  *        
      *     6. CREATE NEW DETAIL FOR DETAIL SUMMARY RECEIVABLE TYPES.  *        
      *     7. UPDATE ACCOUNT.                                         *        
      ******************************************************************        
       6631-PROCESS-DFA-RECV.                                           
                                                                        
           MOVE 0                           TO AC-AMT-AR-DAY-00         
                                               AC-AMT-AR-DAY-30         
                                               AC-AMT-AR-DAY-60         
                                               AC-AMT-AR-DAY-90         
                                               AC-ITEM-ID               
                                               AC-AMT-TRAN-BALANCE      
                                               AC-AMT-UNUSED-CR         
                                               AC-TOT-SUMM-UNBILLED.    
T23454     MOVE 0                           TO WS-AMT-DAY-00            
T23454                                         WS-AMT-DAY-30.           
      *1.                                                                       
           COMPUTE WS-AR-AMT-TRANS ROUNDED = DV-AMT-CONTRACT-DEFR *     
                          WS-DFA-OUTSTANDING / WS-AMT-RECV-ORIG-ENTERED.
                                                                        
           MOVE DV-DFA-PYMT-PRIORITY        TO AC-PYMT-PRIORITY-LVL.    
           MOVE 0                           TO AC-ITEM-ID.              
      *2.                                                                       
           PERFORM 6681-FETCH-DFA-REC-CURSOR                            
                                          THRU 6681-FETCH-EXIT.         
      *3.                                                                       
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
              COMPUTE WS-AR-AMT-TRANS = WS-DFA-OUTSTANDING -            
                                        WS-AU-AMT-TOTAL                 
              MOVE WS-Y                 TO WS-DFA-RECV-SW               
           END-IF.                                                      
      *4.                                                                       
           IF DA-CODE-DFA-TYPE = WS-A                                   
              MOVE WS-AR-AMT-TRANS          TO WS-AMT-DAY-00            
                                               AC-AMT-AR-DAY-00         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 0                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
                                               AC-AMT-AR-DAY-30         
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           ELSE                                                         
              MOVE WS-AR-AMT-TRANS          TO WS-AMT-DAY-30            
              MOVE WS-AMT-DAY-30            TO AC-AMT-AR-DAY-30         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 3                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
              MOVE 0                        TO AC-AMT-AR-DAY-00         
PCR393                                                                  
PCR393        IF DV-CNT-ITEM-ID > 0                                     
PCR393           MOVE 'N'                   TO WS-FOUND-CNT-NAME        
PCR393           PERFORM                                                
PCR393              VARYING SUB-RECV FROM 1 BY 1                        
SCA006              UNTIL WS-FOUND-CNT-NAME = 'Y' OR 
                          SUB-RECV > 20 OR 
                          TB-CNT-ITEM-ID(SUB-RECV) = ZERO                       
PCR393                                                                  
PCR393              IF TB-CNT-ITEM-ID(SUB-RECV) = DV-CNT-ITEM-ID        
PCR393                 MOVE 'Y'             TO WS-FOUND-CNT-NAME        
PCR393                 MOVE TB-CODE-CNT-TYPE(SUB-RECV)                  
PCR393                                      TO CT-CODE-CONTRACT-TYPE    
PCR393              END-IF                                              
PCR393           END-PERFORM                                            
PCR393        END-IF                                                    
                                                                        
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           END-IF.                                                      
      *5.                                                                       
           MOVE WS-ACCOUNT-NO               TO AC-ACCOUNT-NO.           
           MOVE WS-DFA-TIMESTAMP            TO AC-LAST-UPDATE-TS.       
                                                                        
           PERFORM 6683-INSERT-AR-CNTL    THRU 6683-EXIT.               
           IF NOT (WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL)             
              PERFORM 6682-SELECT-AR-CNTL-NO-TS                         
                                          THRU 6682-SELECT-NO-TS-EXIT   
              ADD WS-AMT-DAY-00             TO AC-AMT-AR-DAY-00         
              ADD WS-AMT-DAY-30             TO AC-AMT-AR-DAY-30         
              PERFORM 6693-UPDATE-AR-CNTL THRU 6693-EXIT                
           END-IF.                                                      
      *6.                                                                       
           IF NOT AC-PYMT-PRIORITY-LVL < 60                             
PCR393        IF AC-PYMT-PRIORITY-LVL = 100                             
PCR393           MOVE DV-CNT-ITEM-ID        TO AC-ITEM-ID               
PCR393        ELSE                                                      
PCR393           PERFORM 6687-GET-MAX-ITEM-ID  THRU 6687-EXIT           
PCR393           COMPUTE AC-ITEM-ID = WS-MAX-ITEM-ID + 1                
PCR393        END-IF                                                    
                                                                        
              MOVE WS-AMT-DAY-00            TO AC-AMT-AR-DAY-00         
              MOVE WS-AMT-DAY-30            TO AC-AMT-AR-DAY-30         
              MOVE 0                        TO AC-AMT-AR-DAY-60         
                                               AC-AMT-AR-DAY-90         
                                               AC-AMT-UNUSED-CR         
                                               AC-TOT-SUMM-UNBILLED     
              ADD WS-AMT-DAY-00                                         
                  WS-AMT-DAY-30             TO AC-AMT-TRAN-BALANCE      
              MOVE WS-DFA-TIMESTAMP         TO AC-LAST-UPDATE-TS        
              PERFORM 6683-INSERT-AR-CNTL THRU 6683-EXIT                
T20238*  INSERTING A ROW INTO THE CONNECT_CHARGE TABLE                          
T20238        MOVE WS-ACCOUNT-NO            TO CC-ACCOUNT-NO            
T20238        MOVE DV-DFA-PYMT-PRIORITY     TO CC-PYMT-PRIORITY-LVL     
T20238        MOVE 0                        TO CC-AMT-TAX-CITY          
T20238                                         CC-AMT-TAX-OTHER         
T20238                                         CC-AMT-TAX-STATE         
T20238                                         CC-AMT-TAX-XCISE         
T20238                                         CC-AMT-TRANS             
T20238        MOVE AC-ITEM-ID               TO CC-CCC-ITEM-ID           
T20238        MOVE WS-AR-AMT-TRANS          TO CC-AMT-ORIG-ENTERED      
T20238        MOVE WS-DFA-TIMESTAMP         TO CC-LAST-UPDATE-TS        
T20238                                                                  
T20238        IF WS-NULL-INDICATOR-2 EQUAL -1                           
T20238             MOVE WS-TODAYS-DATE      TO CC-DATE-CCC-BILLED       
T20238                                         CC-DATE-TRANS            
T20238        ELSE                                                      
T20238             MOVE AT-DATE-BILL-DAY-30 TO CC-DATE-CCC-BILLED       
T20238                                         CC-DATE-TRANS            
T20238        END-IF                                                    
T25819        MOVE WS-B                     TO CC-CODE-CCC-TYPE         
T20238                                                                  
T20238        MOVE AC-PYMT-PRIORITY-LVL    TO WS-CURR-PYMT-PRIORITY-LVL 
T20238        PERFORM 6675-FIND-RCNCT-TYPE-NO THRU 6675-EXIT            
T20238        MOVE WS-CURR-PYMT-PRIORITY-LVL  TO AC-PYMT-PRIORITY-LVL   
T20238                                                                  
T20238        PERFORM 6677-INSERT-CON-CHG   THRU 6677-EXIT              
           END-IF.                                                      
      *7.                                                                       
           EVALUATE AC-PYMT-PRIORITY-LVL                                
               WHEN 19                                                  
                    MOVE WS-A               TO WS-CODE-NSF-CHK-CHG      
               WHEN 20                                                  
                    MOVE WS-A               TO WS-CODE-NSF-CHK-AMT      
T20838         WHEN 29                                                  
                    MOVE WS-A               TO WS-CODE-NSF-CHK-AMT      
               WHEN 30                                                  
                    MOVE WS-A               TO WS-CODE-LPC              
T19106         WHEN 39                                                  
T19106              MOVE WS-A               TO WS-CODE-LPC              
               WHEN 60                                                  
                    MOVE WS-A               TO WS-CODE-CONNECT-CHRG     
PCR393         WHEN 100                                                 
PCR393              MOVE WS-A               TO WS-CODE-CONTRACT         
           END-EVALUATE.                                                
                                                                        
       6631-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6632-MOVE-AS-IS.                                              *        
      *     1. CREATE/UPDATE AR-CNTL.                                  *        
      *     2. CREATE NEW DETAIL FOR DETAIL SUMMARY RECEIVABLE TYPES.  *        
      *     3. UPDATE ACCOUNT.                                         *        
      ******************************************************************        
       6632-MOVE-AS-IS.                                                 
           MOVE 0                           TO AC-AMT-AR-DAY-00         
                                               AC-AMT-AR-DAY-30         
                                               AC-AMT-AR-DAY-60         
                                               AC-AMT-AR-DAY-90         
                                               AC-AMT-UNUSED-CR         
                                               AC-AMT-TRAN-BALANCE      
                                               AC-TOT-SUMM-UNBILLED.    
      *1.                                                                       
           MOVE DV-DFA-PYMT-PRIORITY        TO AC-PYMT-PRIORITY-LVL.    
           MOVE 0                           TO AC-ITEM-ID.              
                                                                        
PCR393     IF DV-CNT-ITEM-ID > 0                                        
PCR393        MOVE 'N'                      TO WS-FOUND-CNT-NAME        
PCR393        PERFORM                                                   
PCR393           VARYING SUB-RECV FROM 1 BY 1                           
SCA006           UNTIL WS-FOUND-CNT-NAME = 'Y' OR 
                       SUB-RECV > 20 OR 
                       TB-CNT-ITEM-ID(SUB-RECV) = ZERO                          
PCR393                                                                  
PCR393           IF TB-CNT-ITEM-ID(SUB-RECV) = DV-CNT-ITEM-ID           
PCR393              MOVE TB-CODE-CNT-TYPE(SUB-RECV)                     
PCR393                                      TO CT-CODE-CONTRACT-TYPE    
PCR393           END-IF                                                 
PCR393        END-PERFORM                                               
PCR393     END-IF.                                                      
                                                                        
           IF DV-AMT-DAY-00 > 0                                         
              MOVE DV-AMT-DAY-00            TO AC-AMT-AR-DAY-00         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 0                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           END-IF.                                                      
      *                                                                         
           IF DV-AMT-DAY-30 > 0                                         
              MOVE DV-AMT-DAY-30            TO AC-AMT-AR-DAY-30         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 3                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           END-IF.                                                      
      *                                                                         
           IF DV-AMT-DAY-60 > 0                                         
              MOVE DV-AMT-DAY-60            TO AC-AMT-AR-DAY-60         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 6                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           END-IF.                                                      
      *                                                                         
           IF DV-AMT-DAY-90 > 0                                         
              MOVE DV-AMT-DAY-90            TO AC-AMT-AR-DAY-90         
                                               AU-AMT-POSTED            
                                               WS-101-AMT-POSTED        
              MOVE 9                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
              PERFORM 6635-WRITE-JRNL-REV THRU 6635-EXIT                
           END-IF.                                                      
      *                                                                         
           MOVE WS-ACCOUNT-NO               TO AC-ACCOUNT-NO.           
           MOVE 0                           TO AC-AMT-UNUSED-CR         
                                               AC-TOT-SUMM-UNBILLED.    
           MOVE 0                           TO AC-AMT-TRAN-BALANCE.     
           MOVE WS-DFA-TIMESTAMP            TO AC-LAST-UPDATE-TS.       
           PERFORM 6683-INSERT-AR-CNTL    THRU 6683-EXIT.               
           IF NOT WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL               
PCR393        IF AC-PYMT-PRIORITY-LVL = 100                             
PCR393           MOVE DV-CNT-ITEM-ID        TO AC-ITEM-ID               
PCR393        END-IF                                                    
              PERFORM 6682-SELECT-AR-CNTL-NO-TS                         
                                          THRU 6682-SELECT-NO-TS-EXIT   
              ADD DV-AMT-DAY-00             TO AC-AMT-AR-DAY-00         
              ADD DV-AMT-DAY-30             TO AC-AMT-AR-DAY-30         
              ADD DV-AMT-DAY-60             TO AC-AMT-AR-DAY-60         
              ADD DV-AMT-DAY-90             TO AC-AMT-AR-DAY-90         
              PERFORM 6693-UPDATE-AR-CNTL THRU 6693-EXIT                
           END-IF.                                                      
      *2.                                                                       
           IF NOT (AC-PYMT-PRIORITY-LVL < 60 OR                         
                   AC-PYMT-PRIORITY-LVL = 100)                          
              PERFORM 6687-GET-MAX-ITEM-ID THRU 6687-EXIT               
              COMPUTE AC-ITEM-ID = WS-MAX-ITEM-ID + 1                   
                                                                        
              MOVE DV-AMT-DAY-00            TO AC-AMT-AR-DAY-00         
              MOVE DV-AMT-DAY-30            TO AC-AMT-AR-DAY-30         
              MOVE 0                        TO AC-AMT-UNUSED-CR         
                                               AC-TOT-SUMM-UNBILLED     
              IF AC-PYMT-PRIORITY-LVL > 50                              
                 MOVE DV-AMT-CONTRACT-DEFR  TO AC-AMT-TRAN-BALANCE      
              ELSE                                                      
                 MOVE 0                     TO AC-AMT-TRAN-BALANCE      
              END-IF                                                    
              MOVE WS-DFA-TIMESTAMP         TO AC-LAST-UPDATE-TS        
              PERFORM 6683-INSERT-AR-CNTL THRU 6683-EXIT                
                                                                        
      **  AT THIS TIME RCC IS THE ONLY AR TYPE MEETING THE DETAIL/SUMMAR        
      **  FORMAT.  IF THIS CHANGES, MORE CODE WILL BE NEEDED TO UPDATE          
      **  THE APPROPRIATE AR-DETAIL TABLES.                                     
                                                                        
              MOVE WS-ACCOUNT-NO            TO CC-ACCOUNT-NO            
              MOVE DV-DFA-PYMT-PRIORITY     TO CC-PYMT-PRIORITY-LVL     
              MOVE 0                        TO CC-AMT-TAX-CITY          
                                               CC-AMT-TAX-OTHER         
                                               CC-AMT-TAX-STATE         
                                               CC-AMT-TAX-XCISE         
                                               CC-AMT-TRANS             
              MOVE AC-ITEM-ID               TO CC-CCC-ITEM-ID           
              MOVE DV-AMT-CONTRACT-DEFR     TO CC-AMT-ORIG-ENTERED      
              MOVE WS-DFA-TIMESTAMP         TO CC-LAST-UPDATE-TS        
                                                                        
T18441        IF WS-NULL-INDICATOR-2 EQUAL -1                           
T18441             MOVE WS-TODAYS-DATE      TO CC-DATE-CCC-BILLED       
                                               CC-DATE-TRANS            
              ELSE                                                      
                   MOVE AT-DATE-BILL-DAY-30 TO CC-DATE-CCC-BILLED       
                                               CC-DATE-TRANS            
              END-IF                                                    
T25819        MOVE WS-B                     TO CC-CODE-CCC-TYPE         
                                                                        
T18441        MOVE AC-PYMT-PRIORITY-LVL    TO WS-CURR-PYMT-PRIORITY-LVL 
T18441        PERFORM 6675-FIND-RCNCT-TYPE-NO THRU 6675-EXIT            
T18441        MOVE WS-CURR-PYMT-PRIORITY-LVL  TO AC-PYMT-PRIORITY-LVL   
                                                                        
              PERFORM 6677-INSERT-CON-CHG   THRU 6677-EXIT              
           END-IF.                                                      
      *3.                                                                       
           EVALUATE AC-PYMT-PRIORITY-LVL                                
               WHEN 19                                                  
                    MOVE WS-A               TO WS-CODE-NSF-CHK-CHG      
               WHEN 20                                                  
                    MOVE WS-A               TO WS-CODE-NSF-CHK-AMT      
T20838         WHEN 29                                                  
T20838              MOVE WS-A               TO WS-CODE-NSF-CHK-AMT      
               WHEN 30                                                  
                    MOVE WS-A               TO WS-CODE-LPC              
T19106         WHEN 39                                                  
T19106              MOVE WS-A               TO WS-CODE-LPC              
               WHEN 60                                                  
                    MOVE WS-A               TO WS-CODE-CONNECT-CHRG     
PCR393         WHEN 100                                                 
PCR393              MOVE WS-A               TO WS-CODE-CONTRACT         
           END-EVALUATE.                                                
                                                                        
           PERFORM 6681-FETCH-DFA-REC-CURSOR                            
                                          THRU 6681-FETCH-EXIT.         
                                                                        
       6632-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6634-SUMMARY-AR-JRNL-REV.                                     *        
      *     -- LOAD STATIC DETAIL AND SUMMARY COLUMNS FOR JOURNALLING. *        
      ******************************************************************        
       6634-SUMMARY-AR-JRNL-REV.                                        
                                                                        
           MOVE WS-ACCOUNT-NO               TO AR-ACCOUNT-NO            
                                               AU-ACCOUNT-NO.           
           MOVE WS-DFA-TIMESTAMP            TO AR-TRANS-HIST-SEQ-NO     
                                               AU-TRANS-HIST-SEQ-NO.    
           MOVE WS-TODAYS-DATE              TO WS-CURRENT-DATE          
                                               AR-DATE-TRANS            
                                               AR-DATE-CASH-REPORT.     
           MOVE WS-D                        TO AR-CODE-TRAN-TYPE.       
           MOVE WS-DFA-OUTSTANDING          TO AR-AMT-ORIG-ENTERED.     
           MOVE AT-TOTAL-AR-BALANCE         TO AR-AMT-BILLED-UNPAID.    
           MOVE PF-RESP-AREA-ID             TO AR-RESP-AREA-ID.         
           IF DA-CODE-DFA-TYPE = WS-A                                   
              MOVE WS-PROG-FINAL-BILL-DFA   TO AR-APPL-PROGRAM-ID       
           ELSE                                                         
              MOVE WS-PROG-FINAL-BILL-DPP   TO AR-APPL-PROGRAM-ID       
           END-IF.                                                      
           MOVE SPACES                      TO AR-PYMT-FACILITY-CD      
                                               AR-RECORD-ONLY-FL        
                                               AR-DATE-ORIG-PYMT        
                                               AR-PYMT-REFUNDED-IND.    
           MOVE -1                          TO WS-DATE-ORIG-PYMT-IND.   
           MOVE WS-USER-ID                  TO AR-USER-ID.              
           MOVE AT-COMPANY-NO               TO AR-COMPANY-NO.           
           MOVE SPACES                      TO AR-TRAN-COMMENT-TEXT.    
           MOVE 0                           TO AR-TRAN-COMMENT-LEN.     
           MOVE 0                           TO WS-TRAN-APPL-NO.         
                                                                        
       6634-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6635-WRITE-JRNL-REV.                                          *        
      *     1. DETERINE RECEIVABLE TYPE.                               *        
      *     2. COMPLETE CREATING JOURNALLING.                          *        
      *     3. WRITE JOURNAL.                                          *        
      ******************************************************************        
       6635-WRITE-JRNL-REV.                                             
      *1.                                                                       
           EVALUATE AC-PYMT-PRIORITY-LVL                                
               WHEN 19                                                  
                    MOVE WS-AR-NSC-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
               WHEN 20                                                  
                    MOVE WS-AR-NSA-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
T20838         WHEN 29                                                  
T20838              MOVE WS-AR-NSN-GL-NO (WS-GL-SUB)                    
T20838                                      TO WS-101-ACCT-GEN-LED-DR   
T20838                                         AU-GL-ACCT-DEBIT         
               WHEN 30                                                  
                    MOVE WS-AR-LPC-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
T19106         WHEN 39                                                  
T19106              MOVE WS-AR-LPN-GL-NO (WS-GL-SUB)                    
T19106                                      TO WS-101-ACCT-GEN-LED-DR   
T19106                                         AU-GL-ACCT-DEBIT         
               WHEN 40                                                  
                    MOVE WS-AR-UTE-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
               WHEN 45                                                  
                    MOVE WS-AR-UTG-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
               WHEN 60                                                  
                    MOVE WS-AR-CCC-GL-NO (WS-GL-SUB)                    
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
               WHEN 100                                                 
                    MOVE WS-AR-CNT-GL-NO(WS-GL-SUB)                     
                                            TO WS-101-ACCT-GEN-LED-DR   
                                               AU-GL-ACCT-DEBIT         
           END-EVALUATE.                                                
      *2.                                                                       
           MOVE WS-AR-DFA-GL-NO (WS-GL-SUB) TO WS-101-ACCT-GEN-LED-CR   
                                               AU-GL-ACCT-CREDIT        
           ADD  +1                          TO WS-TRAN-APPL-NO.         
           MOVE WS-TRAN-APPL-NO             TO AU-TRAN-APPL-NO .        
A37666     MOVE WS-AC-ITEM-ID               TO AU-ITEM-ID.              
           MOVE SPACES                      TO AU-CURRENCY-TYPE.        
           MOVE 0                           TO AU-CURRENCY-AMT.         
           IF AC-PYMT-PRIORITY-LVL = 100                                
              MOVE CT-CODE-CONTRACT-TYPE    TO AU-CODE-CONTRACT-TYPE    
           ELSE                                                         
              MOVE SPACES                   TO AU-CODE-CONTRACT-TYPE    
           END-IF.                                                      
                                                                        
           IF WS-DFA-TOTAL-ERNST-AMT > 0                                
              MOVE 0                        TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
                                                                        
              PERFORM 6636-AGING-JRNL       THRU 6636-EXIT              
                                                                        
              MOVE 'P'                      TO WS-101-AR-AGE            
                                               AU-CODE-AR-AGE           
           ELSE                                                         
              ADD AU-AMT-POSTED             TO AR-AMT-BILLED-UNPAID     
           END-IF.                                                      
                                                                        
           ADD AU-AMT-POSTED                TO WS-AU-AMT-TOTAL.         
           MOVE AR-AMT-BILLED-UNPAID        TO WS-101-ACCT-END-AR-BAL.  
                                                                        
      *3.                                                                       
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           PERFORM 5030-LOAD-COMMON-100  THRU 5030-EXIT.                
           MOVE +1                       TO WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-DATE-LAST-ACTION      TO WS-100-DATE-LAST-ACTION.    
                                                                        
      *    LOAD COMMON 101-FORMAT VARIABLES.                                    
           PERFORM 5050-LOAD-COMMON-101     THRU 5050-EXIT.             
           MOVE CJF00101                    TO WS-100-USER-DEFINED-AREA.
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
                                                                        
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
           PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST THRU 6500-EXIT.        
                                                                        
       6635-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6636-AGING-JRNL                                               *        
      *     -- THIS MODULE ALOCATES THE JOURANLLING AMOUNT TO THE      *        
      *        BILLED RECIEVABLE. (EARNEST AMOUNTS AND DPP/DFA)        *        
      ******************************************************************        
       6636-AGING-JRNL.                                                 
                                                                        
           IF WS-JRNL-1ST-ERNST-PAY-AMT > 0                             
              IF AU-AMT-POSTED > WS-JRNL-1ST-ERNST-PAY-AMT              
                 MOVE AU-AMT-POSTED         TO WS-AU-AMT-HOLD           
                 MOVE WS-JRNL-1ST-ERNST-PAY-AMT                         
                                            TO AU-AMT-POSTED            
                 MOVE 0                     TO WS-JRNL-1ST-ERNST-PAY-AMT
                 SUBTRACT AU-AMT-POSTED   FROM WS-DFA-TOTAL-ERNST-AMT   
                 MOVE WS-DFA-DATE-1-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-1-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-1-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AU-ITEM-ID               
                 ADD AU-AMT-POSTED          TO WS-AU-AMT-TOTAL          
                                                                        
                 PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT  
                 PERFORM 6637-JRNL-DFA                  THRU 6637-EXIT  
                                                                        
                 ADD +1                     TO WS-TRAN-APPL-NO          
                 MOVE WS-TRAN-APPL-NO       TO AU-TRAN-APPL-NO          
                 MOVE SPACES                TO AU-CODE-CONTRACT-TYPE    
                                               AU-CURRENCY-TYPE         
                 MOVE 0                     TO AU-CURRENCY-AMT          
                 SUBTRACT AU-AMT-POSTED   FROM WS-AU-AMT-HOLD           
                 MOVE WS-AU-AMT-HOLD        TO AU-AMT-POSTED            
                 MOVE 0                     TO AU-ITEM-ID               
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED   FROM WS-JRNL-1ST-ERNST-PAY-AMT
                 SUBTRACT AU-AMT-POSTED   FROM WS-DFA-TOTAL-ERNST-AMT   
                 MOVE WS-DFA-DATE-1-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-1-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-1-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AU-ITEM-ID               
                 GO TO 6636-EXIT                                        
              END-IF                                                    
           END-IF.                                                      
           IF WS-JRNL-1ST-ERNST-PAY-AMT = 0 AND                         
              WS-JRNL-2ND-ERNST-PAY-AMT > 0                             
              IF AU-AMT-POSTED > WS-JRNL-2ND-ERNST-PAY-AMT              
                 MOVE AU-AMT-POSTED         TO WS-AU-AMT-HOLD           
                 MOVE WS-JRNL-2ND-ERNST-PAY-AMT                         
                                            TO AU-AMT-POSTED            
                 MOVE 0                     TO WS-JRNL-2ND-ERNST-PAY-AMT
                 SUBTRACT AU-AMT-POSTED   FROM WS-DFA-TOTAL-ERNST-AMT   
                 MOVE WS-DFA-DATE-2-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-2-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-2-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AU-ITEM-ID               
                 ADD AU-AMT-POSTED          TO WS-AU-AMT-TOTAL          
                                                                        
                 PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT  
                 PERFORM 6637-JRNL-DFA                  THRU 6637-EXIT  
                                                                        
                 ADD +1                     TO WS-TRAN-APPL-NO          
                 MOVE WS-TRAN-APPL-NO       TO AU-TRAN-APPL-NO          
                 MOVE SPACES                TO AU-CODE-CONTRACT-TYPE    
                                               AU-CURRENCY-TYPE         
                 MOVE 0                     TO AU-CURRENCY-AMT          
                 SUBTRACT AU-AMT-POSTED   FROM WS-AU-AMT-HOLD           
                 MOVE WS-AU-AMT-HOLD        TO AU-AMT-POSTED            
                 MOVE 0                     TO AU-ITEM-ID               
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED   FROM WS-JRNL-2ND-ERNST-PAY-AMT
                 SUBTRACT AU-AMT-POSTED   FROM WS-DFA-TOTAL-ERNST-AMT   
                 MOVE WS-DFA-DATE-2-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-2-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-2-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AU-ITEM-ID               
                 GO TO 6636-EXIT                                        
              END-IF                                                    
           END-IF.                                                      
           IF WS-JRNL-1ST-ERNST-PAY-AMT = 0 AND                         
              WS-JRNL-2ND-ERNST-PAY-AMT = 0 AND                         
              WS-DFA-TOTAL-ERNST-AMT > 0                                
              IF AU-AMT-POSTED > WS-DFA-TOTAL-ERNST-AMT                 
                 MOVE AU-AMT-POSTED         TO WS-AU-AMT-HOLD           
                 MOVE WS-DFA-TOTAL-ERNST-AMT                            
                                            TO AU-AMT-POSTED            
                 MOVE 0                     TO WS-DFA-TOTAL-ERNST-AMT   
                 ADD AU-AMT-POSTED          TO WS-AU-AMT-TOTAL          
                                                                        
                 PERFORM 6500-ONLINE-LOAD-AR-TRAN-HIST  THRU 6500-EXIT  
                 PERFORM 6637-JRNL-DFA                  THRU 6637-EXIT  
                                                                        
                 ADD +1                     TO WS-TRAN-APPL-NO          
                 MOVE WS-TRAN-APPL-NO       TO AU-TRAN-APPL-NO          
                 MOVE SPACES                TO AU-CODE-CONTRACT-TYPE    
                                               AU-CURRENCY-TYPE         
                 MOVE 0                     TO AU-CURRENCY-AMT          
                                               AU-ITEM-ID               
                 SUBTRACT AU-AMT-POSTED   FROM WS-AU-AMT-HOLD           
                 MOVE WS-AU-AMT-HOLD        TO AU-AMT-POSTED            
              ELSE                                                      
                 SUBTRACT AU-AMT-POSTED   FROM WS-DFA-TOTAL-ERNST-AMT   
                 GO TO 6636-EXIT                                        
              END-IF                                                    
           END-IF.                                                      
      * THE FOLLOWING IF STATEMENT ADDS UNBILLED AMT TO AR-AMT-UNBILLED         
           IF WS-DFA-TOTAL-ERNST-AMT = 0                                
              ADD AU-AMT-POSTED             TO AR-AMT-BILLED-UNPAID     
           END-IF.                                                      
                                                                        
       6636-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 6637-JRNL-DFA.                                                 *        
      ******************************************************************        
       6637-JRNL-DFA.                                                   
                                                                        
           MOVE AR-AMT-BILLED-UNPAID        TO WS-101-ACCT-END-AR-BAL.  
                                                                        
      *    LOAD COMMON 100-FORMAT VARIABLES.                                    
           PERFORM 5030-LOAD-COMMON-100  THRU 5030-EXIT.                
           MOVE +1                       TO WS-100-JRNL-TRAN-APPL-NO.   
           MOVE AT-DATE-LAST-ACTION      TO WS-100-DATE-LAST-ACTION.    
                                                                        
      *    LOAD COMMON 101-FORMAT VARIABLES.                                    
           PERFORM 5050-LOAD-COMMON-101     THRU 5050-EXIT.             
           MOVE CJF00101                    TO WS-100-USER-DEFINED-AREA.
                                                                        
      *    PROCESS CASH DRAWER JOURNAL.                                         
           MOVE WS-JRNL-ONLY                 TO WS-JRNL-OPERATION-RQST. 
                                                                        
           PERFORM 6400-ONLINE-JRNL-ROUTINE  THRU 6400-EXIT.            
           IF WS-JRNL-RTRN-CODE EQUAL SPACES                            
              MOVE 'Y'                       TO WS-JRNL-WRITTEN         
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE 'USERABEN'                TO ABEND-FUNCTION          
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       6637-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      *  6638-REVERSE.                                                 *        
      *     1. IF DPP, DELETE DFA-RECV SUMMARY ROW. THIS WILL STOP     *        
      *        LATE PAYMENTS ON DPP FROM CALCULATING.                  *        
      *     2. RETRIEVE DFA/DPP AR-CNTL DETAIL ROW.                    *        
      *     3. RETRIEVE DFA/DPP AR_CNTL SUMMARY ROW.                   *        
      *     4. IF DETAIL AND SUMMARY ARE EQUAL THEN DELETE BOTH ELSE   *        
      *        THERE ARE MORE DFA ON AR_CNTL AND UPDATE SUMMARY ROW.   *        
      *     5. DETERMINE IF THERE ARE ERNST RECORDS AND DELETE.        *        
      *     6. UPDATE ACCOUNT.                                         *        
P00471*     7. IF DPP, DELETE DPP DROP ATTRIBUTES FROM CSS_ATTRIBUTES  *        
P00471*        AND SPCL_BILL_MSG ID = '91030'                          *        
      ******************************************************************        
       6638-REVERSE.                                                    
      *1.                                                                       
           IF DA-CODE-DFA-TYPE = WS-B                                   
              MOVE WS-DFA-ITEM-ID           TO DV-AGREEMENT-NO          
              MOVE WS-ACCOUNT-NO            TO DV-ACCOUNT-NO            
              MOVE +90                      TO DV-DFA-PYMT-PRIORITY     
                                               DV-PYMT-PRIORITY-LVL     
              PERFORM 6694-DELETE-DV      THRU 6694-EXIT                
           END-IF.                                                      
      *2.                                                                       
           MOVE AT-ACCOUNT-NO               TO AC-ACCOUNT-NO.           
           MOVE +90                         TO AC-PYMT-PRIORITY-LVL.    
           MOVE WS-DFA-ITEM-ID              TO AC-ITEM-ID.              
           PERFORM 6682-SELECT-AR-CNTL-NO-TS                            
                                          THRU 6682-SELECT-NO-TS-EXIT.  
           COMPUTE WS-AR-DET-TOTAL =           AC-AMT-AR-DAY-00 +       
                                               AC-AMT-AR-DAY-30 +       
                                               AC-AMT-AR-DAY-60 +       
                                               AC-AMT-AR-DAY-90.        
                                                                        
           MOVE DCLCSS-AR-CNTL              TO WS-SAVE-AC-CNTL.         
      *3                                                                        
           MOVE AT-ACCOUNT-NO               TO AC-ACCOUNT-NO.           
           MOVE +90                         TO AC-PYMT-PRIORITY-LVL.    
           MOVE ZEROES                      TO AC-ITEM-ID.              
           PERFORM 6682-SELECT-AR-CNTL-NO-TS                            
                                          THRU 6682-SELECT-NO-TS-EXIT.  
           COMPUTE WS-AR-SUMM-TOTAL =          AC-AMT-AR-DAY-00 +       
                                               AC-AMT-AR-DAY-30 +       
                                               AC-AMT-AR-DAY-60 +       
                                               AC-AMT-AR-DAY-90.        
      *4.                                                                       
           IF WS-AR-SUMM-TOTAL = WS-AR-DET-TOTAL                        
              MOVE ZEROES                   TO AC-ITEM-ID               
              PERFORM 6684-DELETE-AR-CNTL THRU 6684-EXIT                
              MOVE WS-DFA-ITEM-ID           TO AC-ITEM-ID               
              PERFORM 6684-DELETE-AR-CNTL THRU 6684-EXIT                
           ELSE                                                         
              SUBTRACT WS-SAVE-AMT-AR-DAY-00                            
                                          FROM AC-AMT-AR-DAY-00         
              SUBTRACT WS-SAVE-AMT-AR-DAY-30                            
                                          FROM AC-AMT-AR-DAY-30         
              SUBTRACT WS-SAVE-AMT-AR-DAY-60                            
                                          FROM AC-AMT-AR-DAY-60         
              SUBTRACT WS-SAVE-AMT-AR-DAY-90                            
                                          FROM AC-AMT-AR-DAY-90         
              MOVE 0                        TO AC-ITEM-ID               
              PERFORM 6693-UPDATE-AR-CNTL THRU 6693-EXIT                
              MOVE WS-DFA-ITEM-ID           TO AC-ITEM-ID               
              PERFORM 6684-DELETE-AR-CNTL THRU 6684-EXIT                
           END-IF.                                                      
      *5.                                                                       
           IF WS-DFA-1ST-ERNST-PAY-DT > SPACES                          
              MOVE WS-DFA-1ST-ERNST-PAY-DT  TO WS-ERNST-DATE            
              MOVE WS-DFA-DATE-1-MM         TO WS-DATE-6-MM             
              MOVE WS-DFA-DATE-1-DD         TO WS-DATE-6-DD             
              MOVE WS-DFA-DATE-1-YY         TO WS-DATE-6-YY             
              MOVE WS-DATE-6-NUM            TO AC-ITEM-ID               
              MOVE WS-ACCOUNT-NO            TO AC-ACCOUNT-NO            
              MOVE +90                      TO AC-PYMT-PRIORITY-LVL     
              PERFORM 6684-DELETE-AR-CNTL THRU 6684-EXIT                
              IF WS-DFA-2ND-ERNST-PAY-DT > SPACES                       
                 MOVE WS-DFA-2ND-ERNST-PAY-DT                           
                                            TO WS-ERNST-DATE            
                 MOVE WS-DFA-DATE-2-MM      TO WS-DATE-6-MM             
                 MOVE WS-DFA-DATE-2-DD      TO WS-DATE-6-DD             
                 MOVE WS-DFA-DATE-2-YY      TO WS-DATE-6-YY             
                 MOVE WS-DATE-6-NUM         TO AC-ITEM-ID               
                 MOVE WS-ACCOUNT-NO         TO AC-ACCOUNT-NO            
                 MOVE +90                   TO AC-PYMT-PRIORITY-LVL     
                 PERFORM 6684-DELETE-AR-CNTL                            
                                          THRU 6684-EXIT                
           END-IF
           END-IF.                                                      
      *6.                                                                       
      *    PERFORM 6688-COUNT-AR-CNTL     THRU 6688-EXIT.                       
           PERFORM 6689-COUNT-DFA         THRU 6689-EXIT.               
           IF WS-DFA-ROW-COUNT = 0                                      
              MOVE SPACES                 TO WS-CODE-DFA-ACCT           
           END-IF                                                       
           PERFORM 6690-COUNT-DPP         THRU 6690-EXIT.               
           IF WS-DPP-ROW-COUNT = 0                                      
P0471A*       MOVE WS-A                  TO AT-CREDIT-GROUP                     
              MOVE SPACES                TO WS-CODE-DPP-ACCT            
           END-IF                                                       
           IF WS-DFA-ROW-COUNT = 0 AND WS-DPP-ROW-COUNT = 0             
              MOVE +90                      TO AC-PYMT-PRIORITY-LVL     
              MOVE 0                        TO AC-ITEM-ID               
              PERFORM 6684-DELETE-AR-CNTL THRU 6684-EXIT                
           END-IF.                                                      
P00471*7.                                                                       
P00471     IF DA-CODE-DFA-TYPE = WS-B                                   
P00471        PERFORM 8930-DELETE-DPPDROP-EXEMPT  THRU  8930-EXIT       
P00471        PERFORM 8935-DELETE-AUTO-DPPDROP    THRU  8935-EXIT       
P00471        MOVE AT-ACCOUNT-NO                  TO    U1-ACCOUNT-NO   
P00471        PERFORM 8940-DELETE-SPCL-BILL-MSG   THRU  8940-EXIT       
P00471     END-IF.                                                      
                                                                        
       6638-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
PCR393* 6650-OPEN-CNT-CURSOR.                                                   
      *****************************************************************         
PCR393 6650-OPEN-CNT-CURSOR.                                            
                                                                        
PCR393     EXEC SQL                                                     
PCR393        OPEN CNT-NAME-CURSOR                                      
PCR393     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR393                                                                  
PCR393     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
PCR393                                                                  
PCR393     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
PCR393        NEXT SENTENCE                                             
PCR393     ELSE                                                         
PCR393        MOVE '6650'                    TO ACTIVE-PARAGRAPH        
CBSI          MOVE 'CSS_DFA_RECVBLE'         TO CMN-TABLE-1             
CBSI          MOVE 'CSS_CONTRACT'            TO CMN-TABLE-2             
CBSI          MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE DV-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE DV-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
PCR393        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
PCR393     END-IF.                                                      
PCR393                                                                  
PCR393 6650-EXIT.                                                       
PCR393     EXIT.                                                        
                                                                        
      *****************************************************************         
PCR393* 6660-FETCH-CNT-CURSOR.                                                  
      *****************************************************************         
PCR393 6660-FETCH-CNT-CURSOR.                                           
                                                                        
PCR393     EXEC SQL                                                     
PCR393        FETCH CNT-NAME-CURSOR                                     
PCR393         INTO :DV-CNT-ITEM-ID,                                    
PCR393              :CT-CNT-NAME-CD,                                    
PCR393              :CT-CODE-CONTRACT-TYPE                              
PCR393     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR393                                                                  
PCR393     MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE.      
PCR393                                                                  
PCR393     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
PCR393        MOVE DV-CNT-ITEM-ID        TO TB-CNT-ITEM-ID(SUB-RECV)    
PCR393        MOVE CT-CNT-NAME-CD        TO TB-CNT-NAME-CD(SUB-RECV)    
PCR393        MOVE CT-CODE-CONTRACT-TYPE TO TB-CODE-CNT-TYPE(SUB-RECV)  
PCR393     ELSE IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                    
PCR393        NEXT SENTENCE                                             
PCR393     ELSE                                                         
PCR393        MOVE '6660'                    TO ACTIVE-PARAGRAPH        
CBSI          MOVE 'CSS_DFA_RECVBLE'         TO CMN-TABLE-1             
CBSI          MOVE 'CSS_CONTRACT'            TO CMN-TABLE-2             
CBSI          MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE DV-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE DV-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
PCR393        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
PCR393     END-IF
           END-IF.                                                      
PCR393                                                                  
PCR393 6660-EXIT.                                                       
PCR393     EXIT.                                                        
PCR393                                                                  
      *****************************************************************         
PCR393* 6670-CLOSE-CNT-CURSOR.                                                  
      *****************************************************************         
PCR393 6670-CLOSE-CNT-CURSOR.                                           
                                                                        
PCR393     EXEC SQL                                                     
PCR393        CLOSE CNT-NAME-CURSOR                                     
PCR393     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR393                                                                  
PCR393     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
PCR393                                                                  
PCR393     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
PCR393        NEXT SENTENCE                                             
PCR393     ELSE                                                         
PCR393        MOVE '6670'                    TO ACTIVE-PARAGRAPH        
CBSI          MOVE 'CSS_DFA_RECVBLE'         TO CMN-TABLE-1             
CBSI          MOVE 'CSS_CONTRACT'            TO CMN-TABLE-2             
CBSI          MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE DV-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE DV-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
PCR393        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
PCR393     END-IF.                                                      
                                                                        
PCR393 6670-EXIT.                                                       
PCR393     EXIT.                                                        
                                                                        
      *    SUPPORTS DEPOSIT INT COMP (5995-DEPOSIT-INTEREST-CALC).              
           EXEC SQL                                                             
              INCLUDE CPD00023                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS UPDATING INT HIST (6050-PROCESS-INTEREST-HIST).             
           EXEC SQL                                                             
              INCLUDE CPD00128                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS REBATE CALCULATIONS (6100-COMPUTE-REBATE-AMOUNT).           
           EXEC SQL                                                             
              INCLUDE CPD00003                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS CHECK DIGITS (6210-CALCULATE-CHECK-DIGIT).                  
           EXEC SQL                                                             
              INCLUDE CPD00071                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS ONLINE JOURNALING (6400-ONLINE-JRNL-ROUTINE).               
REARCH     EXEC SQL                                                             
REARCH        INCLUDE CPD0006A                                                  
REARCH     END-EXEC.                                                            
                                                                        
      *    SUPPORTS AR TRANS HIST (6500-ONLINE-LOAD-AR-TRAN-HIST).              
           EXEC SQL                                                             
              INCLUDE CPD00008                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS MAINT HIST (6530-LOAD-MNT-TRANS-HIST).                      
           EXEC SQL                                                             
              INCLUDE CPD00067                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS APPLY PAYMENT (6700-APPLY-PAYMENT).                         
           EXEC SQL                                                             
              INCLUDE CPD00010                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS APPLY PAYMENT (6700-APPLY-PAYMENT).                         
           EXEC SQL                                                             
              INCLUDE CPD0010S                                                  
           END-EXEC.                                                            
                                                                        
      *    SUPPORTS APPLY PAYMENT (6800-APPLY-PYMT-CO).                         
           EXEC SQL                                                             
              INCLUDE CPD00073                                                  
           END-EXEC.                                                            
                                                                        
      *    GETS NEW ADDRESS ID.                                                 
 T4158     EXEC SQL                                                             
 T4158        INCLUDE CPD00090                                                  
 T4158     END-EXEC.                                                            
                                                                        
      *****************************************************************         
      * 6672-SELECT-ACCOUNT.                                                    
      *****************************************************************         
       6672-SELECT-ACCOUNT.                                             
                                                                        
           EXEC SQL                                                     
              SELECT AT.CUSTOMER_NO,                                    
                     AT.CODE_ACCT_STAT,                                 
                     AT.NOTICE_EXEMPT_CD,                               
                     AT.CODE_DISC_OK,                                   
                     AT.DATE_BILL_DAY_00,                               
                     AT.DATE_BILL_DAY_30,                               
                     AT.DATE_BILL_DAY_60,                               
                     AT.DATE_BILL_DAY_90,                               
                     AT.TOTAL_AR_BALANCE,                               
                     AT.DATE_LAST_ACTION,                               
                     AT.LOCAL_OFFICE,                                   
                     AT.PREMISE_NO,                                     
                     AT.CODES_DATA_PRESENT,                             
                     AT.COMPANY_NO,                                     
                     AT.AR_XFER_IND,                                    
                     AT.ACCT_XFER_TO,                                   
                     AT.BANKRUPTCY_IND,                                 
                     AT.CREDIT_GROUP,                                   
                     PR.CODE_PREMISE_STAT,                              
                     PR.REV_DISTRICT_CD,                                
                     CU.CODE_EMPL_ACCT,                                 
                     CU.CODE_CUST_STATUS                                
             INTO    :AT-CUSTOMER-NO,                                   
                     :AT-CODE-ACCT-STAT,                                
                     :AT-NOTICE-EXEMPT-CD,                              
                     :AT-CODE-DISC-OK,                                  
                     :AT-DATE-BILL-DAY-00 :WS-NULL-INDICATOR-1,         
                     :AT-DATE-BILL-DAY-30 :WS-NULL-INDICATOR-2,         
                     :AT-DATE-BILL-DAY-60 :WS-NULL-INDICATOR-3,         
                     :AT-DATE-BILL-DAY-90 :WS-NULL-INDICATOR-4,         
                     :AT-TOTAL-AR-BALANCE,                              
                     :AT-DATE-LAST-ACTION,                              
                     :AT-LOCAL-OFFICE,                                  
                     :AT-PREMISE-NO,                                    
                     :AT-CODES-DATA-PRESENT,                            
                     :AT-COMPANY-NO,                                    
                     :AT-AR-XFER-IND,                                   
                     :AT-ACCT-XFER-TO,                                  
                     :AT-BANKRUPTCY-IND,                                
                     :AT-CREDIT-GROUP,                                  
                     :PR-CODE-PREMISE-STAT,                             
                     :PR-REV-DISTRICT-CD,                               
                     :CU-CODE-EMPL-ACCT,                                
                     :CU-CODE-CUST-STATUS                               
            FROM CSS_ACCOUNT AT, CSS_PREMISE PR, CSS_CUSTOMER CU        
            WHERE AT.ACCOUNT_NO     = :AT-ACCOUNT-NO                    
              AND AT.PREMISE_NO     = PR.PREMISE_NO                     
              AND AT.CUSTOMER_NO    = CU.CUSTOMER_NO                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT AT.CUSTOMER_NO,                                            
MFA-TR*              AT.CODE_ACCT_STAT,                                         
MFA-TR*              AT.NOTICE_EXEMPT_CD,                                       
MFA-TR*              AT.CODE_DISC_OK,                                           
MFA-TR*              AT.DATE_BILL_DAY_00,                                       
MFA-TR*              AT.DATE_BILL_DAY_30,                                       
MFA-TR*              AT.DATE_BILL_DAY_60,                                       
MFA-TR*              AT.DATE_BILL_DAY_90,                                       
MFA-TR*              AT.TOTAL_AR_BALANCE,                                       
MFA-TR*              AT.DATE_LAST_ACTION,                                       
MFA-TR*              AT.LOCAL_OFFICE,                                           
MFA-TR*              AT.PREMISE_NO,                                             
MFA-TR*              AT.CODES_DATA_PRESENT,                                     
MFA-TR*              AT.COMPANY_NO,                                             
MFA-TR*              AT.AR_XFER_IND,                                            
MFA-TR*              AT.ACCT_XFER_TO,                                           
MFA-TR*              AT.BANKRUPTCY_IND,                                         
MFA-TR*              AT.CREDIT_GROUP,                                           
MFA-TR*              PR.CODE_PREMISE_STAT,                                      
MFA-TR*              PR.REV_DISTRICT_CD,                                        
MFA-TR*              CU.CODE_EMPL_ACCT,                                         
MFA-TR*              CU.CODE_CUST_STATUS                                        
MFA-TR*      INTO    :AT-CUSTOMER-NO,                                           
MFA-TR*              :AT-CODE-ACCT-STAT,                                        
MFA-TR*              :AT-NOTICE-EXEMPT-CD,                                      
MFA-TR*              :AT-CODE-DISC-OK,                                          
MFA-TR*              :AT-DATE-BILL-DAY-00 :WS-NULL-INDICATOR-1,                 
MFA-TR*              :AT-DATE-BILL-DAY-30 :WS-NULL-INDICATOR-2,                 
MFA-TR*              :AT-DATE-BILL-DAY-60 :WS-NULL-INDICATOR-3,                 
MFA-TR*              :AT-DATE-BILL-DAY-90 :WS-NULL-INDICATOR-4,                 
MFA-TR*              :AT-TOTAL-AR-BALANCE,                                      
MFA-TR*              :AT-DATE-LAST-ACTION,                                      
MFA-TR*              :AT-LOCAL-OFFICE,                                          
MFA-TR*              :AT-PREMISE-NO,                                            
MFA-TR*              :AT-CODES-DATA-PRESENT,                                    
MFA-TR*              :AT-COMPANY-NO,                                            
MFA-TR*              :AT-AR-XFER-IND,                                           
MFA-TR*              :AT-ACCT-XFER-TO,                                          
MFA-TR*              :AT-BANKRUPTCY-IND,                                        
MFA-TR*              :AT-CREDIT-GROUP,                                          
MFA-TR*              :PR-CODE-PREMISE-STAT,                                     
MFA-TR*              :PR-REV-DISTRICT-CD,                                       
MFA-TR*              :CU-CODE-EMPL-ACCT,                                        
MFA-TR*              :CU-CODE-CUST-STATUS                                       
MFA-TR*     FROM CSS_ACCOUNT AT, CSS_PREMISE PR, CSS_CUSTOMER CU                
MFA-TR*     WHERE AT.ACCOUNT_NO     = :AT-ACCOUNT-NO                            
MFA-TR*       AND AT.PREMISE_NO     = PR.PREMISE_NO                             
MFA-TR*       AND AT.CUSTOMER_NO    = CU.CUSTOMER_NO                            
MFA-TR*      QUERYNO 6672                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6672'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_ACCOUNT'             TO CMN-TABLE-1             
CBSI          MOVE 'CSS_CUSTOMER'            TO CMN-TABLE-2             
CBSI          MOVE 'CSS_PREMISE'             TO CMN-TABLE-3             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
              MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
                                                                        
       6672-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
T18127* 6675-FIND-RCNCT-TYPE-NO.                                                
      *****************************************************************         
T18127 6675-FIND-RCNCT-TYPE-NO.                                         
                                                                        
            MOVE 40                 TO AC-PYMT-PRIORITY-LVL             
            PERFORM 6675A-SELECT-AR-CNTL THRU 6675A-EXIT                
            MOVE 45                 TO AC-PYMT-PRIORITY-LVL             
            PERFORM 6675A-SELECT-AR-CNTL THRU 6675A-EXIT                
            MOVE 001                TO CC-RCNCT-TYPE-NO                 
            IF WS-UTE-EXISTS = 'Y'                                      
               IF WS-UTG-EXISTS = 'Y'                                   
                  MOVE 001           TO CC-RCNCT-TYPE-NO                
               ELSE                                                     
                  MOVE 004           TO CC-RCNCT-TYPE-NO                
               END-IF                                                   
            ELSE                                                        
               IF WS-UTG-EXISTS = 'Y'                                   
                  MOVE 005       TO CC-RCNCT-TYPE-NO                    
               END-IF                                                   
            END-IF.                                                     
T18441 6675-EXIT.                                                       
            EXIT.                                                       
                                                                        
      *****************************************************************         
T18441* 6675A-SELECT-AR-CNTL.                                                   
      *****************************************************************         
T18441 6675A-SELECT-AR-CNTL.                                            
                                                                        
           EXEC SQL                                                     
                  SELECT 'Y'                                            
                  INTO   :WS-UTE-OR-UTG-EXISTS                          
                  FROM   CSS_AR_CNTL                                    
                  WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO             
                    AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL      
                    AND  ITEM_ID           = 0                          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*           SELECT 'Y'                                                    
MFA-TR*           INTO   :WS-UTE-OR-UTG-EXISTS                                  
MFA-TR*           FROM   CSS_AR_CNTL                                            
MFA-TR*           WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                     
MFA-TR*             AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL              
MFA-TR*             AND  ITEM_ID           = 0                                  
MFA-TR*      QUERYNO 6675                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

      *                                                                         
           MOVE SQLCODE  TO WS-ACTIVE-RETURN-CODE.                      
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              IF AC-PYMT-PRIORITY-LVL = 40                              
                 MOVE 'Y'   TO WS-UTE-EXISTS                            
              ELSE                                                      
                 MOVE 'Y'   TO WS-UTG-EXISTS                            
              END-IF                                                    
           ELSE                                                         
              IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                      
                 NEXT SENTENCE                                          
              ELSE                                                      
                  MOVE SQLCODE                  TO   RS-RETURN-CODE     
                  MOVE PROGRAM-NAME             TO   ABEND-PROGRAM      
CBSI              MOVE '6675'                   TO   ABEND-FUNCTION     
CBSI              MOVE 'CSS_AR_CNTL      '      TO CMN-TABLE-1          
CBSI              MOVE 'ACCOUNT_NO    '         TO CMN-TABLE-ELEMENT-1  
CBSI              MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2  
CBSI              MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-3  
CBSI              MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1
CBSI              MOVE AC-PYMT-PRIORITY-LVL     TO CMN-HOSTVAR-ELEMENT-2
CBSI              MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-3
                  PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT         
                  PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT         
               END-IF                                                   
            END-IF.                                                     
T18441 6675A-EXIT.                                                      
            EXIT.                                                       
                                                                        
      *****************************************************************         
      * 6676-SELECT-DFA-ACCT.                                                   
      *****************************************************************         
       6676-SELECT-DFA-ACCT.                                            
                                                                        
           EXEC SQL                                                     
              SELECT DATE_OF_AGREE,                                     
                     CODE_DFA_TYPE,                                     
                     AMT_MO_PYMT,                                       
                     DATE_PYMT_START,                                   
                     NO_SCHED_PYMTS,                                    
                     AMT_ORIG_ENTERED,                                  
                     CSR_USERID,                                        
                     CODE_DFA_STATUS,                                   
                     RCNTLY_BLLD_MTH,                                   
                     AMT_UNDEFERD_RECV,                                 
                     CODE_DFA_DESC,                                     
                     AMT_EXTRA_DEPOSIT,                                 
                     REVERSE_REASON,                                    
                     CODE_COMPLY_HIST,                                  
                     CIS.CHAR2$DATE(FRST_ERNST_PAY_DT,'USA'),                   
                     FRST_ERNST_PAY_AMT,                                
                     CIS.CHAR2$DATE(SCND_ERNST_PAY_DT,'USA'),                   
                     SCND_ERNST_PAY_AMT,                                
                     PYMNT_ARNGMNT_CMTS,                                
                     REPLACE(REPLACE(CONVERT(CHAR(26), LAST_UPDATE_TS
           , 121), ' ', '-'), ':', '.') LAST_UPDATE_TS                         
                INTO :DA-DATE-OF-AGREE,                                 
                     :DA-CODE-DFA-TYPE,                                 
                     :DA-AMT-MO-PYMT,                                   
                     :DA-DATE-PYMT-START,                               
                     :DA-NO-SCHED-PYMTS,                                
                     :DA-AMT-ORIG-ENTERED,                              
                     :DA-CSR-USERID,                                    
                     :DA-CODE-DFA-STATUS,                               
                     :DA-RCNTLY-BLLD-MTH,                               
                     :DA-AMT-UNDEFERD-RECV,                             
                     :DA-CODE-DFA-DESC,                                 
                     :DA-AMT-EXTRA-DEPOSIT,                             
                     :DA-REVERSE-REASON,                                
                     :DA-CODE-COMPLY-HIST,                              
                     :DA-FRST-ERNST-PAY-DT :WS-DFA-NULL-IND,             
                     :DA-FRST-ERNST-PAY-AMT,                            
                     :DA-SCND-ERNST-PAY-DT :WS-DFA-NULL-IND2,            
                     :DA-SCND-ERNST-PAY-AMT,                            
                     :DA-PYMNT-ARNGMNT-CMTS,                            
                     :DA-LAST-UPDATE-TS                                 
                FROM CSS_DFA_ACCT                                       
               WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL          
                 AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ029
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT DATE_OF_AGREE,                                             
MFA-TR*              CODE_DFA_TYPE,                                             
MFA-TR*              AMT_MO_PYMT,                                               
MFA-TR*              DATE_PYMT_START,                                           
MFA-TR*              NO_SCHED_PYMTS,                                            
MFA-TR*              AMT_ORIG_ENTERED,                                          
MFA-TR*              CSR_USERID,                                                
MFA-TR*              CODE_DFA_STATUS,                                           
MFA-TR*              RCNTLY_BLLD_MTH,                                           
MFA-TR*              AMT_UNDEFERD_RECV,                                         
MFA-TR*              CODE_DFA_DESC,                                             
MFA-TR*              AMT_EXTRA_DEPOSIT,                                         
MFA-TR*              REVERSE_REASON,                                            
MFA-TR*              CODE_COMPLY_HIST,                                          
MFA-TR*              CHAR(FRST_ERNST_PAY_DT,USA),                               
MFA-TR*              FRST_ERNST_PAY_AMT,                                        
MFA-TR*              CHAR(SCND_ERNST_PAY_DT,USA),                               
MFA-TR*              SCND_ERNST_PAY_AMT,                                        
MFA-TR*              PYMNT_ARNGMNT_CMTS,                                        
MFA-TR*              LAST_UPDATE_TS                                             
MFA-TR*         INTO :DA-DATE-OF-AGREE,                                         
MFA-TR*              :DA-CODE-DFA-TYPE,                                         
MFA-TR*              :DA-AMT-MO-PYMT,                                           
MFA-TR*              :DA-DATE-PYMT-START,                                       
MFA-TR*              :DA-NO-SCHED-PYMTS,                                        
MFA-TR*              :DA-AMT-ORIG-ENTERED,                                      
MFA-TR*              :DA-CSR-USERID,                                            
MFA-TR*              :DA-CODE-DFA-STATUS,                                       
MFA-TR*              :DA-RCNTLY-BLLD-MTH,                                       
MFA-TR*              :DA-AMT-UNDEFERD-RECV,                                     
MFA-TR*              :DA-CODE-DFA-DESC,                                         
MFA-TR*              :DA-AMT-EXTRA-DEPOSIT,                                     
MFA-TR*              :DA-REVERSE-REASON,                                        
MFA-TR*              :DA-CODE-COMPLY-HIST,                                      
MFA-TR*              :DA-FRST-ERNST-PAY-DT:WS-DFA-NULL-IND,                     
MFA-TR*              :DA-FRST-ERNST-PAY-AMT,                                    
MFA-TR*              :DA-SCND-ERNST-PAY-DT:WS-DFA-NULL-IND2,                    
MFA-TR*              :DA-SCND-ERNST-PAY-AMT,                                    
MFA-TR*              :DA-PYMNT-ARNGMNT-CMTS,                                    
MFA-TR*              :DA-LAST-UPDATE-TS                                         
MFA-TR*         FROM CSS_DFA_ACCT                                               
MFA-TR*        WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL                  
MFA-TR*          AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                        
MFA-TR*      QUERYNO 6676                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                 TO WS-ACTIVE-RETURN-CODE.       
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
              IF WS-DFA-NULL-IND EQUAL -1                               
                 MOVE SPACES TO DA-FRST-ERNST-PAY-DT                    
              END-IF                                                    
              IF WS-DFA-NULL-IND2 EQUAL -1                              
                 MOVE SPACES TO DA-SCND-ERNST-PAY-DT                    
              END-IF                                                    
           ELSE                                                         
              MOVE '6676'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_DFA_ACCT'            TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
              MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
              MOVE 'DFA_ITEM_ID'             TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-4     
              MOVE DA-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
              MOVE DA-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
              MOVE DA-DFA-ITEM-ID            TO CMN-HOSTVAR-ELEMENT-3   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-4   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
       6676-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6677-INSERT-CON-CHG.                                                    
      *****************************************************************         
       6677-INSERT-CON-CHG.                                             
                                                                        
           EXEC SQL                                                     
                INSERT INTO CSS_CONNECT_CHRG                            
                       (ACCOUNT_NO,                                     
                       AMT_ORIG_ENTERED,                                
                       AMT_TAX_CITY,                                    
                       AMT_TAX_OTHER,                                   
                       AMT_TAX_STATE,                                   
                       AMT_TAX_XCISE,                                   
                       AMT_TRANS,                                       
                       CCC_ITEM_ID,                                     
                       CODE_CCC_TYPE,                                   
                       DATE_CCC_BILLED,                                 
                       DATE_TRANS,                                      
                       PYMT_PRIORITY_LVL,                               
                       LAST_UPDATE_TS,                                  
T18441                 RCNCT_TYPE_NO)                                   
                VALUES                                                  
                       (:CC-ACCOUNT-NO,                                 
                       :CC-AMT-ORIG-ENTERED,                            
                       :CC-AMT-TAX-CITY,                                
                       :CC-AMT-TAX-OTHER,                               
                       :CC-AMT-TAX-STATE,                               
                       :CC-AMT-TAX-XCISE,                               
                       :CC-AMT-TRANS,                                   
                       :CC-CCC-ITEM-ID,                                 
                       :CC-CODE-CCC-TYPE,                               
                       IIF(TRY_CONVERT(DATE, :CC-DATE-CCC-BILLED
              ) IS NULL OR (PATINDEX('%.%', :CC-DATE-CCC-BILLED
              ) <> 0) OR (LEN(:CC-DATE-CCC-BILLED
              ) <> 10), CIS.CHAR2DATE(:CC-DATE-CCC-BILLED
              ), CONVERT(DATE, :CC-DATE-CCC-BILLED) ),                         
                       IIF(TRY_CONVERT(DATE, :CC-DATE-TRANS
              ) IS NULL OR (PATINDEX('%.%', :CC-DATE-TRANS
              ) <> 0) OR (LEN(:CC-DATE-TRANS) <> 10), CIS.CHAR2DATE(
                                                         :CC-DATE-TRANS
              ), CONVERT(DATE, :CC-DATE-TRANS) ),                              
                       :CC-PYMT-PRIORITY-LVL,                           
                       CIS.CHAR2TIMESTAMP(:CC-LAST-UPDATE-TS),                  
T18441                 :CC-RCNCT-TYPE-NO)                               
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*         INSERT INTO CSS_CONNECT_CHRG                                    
MFA-TR*                (ACCOUNT_NO,                                             
MFA-TR*                AMT_ORIG_ENTERED,                                        
MFA-TR*                AMT_TAX_CITY,                                            
MFA-TR*                AMT_TAX_OTHER,                                           
MFA-TR*                AMT_TAX_STATE,                                           
MFA-TR*                AMT_TAX_XCISE,                                           
MFA-TR*                AMT_TRANS,                                               
MFA-TR*                CCC_ITEM_ID,                                             
MFA-TR*                CODE_CCC_TYPE,                                           
MFA-TR*                DATE_CCC_BILLED,                                         
MFA-TR*                DATE_TRANS,                                              
MFA-TR*                PYMT_PRIORITY_LVL,                                       
MFA-TR*                LAST_UPDATE_TS,                                          
MFA-TR*                RCNCT_TYPE_NO)                                           
MFA-TR*         VALUES                                                          
MFA-TR*                (:CC-ACCOUNT-NO,                                         
MFA-TR*                :CC-AMT-ORIG-ENTERED,                                    
MFA-TR*                :CC-AMT-TAX-CITY,                                        
MFA-TR*                :CC-AMT-TAX-OTHER,                                       
MFA-TR*                :CC-AMT-TAX-STATE,                                       
MFA-TR*                :CC-AMT-TAX-XCISE,                                       
MFA-TR*                :CC-AMT-TRANS,                                           
MFA-TR*                :CC-CCC-ITEM-ID,                                         
MFA-TR*                :CC-CODE-CCC-TYPE,                                       
MFA-TR*                :CC-DATE-CCC-BILLED,                                     
MFA-TR*                :CC-DATE-TRANS,                                          
MFA-TR*                :CC-PYMT-PRIORITY-LVL,                                   
MFA-TR*                :CC-LAST-UPDATE-TS,                                      
MFA-TR*                :CC-RCNCT-TYPE-NO)                               32890000
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6677'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_CONNECT_CHRG'        TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
              MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
              MOVE 'CCC_ITEM_ID'             TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-4     
              MOVE CC-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
              MOVE CC-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
              MOVE CC-CCC-ITEM-ID            TO CMN-HOSTVAR-ELEMENT-3   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-4   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
                                                                        
       6677-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6681-OPEN-DFA-REC-CURSOR.                                               
      *****************************************************************         
       6681-OPEN-DFA-REC-CURSOR.                                        
                                                                        
           EXEC SQL                                                     
                OPEN DFA-REC-CURSOR                                     
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6681'                     TO ACTIVE-PARAGRAPH       
CBSI          MOVE 'CSS_DFA_RECVBLE'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'AGREEMENT_NO'             TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE DV-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE DV-AGREEMENT-NO            TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9700-PROCESS-ABEND      THRU 9700-EXIT            
           END-IF.                                                      
                                                                        
       6681-OPEN-EXIT.                                                  
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6681-FETCH-DFA-REC-CURSOR.                                              
      *****************************************************************         
       6681-FETCH-DFA-REC-CURSOR.                                       
                                                                        
           EXEC SQL                                                     
              FETCH DFA-REC-CURSOR                                      
                 INTO :DV-ACCOUNT-NO       ,                            
                      :DV-PYMT-PRIORITY-LVL,                            
                      :DV-AGREEMENT-NO     ,                            
                      :DV-AMT-CONTRACT-DEFR,                            
                      :DV-AMT-DAY-00       ,                            
                      :DV-AMT-DAY-30       ,                            
                      :DV-AMT-DAY-60       ,                            
                      :DV-AMT-DAY-90       ,                            
                      :DV-DFA-PYMT-PRIORITY,                            
                      :DV-CNT-ITEM-ID                                   
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6681'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_DFA_RECVBLE'        TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'AGREEMENT_NO'             TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE DV-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE DV-AGREEMENT-NO            TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
                                                                        
       6681-FETCH-EXIT.                                                 
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6681-CLOSE-DFA-REC-CURSOR.                                              
      *****************************************************************         
       6681-CLOSE-DFA-REC-CURSOR.                                       
                                                                        
           EXEC SQL                                                     
                CLOSE DFA-REC-CURSOR                                    
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
              MOVE '6681'                   TO ACTIVE-PARAGRAPH         
CBSI          MOVE 'CSS_DFA_RECVBLE'        TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
CBSI          MOVE 'AGREEMENT_NO'           TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE DV-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
CBSI          MOVE DV-AGREEMENT-NO          TO CMN-HOSTVAR-ELEMENT-2    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-3    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
                                                                        
       6681-CLOSE-EXIT.                                                 
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6682-SELECT-AR-CNTL-NO-TS.                                              
      *****************************************************************         
       6682-SELECT-AR-CNTL-NO-TS.                                       
                                                                        
           EXEC SQL                                                     
               SELECT AMT_AR_DAY_00,                                    
                      AMT_AR_DAY_30,                                    
                      AMT_AR_DAY_60,                                    
                      AMT_AR_DAY_90,                                    
                      AMT_UNUSED_CR,                                    
                      AMT_TRAN_BALANCE,                                 
                      TOT_SUMM_UNBILLED,                                
                      REPLACE(REPLACE(CONVERT(CHAR(26), LAST_UPDATE_TS
           , 121), ' ', '-'), ':', '.') LAST_UPDATE_TS                         
               INTO   :AC-AMT-AR-DAY-00,                                
                      :AC-AMT-AR-DAY-30,                                
                      :AC-AMT-AR-DAY-60,                                
                      :AC-AMT-AR-DAY-90,                                
                      :AC-AMT-UNUSED-CR,                                
                      :AC-AMT-TRAN-BALANCE,                             
                      :AC-TOT-SUMM-UNBILLED,                            
                      :AC-LAST-UPDATE-TS                                
               FROM CSS_AR_CNTL                                         
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                 AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT AMT_AR_DAY_00,                                            
MFA-TR*               AMT_AR_DAY_30,                                            
MFA-TR*               AMT_AR_DAY_60,                                            
MFA-TR*               AMT_AR_DAY_90,                                            
MFA-TR*               AMT_UNUSED_CR,                                            
MFA-TR*               AMT_TRAN_BALANCE,                                         
MFA-TR*               TOT_SUMM_UNBILLED,                                        
MFA-TR*               LAST_UPDATE_TS                                            
MFA-TR*        INTO   :AC-AMT-AR-DAY-00,                                        
MFA-TR*               :AC-AMT-AR-DAY-30,                                        
MFA-TR*               :AC-AMT-AR-DAY-60,                                        
MFA-TR*               :AC-AMT-AR-DAY-90,                                        
MFA-TR*               :AC-AMT-UNUSED-CR,                                        
MFA-TR*               :AC-AMT-TRAN-BALANCE,                                     
MFA-TR*               :AC-TOT-SUMM-UNBILLED,                                    
MFA-TR*               :AC-LAST-UPDATE-TS                                        
MFA-TR*        FROM CSS_AR_CNTL                                                 
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 6682                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6682'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_AR_CNTL'             TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
              MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'ITEM_ID'                 TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-4     
              MOVE AC-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
              MOVE AC-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
              MOVE AC-ITEM-ID                TO CMN-HOSTVAR-ELEMENT-3   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-4   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
                                                                        
       6682-SELECT-NO-TS-EXIT.                                          
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6683-INSERT-AR-CNTL.                                                    
      *****************************************************************         
       6683-INSERT-AR-CNTL.                                             
                                                                        
           EXEC SQL                                                     
                INSERT INTO CSS_AR_CNTL                                 
                       (ACCOUNT_NO,                                     
                       PYMT_PRIORITY_LVL,                               
                       ITEM_ID,                                         
                       AMT_AR_DAY_00,                                   
                       AMT_AR_DAY_30,                                   
                       AMT_AR_DAY_60,                                   
                       AMT_AR_DAY_90,                                   
                       AMT_UNUSED_CR,                                   
                       TOT_SUMM_UNBILLED,                               
                       AMT_TRAN_BALANCE,                                
                       LAST_UPDATE_TS)                                  
                VALUES                                                  
                      (:AC-ACCOUNT-NO,                                  
                       :AC-PYMT-PRIORITY-LVL,                           
                       :AC-ITEM-ID,                                     
                       :AC-AMT-AR-DAY-00,                               
                       :AC-AMT-AR-DAY-30,                               
                       :AC-AMT-AR-DAY-60,                               
                       :AC-AMT-AR-DAY-90,                               
                       :AC-AMT-UNUSED-CR,                               
                       :AC-TOT-SUMM-UNBILLED,                           
                       :AC-AMT-TRAN-BALANCE,                            
                       CIS.CHAR2TIMESTAMP(:AC-LAST-UPDATE-TS) )                 
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*         INSERT INTO CSS_AR_CNTL                                         
MFA-TR*                (ACCOUNT_NO,                                             
MFA-TR*                PYMT_PRIORITY_LVL,                                       
MFA-TR*                ITEM_ID,                                                 
MFA-TR*                AMT_AR_DAY_00,                                           
MFA-TR*                AMT_AR_DAY_30,                                           
MFA-TR*                AMT_AR_DAY_60,                                           
MFA-TR*                AMT_AR_DAY_90,                                           
MFA-TR*                AMT_UNUSED_CR,                                           
MFA-TR*                TOT_SUMM_UNBILLED,                                       
MFA-TR*                AMT_TRAN_BALANCE,                                        
MFA-TR*                LAST_UPDATE_TS)                                          
MFA-TR*         VALUES                                                          
MFA-TR*               (:AC-ACCOUNT-NO,                                          
MFA-TR*                :AC-PYMT-PRIORITY-LVL,                                   
MFA-TR*                :AC-ITEM-ID,                                             
MFA-TR*                :AC-AMT-AR-DAY-00,                                       
MFA-TR*                :AC-AMT-AR-DAY-30,                                       
MFA-TR*                :AC-AMT-AR-DAY-60,                                       
MFA-TR*                :AC-AMT-AR-DAY-90,                                       
MFA-TR*                :AC-AMT-UNUSED-CR,                                       
MFA-TR*                :AC-TOT-SUMM-UNBILLED,                                   
MFA-TR*                :AC-AMT-TRAN-BALANCE,                                    
MFA-TR*                :AC-LAST-UPDATE-TS )                                     
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
                                           OR ALREADY-EXISTS            
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6683'                  TO ACTIVE-PARAGRAPH          
CBSI          MOVE 'CSS_AR_CNTL'           TO CMN-TABLE-1               
              MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1       
              MOVE 'PYMT_PRIORITY_LVL'     TO CMN-TABLE-ELEMENT-2       
              MOVE 'AC_ITEM_ID'            TO CMN-TABLE-ELEMENT-3       
CBSI          MOVE 'SERV_ORDER_NO'         TO CMN-TABLE-ELEMENT-4       
              MOVE AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1     
              MOVE AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2     
              MOVE AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3     
CBSI          MOVE CMN-SERV-ORDER-NO       TO CMN-HOSTVAR-ELEMENT-4     
              PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT               
           END-IF.                                                      
                                                                        
       6683-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6684-DELETE-AR-CNTL.                                                    
      *****************************************************************         
       6684-DELETE-AR-CNTL.                                             
                                                                        
           EXEC SQL                                                     
               DELETE FROM CSS_AR_CNTL                                  
                WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                
                  AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL         
                  AND ITEM_ID           = :AC-ITEM-ID                   
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DELETE FROM CSS_AR_CNTL                                          
MFA-TR*         WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*           AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                 
MFA-TR*           AND ITEM_ID           = :AC-ITEM-ID                           
MFA-TR*      QUERYNO 6684                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6684'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_AR_CNTL'             TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
              MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'ITEM_ID'                 TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-4     
              MOVE AC-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
              MOVE AC-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
              MOVE AC-ITEM-ID                TO CMN-HOSTVAR-ELEMENT-3   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-4   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
       6684-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6685-UPDATE-DFA-ACCT.                                                   
      *****************************************************************         
       6685-UPDATE-DFA-ACCT.                                            
                                                                        
           EXEC SQL                                                     
               UPDATE CSS_DFA_ACCT                                      
               SET AMT_MO_PYMT         = :DA-AMT-MO-PYMT,               
                   AMT_ORIG_ENTERED    = :DA-AMT-ORIG-ENTERED,          
                   AMT_UNDEFERD_RECV   = :DA-AMT-UNDEFERD-RECV,         
                   LAST_UPDATE_TS      = CIS.CHAR2TIMESTAMP(
                                                      :WS-DFA-TIMESTAMP
              ),             
                   DATE_PYMT_START     = IIF(TRY_CONVERT(DATE, 
                                                    :DA-DATE-PYMT-START
              ) IS NULL OR (PATINDEX('%.%', :DA-DATE-PYMT-START
              ) <> 0) OR (LEN(:DA-DATE-PYMT-START
              ) <> 10), CIS.CHAR2DATE(:DA-DATE-PYMT-START
              ), CONVERT(DATE, :DA-DATE-PYMT-START) ),           
                   NO_SCHED_PYMTS      = :DA-NO-SCHED-PYMTS,            
                   REVERSE_REASON      = :DA-REVERSE-REASON,            
                   CODE_DFA_STATUS     = :DA-CODE-DFA-STATUS            
               WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL          
                 AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_DFA_ACCT                                              
MFA-TR*        SET AMT_MO_PYMT         = :DA-AMT-MO-PYMT,                       
MFA-TR*            AMT_ORIG_ENTERED    = :DA-AMT-ORIG-ENTERED,                  
MFA-TR*            AMT_UNDEFERD_RECV   = :DA-AMT-UNDEFERD-RECV,                 
MFA-TR*            LAST_UPDATE_TS      = :WS-DFA-TIMESTAMP,                     
MFA-TR*            DATE_PYMT_START     = :DA-DATE-PYMT-START,                   
MFA-TR*            NO_SCHED_PYMTS      = :DA-NO-SCHED-PYMTS,                    
MFA-TR*            REVERSE_REASON      = :DA-REVERSE-REASON,                    
MFA-TR*            CODE_DFA_STATUS     = :DA-CODE-DFA-STATUS                    
MFA-TR*        WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL                  
MFA-TR*          AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                        
MFA-TR*      QUERYNO 6685                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6685'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_DFA_ACCT'            TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
              MOVE 'PYMT_PRIORITY_LVL'       TO CMN-TABLE-ELEMENT-2     
              MOVE 'DFA_ITEM_ID'             TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-4     
              MOVE DA-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
              MOVE DA-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
              MOVE DA-DFA-ITEM-ID            TO CMN-HOSTVAR-ELEMENT-3   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-4   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
       6685-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6687-GET-MAX-ITEM-ID.                                                   
      *****************************************************************         
       6687-GET-MAX-ITEM-ID.                                            
             EXEC SQL                                                   
                 SELECT MAX(ITEM_ID)                                    
                   INTO :WS-MAX-ITEM-ID :WS-DFA-NULL-IND                 
                   FROM CSS_AR_CNTL                                     
                  WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO              
                    AND PYMT_PRIORITY_LVL = 60                          
                                                            
             END-EXEC.                                                  

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*      EXEC SQL                                                           
MFA-TR*          SELECT MAX(ITEM_ID)                                            
MFA-TR*            INTO :WS-MAX-ITEM-ID:WS-DFA-NULL-IND                         
MFA-TR*            FROM CSS_AR_CNTL                                             
MFA-TR*           WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                      
MFA-TR*             AND PYMT_PRIORITY_LVL = 60                                  
MFA-TR*      QUERYNO 6687                                                       
MFA-TR*      END-EXEC.                                                          

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
             MOVE SQLCODE                   TO WS-ACTIVE-RETURN-CODE.   
                                                                        
             IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                 
                IF WS-DFA-NULL-IND = -1                                 
                   MOVE 0                   TO WS-MAX-ITEM-ID           
                END-IF                                                  
             ELSE                                                       
                MOVE '6687'                 TO ACTIVE-PARAGRAPH         
                MOVE 'CSS_AR_CNTL'          TO CMN-TABLE-1              
                MOVE 'ACCOUNT_NO'           TO CMN-TABLE-ELEMENT-1      
CBSI            MOVE 'SERV_ORDER_NO'        TO CMN-TABLE-ELEMENT-2      
                MOVE AC-ACCOUNT-NO          TO CMN-HOSTVAR-ELEMENT-1    
CBSI            MOVE CMN-SERV-ORDER-NO      TO CMN-HOSTVAR-ELEMENT-2    
                PERFORM 9700-PROCESS-ABEND  THRU 9700-EXIT              
             END-IF.                                                    
                                                                        
       6687-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6688-COUNT-AR-CNTL.                                                     
      *****************************************************************         
       6688-COUNT-AR-CNTL.                                              
           EXEC SQL                                                     
               SELECT COUNT(*)                                          
                 INTO :WS-DFA-ROW-COUNT                                 
                 FROM CSS_AR_CNTL  AC                                   
                WHERE AC.ACCOUNT_NO        = :AC-ACCOUNT-NO             
                  AND AC.PYMT_PRIORITY_LVL = +90                        
                  AND ITEM_ID              > 0                          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT COUNT(*)                                                  
MFA-TR*          INTO :WS-DFA-ROW-COUNT                                         
MFA-TR*          FROM CSS_AR_CNTL  AC                                           
MFA-TR*         WHERE AC.ACCOUNT_NO        = :AC-ACCOUNT-NO                     
MFA-TR*           AND AC.PYMT_PRIORITY_LVL = +90                                
MFA-TR*           AND ITEM_ID              > 0                                  
MFA-TR*      QUERYNO 6688                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6688'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-2      
              MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-2    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
       6688-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
T18175* 6689-COUNT-DFA.                                                         
      *****************************************************************         
T18175 6689-COUNT-DFA.                                                  
                                                                        
           EXEC SQL                                                     
               SELECT COUNT(*)                                          
                 INTO :WS-DFA-ROW-COUNT                                 
                 FROM CSS_DFA_ACCT                                      
                WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                
                  AND PYMT_PRIORITY_LVL = +90                           
                  AND DFA_ITEM_ID       >  0                            
                  AND CODE_DFA_STATUS   = 'A'                           
                  AND CODE_DFA_TYPE     = 'A'                           
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT COUNT(*)                                                  
MFA-TR*          INTO :WS-DFA-ROW-COUNT                                         
MFA-TR*          FROM CSS_DFA_ACCT                                              
MFA-TR*         WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                        
MFA-TR*           AND PYMT_PRIORITY_LVL = +90                                   
MFA-TR*           AND DFA_iTEM_ID       >  0                                    
MFA-TR*           AND CODE_DFA_STATUS   = 'A'                                   
MFA-TR*           AND CODE_DFA_TYPE     = 'A'                                   
MFA-TR*      QUERYNO 6689                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6689'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_DFA_ACCT'           TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-2      
              MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-2    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
                                                                        
T18175 6689-EXIT.                                                       
            EXIT.                                                       
                                                                        
      *****************************************************************         
T18175* 6690-COUNT-DPP.                                                         
      *****************************************************************         
T18175 6690-COUNT-DPP.                                                  
                                                                        
           EXEC SQL                                                     
               SELECT COUNT(*)                                          
                 INTO :WS-DPP-ROW-COUNT                                 
                 FROM CSS_DFA_ACCT                                      
                WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                
                  AND PYMT_PRIORITY_LVL = +90                           
                  AND DFA_ITEM_ID       > 0                             
                  AND CODE_DFA_STATUS   = 'A'                           
                  AND CODE_DFA_TYPE     = 'B'                           
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT COUNT(*)                                                  
MFA-TR*          INTO :WS-DPP-ROW-COUNT                                         
MFA-TR*          FROM CSS_DFA_ACCT                                              
MFA-TR*         WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                        
MFA-TR*           AND PYMT_PRIORITY_LVL = +90                                   
MFA-TR*           AND DFA_ITEM_ID       > 0                                     
MFA-TR*           AND CODE_DFA_STATUS   = 'A'                                   
MFA-TR*           AND CODE_DFA_TYPE     = 'B'                                   
MFA-TR*      QUERYNO 6690                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6690'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_DFA_ACCT'           TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-2      
              MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-2    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
                                                                        
T18175 6690-EXIT.                                                       
            EXIT.                                                       
                                                                        
      *****************************************************************         
      * 6692-UPDATE-ACCOUNT.                                                    
      *****************************************************************         
       6692-UPDATE-ACCOUNT.                                             
           EXEC SQL                                                     
               UPDATE CSS_ACCOUNT                                       
                  SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT,      
P0471A*               CREDIT_GROUP       = :AT-CREDIT-GROUP,                    
                      TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE,        
                      DATE_LAST_ACTION   = IIF(TRY_CONVERT(DATE, 
                                                   :AT-DATE-LAST-ACTION
              ) IS NULL OR (PATINDEX('%.%', :AT-DATE-LAST-ACTION
              ) <> 0) OR (LEN(:AT-DATE-LAST-ACTION
              ) <> 10), CIS.CHAR2DATE(:AT-DATE-LAST-ACTION
              ), CONVERT(DATE, :AT-DATE-LAST-ACTION) ),        
                      LAST_UPDATE_TS     = CIS.CHAR2TIMESTAMP(
                                                     :AT-LAST-UPDATE-TS
              ),          
                      CODE_DISC_OK       = :AT-CODE-DISC-OK             
                WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO               
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ACCOUNT                                               
MFA-TR*           SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT,              
MFA-TR*               CREDIT_GROUP       = :AT-CREDIT-GROUP,                    
MFA-TR*               TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE,                
MFA-TR*               DATE_LAST_ACTION   = :AT-DATE-LAST-ACTION,                
MFA-TR*               LAST_UPDATE_TS     = :AT-LAST-UPDATE-TS,                  
MFA-TR*               CODE_DISC_OK       = :AT-CODE-DISC-OK                     
MFA-TR*         WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                       
MFA-TR*      QUERYNO 6692                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6692'                    TO ACTIVE-PARAGRAPH        
              MOVE 'CSS_ACCOUNT'             TO CMN-TABLE-1             
              MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
              MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
              PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
           END-IF.                                                      
                                                                        
       6692-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6693-UPDATE-AR-CNTL.                                                    
      *****************************************************************         
       6693-UPDATE-AR-CNTL.                                             
           EXEC SQL                                                     
               UPDATE CSS_AR_CNTL                                       
               SET    AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,            
                      AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,            
                      AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,            
                      AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90,            
                      AMT_UNUSED_CR     = :AC-AMT-UNUSED-CR,            
                      AMT_TRAN_BALANCE  = :AC-AMT-TRAN-BALANCE,         
                      TOT_SUMM_UNBILLED = :AC-TOT-SUMM-UNBILLED,        
                      LAST_UPDATE_TS    = CIS.CHAR2TIMESTAMP(
                                                      :WS-DFA-TIMESTAMP
              )             
               WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                
                 AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL         
                 AND  ITEM_ID           = :AC-ITEM-ID                   
                 AND  LAST_UPDATE_TS    = CIS.CHAR2TIMESTAMP(
                                                     :AC-LAST-UPDATE-TS
              )            
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_AR_CNTL                                               
MFA-TR*        SET    AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,                    
MFA-TR*               AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,                    
MFA-TR*               AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,                    
MFA-TR*               AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90,                    
MFA-TR*               AMT_UNUSED_CR     = :AC-AMT-UNUSED-CR,                    
MFA-TR*               AMT_TRAN_BALANCE  = :AC-AMT-TRAN-BALANCE,                 
MFA-TR*               TOT_SUMM_UNBILLED = :AC-TOT-SUMM-UNBILLED,                
MFA-TR*               LAST_UPDATE_TS    = :WS-DFA-TIMESTAMP                     
MFA-TR*        WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*          AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                 
MFA-TR*          AND  ITEM_ID           = :AC-ITEM-ID                           
MFA-TR*          AND  LAST_UPDATE_TS    = :AC-LAST-UPDATE-TS                    
MFA-TR*      QUERYNO 6693                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6693'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
              MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'ITEM_ID'                TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
              MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
              MOVE AC-PYMT-PRIORITY-LVL     TO CMN-HOSTVAR-ELEMENT-2    
              MOVE AC-ITEM-ID               TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
       6693-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6694-DELETE-DV.                                                         
      *****************************************************************         
       6694-DELETE-DV.                                                  
           EXEC SQL                                                     
                DELETE FROM CSS_DFA_RECVBLE                             
                WHERE ACCOUNT_NO        = :DV-ACCOUNT-NO                
                  AND DFA_PYMT_PRIORITY = :DV-DFA-PYMT-PRIORITY         
                  AND PYMT_PRIORITY_LVL = :DV-PYMT-PRIORITY-LVL         
                  AND AGREEMENT_NO      = :DV-AGREEMENT-NO              
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*         DELETE FROM CSS_DFA_RECVBLE                                     
MFA-TR*         WHERE ACCOUNT_NO        = :DV-ACCOUNT-NO                        
MFA-TR*           AND DFA_PYMT_PRIORITY = :DV-DFA-PYMT-PRIORITY                 
MFA-TR*           AND PYMT_PRIORITY_LVL = :DV-PYMT-PRIORITY-LVL                 
MFA-TR*           AND AGREEMENT_NO      = :DV-AGREEMENT-NO                      
MFA-TR*      QUERYNO 6694                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
              NEXT SENTENCE                                             
           ELSE                                                         
           IF WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                     
              MOVE SUCCESSFUL-CALL          TO WS-ACTIVE-RETURN-CODE    
           ELSE                                                         
              MOVE '6694'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_DFA_RECVBLE'        TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
              MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
              MOVE 'AGREEMENT_NO'           TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
              MOVE DV-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
              MOVE DV-PYMT-PRIORITY-LVL     TO CMN-HOSTVAR-ELEMENT-2    
              MOVE DV-AGREEMENT-NO          TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF
           END-IF.                                                      
                                                                        
       6694-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6696-DELETE-D-CL.                                                       
      *****************************************************************         
       6696-DELETE-D-CL.                                                
           EXEC SQL                                                     
                DELETE FROM CSS_CRED_COLL                               
                WHERE ACCOUNT_NO        = :CL-ACCOUNT-NO                
                  AND ITEM_ID           = 0                             
                  AND CODE_SPECIAL_TYPE = 'D'                           
                  AND CODE_NOTICE_TYPE  = :CL-CODE-NOTICE-TYPE          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*         DELETE FROM CSS_CRED_COLL                                       
MFA-TR*         WHERE ACCOUNT_NO        = :CL-ACCOUNT-NO                        
MFA-TR*           AND ITEM_ID           = 0                                     
MFA-TR*           AND CODE_SPECIAL_TYPE = 'D'                                   
MFA-TR*           AND CODE_NOTICE_TYPE  = :CL-CODE-NOTICE-TYPE                  
MFA-TR*      QUERYNO 6696                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
                                                                        
           IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '6696'                   TO ACTIVE-PARAGRAPH         
              MOVE 'CSS_CRED_COLL'          TO CMN-TABLE-1              
              MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
CBSI          MOVE 'CODE_NOTICE_TYPE'       TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-3      
              MOVE CL-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
CBSI          MOVE CL-CODE-NOTICE-TYPE      TO CMN-HOSTVAR-ELEMENT-2    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-3    
              PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
           END-IF.                                                      
                                                                        
       6696-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6697-SELECT-CL.                                                         
      *****************************************************************         
       6697-SELECT-CL.                                                  
           EXEC SQL                                                     
               SELECT DATE_NOTICE_MAIL,                                 
                      DATE_CREDIT_ACTION                                
                 INTO :CL-DATE-NOTICE-MAIL :WS-DFA-NULL-IND,             
                      :CL-DATE-CREDIT-ACTION :WS-DFA-NULL-IND2           
                FROM CSS_CRED_COLL                                      
               WHERE ACCOUNT_NO       = :CL-ACCOUNT-NO                  
                 AND ITEM_ID          = 0                               
                 AND CODE_NOTICE_TYPE = :CL-CODE-NOTICE-TYPE            
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT DATE_NOTICE_MAIL,                                         
MFA-TR*               DATE_CREDIT_ACTION                                        
MFA-TR*          INTO :CL-DATE-NOTICE-MAIL:WS-DFA-NULL-IND,                     
MFA-TR*               :CL-DATE-CREDIT-ACTION:WS-DFA-NULL-IND2                   
MFA-TR*         FROM CSS_CRED_COLL                                              
MFA-TR*        WHERE ACCOUNT_NO       = :CL-ACCOUNT-NO                          
MFA-TR*          AND ITEM_ID          = 0                                       
MFA-TR*          AND CODE_NOTICE_TYPE = :CL-CODE-NOTICE-TYPE                    
MFA-TR*      QUERYNO 6697                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              IF WS-DFA-NULL-IND = -1                                   
                 MOVE SPACES TO CL-DATE-NOTICE-MAIL                     
              END-IF                                                    
              IF WS-DFA-NULL-IND2 = -1                                  
                 MOVE SPACES TO CL-DATE-CREDIT-ACTION                   
              END-IF                                                    
           ELSE                                                         
              MOVE '6697'                  TO ACTIVE-PARAGRAPH          
              MOVE 'CSS_CRED_COLL'         TO CMN-TABLE-1               
              MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1       
              MOVE 'CODE_NOTICE_TYPE'      TO CMN-TABLE-ELEMENT-2       
CBSI          MOVE 'SERV_ORDER_NO'         TO CMN-TABLE-ELEMENT-3       
              MOVE CL-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1     
              MOVE CL-CODE-NOTICE-TYPE     TO CMN-HOSTVAR-ELEMENT-2     
CBSI          MOVE CMN-SERV-ORDER-NO       TO CMN-HOSTVAR-ELEMENT-3     
              PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT               
           END-IF.                                                      
                                                                        
       6697-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 6699-CLOSE-CSH-DRWR.                                                    
      *****************************************************************         
       6699-CLOSE-CSH-DRWR.                                             
                                                                        
           MOVE WS-JRNL-CNTRL-ONLY         TO WS-JRNL-OPERATION-RQST.   
           PERFORM 6400-ONLINE-JRNL-ROUTINE THRU 6400-EXIT.             
           IF NOT (WS-JRNL-RTRN-CODE = SPACES)                          
              MOVE PROGRAM-NAME            TO ABEND-PROGRAM             
              MOVE '6699'                  TO ACTIVE-PARAGRAPH          
              MOVE 'USER FORCED ABEND'     TO ABEND-FUNCTION            
              MOVE WS-Y                    TO WS-USER-FORCE-ABEND       
              MOVE 'JRNL ABEND'            TO DSNTIAR-MESSAGE-1         
              PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT               
           END-IF.                                                      
       6699-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7000-OPEN-SUMM-AR-CNTL.                                       *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7000-OPEN-SUMM-AR-CNTL.                                          
                                                                        
           MOVE '7000'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              OPEN SUMM-AR-CNTL                                         
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'             TO CMN-TABLE-1             
CBSI          MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'ITEM_ID'                 TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE AC-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE AC-ITEM-ID                TO CMN-HOSTVAR-ELEMENT-2   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7001-CLOSE-SUMM-AR-CNTL.                                      *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7001-CLOSE-SUMM-AR-CNTL.                                         
                                                                        
           MOVE '7001'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              CLOSE SUMM-AR-CNTL                                        
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'DFA_ITEM_ID'              TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE DA-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE DA-DFA-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7001-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7010-OPEN-DET-AR-CNTL.                                        *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES                         *         
      *              5650-BILL-FULL-AMOUNT.                           *         
      *****************************************************************         
       7010-OPEN-DET-AR-CNTL.                                           
                                                                        
           MOVE '7010'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              OPEN DET-AR-CNTL                                          
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
CBSI          MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7010-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7015-CLOSE-DET-AR-CNTL.                                       *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES                         *         
      *              5650-BILL-FULL-AMOUNT.                           *         
      *****************************************************************         
       7015-CLOSE-DET-AR-CNTL.                                          
                                                                        
           MOVE '7015'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              CLOSE DET-AR-CNTL                                         
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
CBSI          MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7015-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7020-OPEN-CSS-BILLING-DET.                                    *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7020-OPEN-CSS-BILLING-DET.                                       
                                                                        
           MOVE '7020'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              OPEN CSS-BILLING-DET                                      
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_DET'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE BG-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE BG-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7020-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7021-CLOSE-CSS-BILLING-DET.                                   *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7021-CLOSE-CSS-BILLING-DET.                                      
                                                                        
           MOVE '7021'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              CLOSE CSS-BILLING-DET                                     
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_DET'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE BG-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE BG-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7021-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7030-OPEN-CSS-DEP-ON-HAND.                                    *         
      * PERFORMED BY 5660-APPLY-DEPOSIT-TO-BILL.                      *         
      *****************************************************************         
       7030-OPEN-CSS-DEP-ON-HAND.                                       
                                                                        
           MOVE '7030'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              OPEN CSS-DEP-ON-HAND                                      
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7030-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7031-CLOSE-CSS-DEP-ON-HAND.                                   *         
      * PERFORMED BY 5660-APPLY-DEPOSIT-TO-BILL.                      *         
      *****************************************************************         
       7031-CLOSE-CSS-DEP-ON-HAND.                                      
                                                                        
           MOVE '7031'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              CLOSE CSS-DEP-ON-HAND                                     
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7031-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7050-OPEN-ACTIVE-DEP-ON-HAND.                                 *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7050-OPEN-ACTIVE-DEP-ON-HAND.                                    
                                                                        
           MOVE '7050'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              OPEN ACTIVE-DEP-ON-HAND                                   
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7050-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7051-CLOSE-ACTIVE-DEP-ON-HAND.                                *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7051-CLOSE-ACTIVE-DEP-ON-HAND.                                   
                                                                        
           MOVE '7051'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              CLOSE ACTIVE-DEP-ON-HAND                                  
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7051-EXIT.                                                       
           EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 7060-OPEN-AMT-TRAN                                            *         
T22772*****************************************************************         
T22772 7060-OPEN-AMT-TRAN.                                              
T22772                                                                  
T22772     MOVE '7060'                        TO ACTIVE-PARAGRAPH.      
T22772                                                                  
T22772     EXEC SQL                                                     
T22772        OPEN AMT-TRAN                                             
T22772     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772                                                                  
T22772     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T22772        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22772        MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T22772        MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22772        MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T22772        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22772     END-IF.                                                      
T22772                                                                  
T22772 7060-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 7061-CLOSE-AMT-TRAN.                                          *         
T22772*****************************************************************         
T22772 7061-CLOSE-AMT-TRAN.                                             
T22772                                                                  
T22772     MOVE '7061'                        TO ACTIVE-PARAGRAPH.      
T22772                                                                  
T22772     EXEC SQL                                                     
T22772        CLOSE AMT-TRAN                                            
T22772     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772                                                                  
T22772     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T22772        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22772        MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T22772        MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22772        MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T22772        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22772     END-IF.                                                      
T22772                                                                  
T22772 7061-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7080-SELECT-RESP-AREA-ID.                                     *         
      * PERFORMED BY 5654-JRNL-BILL-FULL.                             *         
      *****************************************************************         
       7080-SELECT-RESP-AREA-ID.                                        
                                                                        
           MOVE '7080'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT RESP_AREA_ID                                       
                INTO :PF-RESP-AREA-ID                                   
                FROM CSS_USER_PROFILE                                   
               WHERE USER_ID = :PF-USER-ID                              
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT RESP_AREA_ID                                               
MFA-TR*         INTO :PF-RESP-AREA-ID                                           
MFA-TR*         FROM CSS_USER_PROFILE                                           
MFA-TR*        WHERE USER_ID = :PF-USER-ID                                      
MFA-TR*      QUERYNO 7080                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_USER_PROFILE'         TO CMN-TABLE-1            
T5172         MOVE 'USER_ID'                  TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE PF-USER-ID                 TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7080-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7100-FETCH-SUMM-AR-CNTL.                                      *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES.                        *         
      *****************************************************************         
       7100-FETCH-SUMM-AR-CNTL.                                         
                                                                        
           MOVE '7100'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              FETCH SUMM-AR-CNTL                                        
               INTO :AC-AMT-AR-DAY-00    ,                              
                    :AC-AMT-AR-DAY-30    ,                              
                    :AC-AMT-AR-DAY-60    ,                              
                    :AC-AMT-AR-DAY-90    ,                              
                    :AC-AMT-UNUSED-CR    ,                              
                    :AC-TOT-SUMM-UNBILLED,                              
                    :AC-PYMT-PRIORITY-LVL                               
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'ITEM_ID'                 TO CMN-TABLE-ELEMENT-2     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-3     
CBSI          MOVE AC-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE AC-ITEM-ID                TO CMN-HOSTVAR-ELEMENT-2   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7100-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7110-FETCH-DET-AR-CNTL.                                       *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES                         *         
      *              5651-PROCESS-DFA-BILL                            *         
      *              5652-PROCESS-CNT-BILL                            *         
      *              5653-PROCESS-CIA-BILL.                           *         
      *****************************************************************         
       7110-FETCH-DET-AR-CNTL.                                          
                                                                        
           MOVE '7110'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              FETCH DET-AR-CNTL                                         
               INTO :WS-AC-AMT-AR-DAY-00   ,                            
                    :WS-AC-AMT-AR-DAY-30   ,                            
                    :WS-AC-AMT-AR-DAY-60   ,                            
                    :WS-AC-AMT-AR-DAY-90   ,                            
                    :WS-AC-AMT-TRAN-BALANCE,                            
                    :WS-AC-ITEM-ID                                      
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
CBSI          MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7110-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7120-FETCH-CSS-BILLING-DET.                                   *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL                          *         
      *              5610-CHECK-FOR-CNSMPTN-HIST.                     *         
      *****************************************************************         
       7120-FETCH-CSS-BILLING-DET.                                      
                                                                        
           MOVE '7120'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              FETCH CSS-BILLING-DET                                     
               INTO :BG-CODE-UTIL-TYPE    ,                             
                    :BG-IC-NO             ,                             
                    :BG-CODE-BILL-ITM-IND ,                             
                    :BG-REVENUE-MONTH,                                  
                    :BG-BTU-FACTOR                                      
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_DET'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE BG-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE BG-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7120-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7130-FETCH-CSS-DEP-ON-HAND.                                   *         
      * PERFORMED BY 5660-APPLY-DEPOSIT-TO-BILL                       *         
      *              5661-DETERMINE-DEPOSIT.                          *         
      *****************************************************************         
       7130-FETCH-CSS-DEP-ON-HAND.                                      
                                                                        
           MOVE '7130'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              FETCH CSS-DEP-ON-HAND                                     
               INTO :DO-DEPOSIT-CERT-NO,                                
                    :DO-AMT-DEPOSIT,                                    
                    :DO-DEPOSIT-STATUS-CD,                              
                    :DO-DATE-CERT-ISSUE :WS-NULL-DT-IND-1,               
                    :DO-TOTAL-INTRST,                                   
                    :DO-DATE-REFUNDED :WS-NULL-DT-IND-16,                
                    :DO-DATE-INTST-CALC-TO :WS-NULL-DT-IND-3,            
                    :WS-DATE-INTST-CALC-FROM :WS-NULL-DT-IND-15,         
                    :DO-CODE-REFUND-STATUS,                             
                    :DO-INTRST-YTD,                                     
C30300              :WS-AMT-REFUNDED                                    
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
C25426*    IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND              
C25426     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C25426        IF  WS-NULL-DT-IND-3 < 0                                  
C25426            MOVE SPACES                   TO DO-DATE-INTST-CALC-TO
C25426        END-IF                                                    
C25426     ELSE                                                         
C25426        IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                      
                 NEXT SENTENCE                                          
              ELSE                                                      
T5172            MOVE 'CSS_DEP_ON_HAND'         TO CMN-TABLE-1          
CBSI             MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1  
CBSI             MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2  
CBSI             MOVE DO-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1
CBSI             MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2
                 PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT          
C25426        END-IF                                                    
           END-IF.                                                      
                                                                        
       7130-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7150-FETCH-ACTIVE-DEP-ON-HAND.                                *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7150-FETCH-ACTIVE-DEP-ON-HAND.                                   
                                                                        
           MOVE '7150'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              FETCH ACTIVE-DEP-ON-HAND                                  
               INTO :WS-ACTIVE-DEP-EXISTS                               
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7150-EXIT.                                                       
           EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 7160-FETCH-AMT-TRAN                                           *         
T22772*****************************************************************         
T22772 7160-FETCH-AMT-TRAN.                                             
T22772                                                                  
T22772     MOVE '7160'                        TO ACTIVE-PARAGRAPH.      
T22772                                                                  
T22772     EXEC SQL                                                     
T22772        FETCH AMT-TRAN                                            
T22772         INTO :AC-AMT-TRAN-BALANCE                                
T22772     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772                                                                  
T22772     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T22772        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22772        MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T22772        MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22772        MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T22772        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22772     END-IF.                                                      
T22772 7160-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7200-SELECT-TIMESTAMP.                                        *         
      *****************************************************************         
       7200-SELECT-TIMESTAMP.                                           
                                                                        
           MOVE '7200'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT REPLACE(REPLACE(CONVERT(CHAR(26), 
           CIS.CURRENT$TIMESTAMP(), 121), ' ', '-'), ':', '.'),                
                     CAST(SYSDATETIMEOFFSET() AS DATE)                          
                INTO :WS-CURRENT-TIMESTAMP,                             
                     :WS-CURRENT-DATE                                   
                FROM CSS_MODEL_SQL                                      
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CURRENT TIMESTAMP,                                         
MFA-TR*              CURRENT DATE                                               
MFA-TR*         INTO :WS-CURRENT-TIMESTAMP,                                     
MFA-TR*              :WS-CURRENT-DATE                                           
MFA-TR*         FROM CSS_MODEL_SQL                                              
MFA-TR*      QUERYNO 7200                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_MODEL_SQL'            TO CMN-TABLE-1            
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-1  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7200-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7210-SELECT-CSS-ACCOUNT.                                      *         
      * SELECT EACH FIELD INCLUDED IN UPDATE CALL BECAUSE DIFFERENT   *         
      * TYPES OF SO'S RESULT IN MOVING NEW VALUES TO ONLY SOME OF THE *         
      * FIELDS IN THE UPDATE CALL.                                    *         
      *                                                               *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7210-SELECT-CSS-ACCOUNT.                                         
                                                                        
           MOVE '7210'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CODE_COMPANY_ACCT     ,                            
                     DATE_LAST_ACTION      ,                            
                     CUSTOMER_NO           ,                            
                     PREMISE_NO            ,                            
                     CODE_ACCT_STAT        ,                            
                     TOTAL_AR_BALANCE      ,                            
                     CODES_DATA_PRESENT    ,                            
                     DATE_BILL_DAY_00      ,                            
                     DATE_BILL_DAY_30      ,                            
                     DATE_BILL_DAY_60      ,                            
                     DATE_BILL_DAY_90      ,                            
                     CODE_BILL_PEND        ,                            
                     COMPANY_NO            ,                            
                     LOCAL_OFFICE          ,                            
                     ADDRESS_ID            ,                            
                     ADDRESS_FORMAT        ,                            
                     REPLACE(REPLACE(CONVERT(CHAR(26), LAST_UPDATE_TS
           , 121), ' ', '-'), ':', '.') LAST_UPDATE_TS        ,                
                     CODE_TEMP_BILL        ,                            
                     CODE_P_BILL_DEST      ,                            
                     ELEC_REV_ALLOC_PCT    ,                            
                     MST_SUB_ACCT_IND      ,                            
T20499               REV_MTH_LST_NRML      ,                            
T20499               BILL_CYCLE            ,                            
BILGEN               EXT_BILLING_FL        ,                            
C27363               CODE_ACCT_BILLED      ,                            
C29238               CODE_PERM_BILL                                     
                INTO :AT-CODE-COMPANY-ACCT ,                            
                     :AT-DATE-LAST-ACTION :WS-NULL-DT-IND-4,             
                     :AT-CUSTOMER-NO       ,                            
                     :AT-PREMISE-NO        ,                            
                     :AT-CODE-ACCT-STAT    ,                            
                     :AT-TOTAL-AR-BALANCE  ,                            
                     :AT-CODES-DATA-PRESENT,                            
                     :AT-DATE-BILL-DAY-00 :WS-NULL-DT-IND-10,            
                     :AT-DATE-BILL-DAY-30 :WS-NULL-DT-IND-11,            
                     :AT-DATE-BILL-DAY-60 :WS-NULL-DT-IND-12,            
                     :AT-DATE-BILL-DAY-90 :WS-NULL-DT-IND-13,            
                     :AT-CODE-BILL-PEND    ,                            
                     :AT-COMPANY-NO        ,                            
                     :AT-LOCAL-OFFICE      ,                            
                     :AT-ADDRESS-ID        ,                            
                     :AT-ADDRESS-FORMAT    ,                            
                     :AT-LAST-UPDATE-TS    ,                            
                     :AT-CODE-TEMP-BILL    ,                            
                     :AT-CODE-P-BILL-DEST  ,                            
                     :AT-ELEC-REV-ALLOC-PCT,                            
                     :AT-MST-SUB-ACCT-IND,                              
T20499               :AT-REV-MTH-LST-NRML :WS-REVENUE-MONTH-NULL-1,      
T20499               :AT-BILL-CYCLE,                                    
BILGEN               :AT-EXT-BILLING-FL,                                
C27363               :AT-CODE-ACCT-BILLED,                              
C29238               :AT-CODE-PERM-BILL                                 
                FROM CSS_ACCOUNT                                        
               WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_COMPANY_ACCT     ,                                    
MFA-TR*              DATE_LAST_ACTION      ,                                    
MFA-TR*              CUSTOMER_NO           ,                                    
MFA-TR*              PREMISE_NO            ,                                    
MFA-TR*              CODE_ACCT_STAT        ,                                    
MFA-TR*              TOTAL_AR_BALANCE      ,                                    
MFA-TR*              CODES_DATA_PRESENT    ,                                    
MFA-TR*              DATE_BILL_DAY_00      ,                                    
MFA-TR*              DATE_BILL_DAY_30      ,                                    
MFA-TR*              DATE_BILL_DAY_60      ,                                    
MFA-TR*              DATE_BILL_DAY_90      ,                                    
MFA-TR*              CODE_BILL_PEND        ,                                    
MFA-TR*              COMPANY_NO            ,                                    
MFA-TR*              LOCAL_OFFICE          ,                                    
MFA-TR*              ADDRESS_ID            ,                                    
MFA-TR*              ADDRESS_FORMAT        ,                                    
MFA-TR*              LAST_UPDATE_TS        ,                                    
MFA-TR*              CODE_TEMP_BILL        ,                                    
MFA-TR*              CODE_P_BILL_DEST      ,                                    
MFA-TR*              ELEC_REV_ALLOC_PCT    ,                                    
MFA-TR*              MST_SUB_ACCT_IND      ,                                    
MFA-TR*              REV_MTH_LST_NRML      ,                                    
MFA-TR*              BILL_CYCLE            ,                                    
MFA-TR*              EXT_BILLING_FL        ,                                    
MFA-TR*              CODE_ACCT_BILLED      ,                                    
MFA-TR*              CODE_PERM_BILL                                             
MFA-TR*         INTO :AT-CODE-COMPANY-ACCT ,                                    
MFA-TR*              :AT-DATE-LAST-ACTION:WS-NULL-DT-IND-4,                     
MFA-TR*              :AT-CUSTOMER-NO       ,                                    
MFA-TR*              :AT-PREMISE-NO        ,                                    
MFA-TR*              :AT-CODE-ACCT-STAT    ,                                    
MFA-TR*              :AT-TOTAL-AR-BALANCE  ,                                    
MFA-TR*              :AT-CODES-DATA-PRESENT,                                    
MFA-TR*              :AT-DATE-BILL-DAY-00:WS-NULL-DT-IND-10,                    
MFA-TR*              :AT-DATE-BILL-DAY-30:WS-NULL-DT-IND-11,                    
MFA-TR*              :AT-DATE-BILL-DAY-60:WS-NULL-DT-IND-12,                    
MFA-TR*              :AT-DATE-BILL-DAY-90:WS-NULL-DT-IND-13,                    
MFA-TR*              :AT-CODE-BILL-PEND    ,                                    
MFA-TR*              :AT-COMPANY-NO        ,                                    
MFA-TR*              :AT-LOCAL-OFFICE      ,                                    
MFA-TR*              :AT-ADDRESS-ID        ,                                    
MFA-TR*              :AT-ADDRESS-FORMAT    ,                                    
MFA-TR*              :AT-LAST-UPDATE-TS    ,                                    
MFA-TR*              :AT-CODE-TEMP-BILL    ,                                    
MFA-TR*              :AT-CODE-P-BILL-DEST  ,                                    
MFA-TR*              :AT-ELEC-REV-ALLOC-PCT,                                    
MFA-TR*              :AT-MST-SUB-ACCT-IND,                                      
MFA-TR*              :AT-REV-MTH-LST-NRML:WS-REVENUE-MONTH-NULL-1,              
MFA-TR*              :AT-BILL-CYCLE,                                            
MFA-TR*              :AT-EXT-BILLING-FL,                                        
MFA-TR*              :AT-CODE-ACCT-BILLED,                                      
MFA-TR*              :AT-CODE-PERM-BILL                                         
MFA-TR*         FROM CSS_ACCOUNT                                                
MFA-TR*        WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                                
MFA-TR*      QUERYNO 7210                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE WS-ACTIVE-RETURN-CODE      TO RS-RETURN-CODE         
T5172         MOVE 'CSS_ACCOUNT'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7210-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7220-SELECT-CSS-PREMISE.                                      *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7220-SELECT-CSS-PREMISE.                                         
                                                                        
           MOVE '7220'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CODE_PREMISE_STAT ,                                
                     REV_DISTRICT_CD   ,                                
                     ELEC_AVAILABLE_IND,                                
                     GAS_AVAILABLE_IND                                  
                INTO :PR-CODE-PREMISE-STAT ,                            
                     :PR-REV-DISTRICT-CD   ,                            
                     :PR-ELEC-AVAILABLE-IND,                            
                     :PR-GAS-AVAILABLE-IND                              
                FROM CSS_PREMISE                                        
               WHERE PREMISE_NO = :PR-PREMISE-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_PREMISE_STAT ,                                        
MFA-TR*              REV_DISTRICT_CD   ,                                        
MFA-TR*              ELEC_AVAILABLE_IND,                                        
MFA-TR*              GAS_AVAILABLE_IND                                          
MFA-TR*         INTO :PR-CODE-PREMISE-STAT ,                                    
MFA-TR*              :PR-REV-DISTRICT-CD   ,                                    
MFA-TR*              :PR-ELEC-AVAILABLE-IND,                                    
MFA-TR*              :PR-GAS-AVAILABLE-IND                                      
MFA-TR*         FROM CSS_PREMISE                                                
MFA-TR*        WHERE PREMISE_NO = :PR-PREMISE-NO                                
MFA-TR*      QUERYNO 7220                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_PREMISE'              TO CMN-TABLE-1            
T5172         MOVE 'PREMISE_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE PR-PREMISE-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7220-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7230-SELECT-CSS-CUSTOMER.                                     *         
      * PERFORMED BY 5000-UPDATE.                                     *         
      *****************************************************************         
       7230-SELECT-CSS-CUSTOMER.                                        
                                                                        
           MOVE '7230'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CODE_EMPL_ACCT,                                    
                     CODE_CUST_STATUS,                                  
                     NAME_ID,                                           
A37666               AUTO_XFER_TO_ACCT                                  
                INTO :CU-CODE-EMPL-ACCT,                                
                     :CU-CODE-CUST-STATUS,                              
                     :CU-NAME-ID,                                       
A37666               :CU-AUTO-XFER-TO-ACCT :WS-NULL-CU                   
                FROM CSS_CUSTOMER                                       
               WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                      
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_EMPL_ACCT,                                            
MFA-TR*              CODE_CUST_STATUS,                                          
MFA-TR*              NAME_ID,                                                   
MFA-TR*              AUTO_XFER_TO_ACCT                                          
MFA-TR*         INTO :CU-CODE-EMPL-ACCT,                                        
MFA-TR*              :CU-CODE-CUST-STATUS,                                      
MFA-TR*              :CU-NAME-ID,                                               
MFA-TR*              :CU-AUTO-XFER-TO-ACCT:WS-NULL-CU                           
MFA-TR*         FROM CSS_CUSTOMER                                               
MFA-TR*        WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                              
MFA-TR*      QUERYNO 7230                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           EVALUATE WS-ACTIVE-RETURN-CODE                               
               WHEN SUCCESSFUL-CALL                                     
                   IF WS-NULL-CU < 0                                    
                       MOVE ZEROES TO CU-AUTO-XFER-TO-ACCT              
                   END-IF                                               
               WHEN NOT-FOUND                                           
                   CONTINUE                                             
               WHEN OTHER                                               
CBSI               MOVE 'CSS_CUSTOMER'        TO CMN-TABLE-1            
T5172              MOVE 'CUSTOMER_NO'         TO CMN-TABLE-ELEMENT-1    
CBSI               MOVE 'SERV_ORDER_NO'       TO CMN-TABLE-ELEMENT-2    
T5172              MOVE CU-CUSTOMER-NO        TO CMN-HOSTVAR-ELEMENT-1  
CBSI               MOVE CMN-SERV-ORDER-NO     TO CMN-HOSTVAR-ELEMENT-2  
                   PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT        
           END-EVALUATE.                                                
                                                                        
       7230-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7240-SELECT-SUMM-AR-CNTL.                                     *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL                          *         
      *              5666-PAY-DEP-DET-FM.                             *         
      *****************************************************************         
       7240-SELECT-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '7240'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT AMT_AR_DAY_00    ,                                 
                     AMT_AR_DAY_30    ,                                 
                     AMT_AR_DAY_60    ,                                 
                     AMT_AR_DAY_90    ,                                 
                     AMT_UNUSED_CR    ,                                 
                     TOT_SUMM_UNBILLED                                  
                INTO :AC-AMT-AR-DAY-00,                                 
                     :AC-AMT-AR-DAY-30,                                 
                     :AC-AMT-AR-DAY-60,                                 
                     :AC-AMT-AR-DAY-90,                                 
                     :AC-AMT-UNUSED-CR,                                 
                     :AC-TOT-SUMM-UNBILLED                              
                FROM CSS_AR_CNTL                                        
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                 AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT AMT_AR_DAY_00    ,                                         
MFA-TR*              AMT_AR_DAY_30    ,                                         
MFA-TR*              AMT_AR_DAY_60    ,                                         
MFA-TR*              AMT_AR_DAY_90    ,                                         
MFA-TR*              AMT_UNUSED_CR    ,                                         
MFA-TR*              TOT_SUMM_UNBILLED                                          
MFA-TR*         INTO :AC-AMT-AR-DAY-00,                                         
MFA-TR*              :AC-AMT-AR-DAY-30,                                         
MFA-TR*              :AC-AMT-AR-DAY-60,                                         
MFA-TR*              :AC-AMT-AR-DAY-90,                                         
MFA-TR*              :AC-AMT-UNUSED-CR,                                         
MFA-TR*              :AC-TOT-SUMM-UNBILLED                                      
MFA-TR*         FROM CSS_AR_CNTL                                                
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 7240                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7240-EXIT.                                                       
           EXIT.                                                        
                                                                        
PCR393*****************************************************************         
PCR393* 7250-SELECT-CONTRACT.                                         *         
PCR393*****************************************************************         
PCR393 7250-SELECT-CONTRACT.                                            
PCR393                                                                  
PCR393     MOVE '7250'                        TO ACTIVE-PARAGRAPH.      
PCR393                                                                  
PCR393     EXEC SQL                                                     
PCR393        SELECT CODE_CONTRACT_TYPE,                                
PCR393               CONTRACT_COMMENTS                                  
PCR393          INTO :CT-CODE-CONTRACT-TYPE,                            
PCR393               :CT-CONTRACT-COMMENTS                              
PCR393          FROM CSS_CONTRACT                                       
PCR393         WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                 
PCR393           AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL          
PCR393           AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                
                                                            
PCR393     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_CONTRACT_TYPE,                                        
MFA-TR*              CONTRACT_COMMENTS                                          
MFA-TR*         INTO :CT-CODE-CONTRACT-TYPE,                                    
MFA-TR*              :CT-CONTRACT-COMMENTS                                      
MFA-TR*         FROM CSS_CONTRACT                                               
MFA-TR*        WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL                  
MFA-TR*          AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                        
MFA-TR*      QUERYNO 7250                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR393                                                                  
PCR393     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
PCR393                                                                  
PCR393     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
PCR393        NEXT SENTENCE                                             
PCR393     ELSE                                                         
PCR393        MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
PCR393        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
PCR393        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
PCR393        MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
PCR393        MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
PCR393        MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
PCR393        MOVE CT-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
PCR393        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
PCR393     END-IF.                                                      
PCR393                                                                  
PCR393 7250-EXIT.                                                       
PCR393     EXIT.                                                        
                                                                        
P00914 7260-OPEN-WAY-CHECK.                                             
P00914                                                                  
P00914     MOVE '7260'                        TO ACTIVE-PARAGRAPH.      
P00914                                                                  
P00914     EXEC SQL                                                     
P00914        SELECT TOP(1) ACCOUNT_NO                                         
P00914          INTO :MN-ACCOUNT-NO                                     
P00914          FROM CSS_MTRD_ENVRNMT MN WITH(READUNCOMMITTED),                 
P00914               CSS_MTR_RD_FMT MR WITH(READUNCOMMITTED)                    
P00914         WHERE MN.ACCOUNT_NO = :AT-ACCOUNT-NO                     
P00914           AND MN.CODE_UTIL_TYPE = 'E'                            
P00914           AND MN.MTR_READ_SOURCE_CD = 'P'                        
P00914           AND MR.INDEX_VALUE_CD = 'V'                            
P00914           AND MN.DIGTL_MTR_TYPE = MR.DIGTL_MTR_TYPE              
P00914           AND MN.PROGRAM_ID = MR.PROGRAM_ID                      
P00914           AND MN.MTR_READ_SOURCE_CD = MR.MTR_READ_SOURCE_CD      
P00914           AND MN.CODE_UTIL_TYPE = MR.CODE_UTIL_TYPE              
P00914           AND MR.CNSMPTN_READ_FL = 'Y'                           
P00914                                           
P00914                                                           
P00914                                                      
P00914     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT ACCOUNT_NO                                                 
MFA-TR*         INTO :MN-ACCOUNT-NO                                             
MFA-TR*         FROM CSS_MTRD_ENVRNMT MN,                                       
MFA-TR*              CSS_MTR_RD_FMT MR                                          
MFA-TR*        WHERE MN.ACCOUNT_NO = :AT-ACCOUNT-NO                             
MFA-TR*          AND MN.CODE_UTIL_TYPE = 'E'                                    
MFA-TR*          AND MN.MTR_READ_SOURCE_CD = 'P'                                
MFA-TR*          AND MR.INDEX_VALUE_CD = 'V'                                    
MFA-TR*          AND MN.DIGTL_MTR_TYPE = MR.DIGTL_MTR_TYPE                      
MFA-TR*          AND MN.PROGRAM_ID = MR.PROGRAM_ID                              
MFA-TR*          AND MN.MTR_READ_SOURCE_CD = MR.MTR_READ_SOURCE_CD              
MFA-TR*          AND MN.CODE_UTIL_TYPE = MR.CODE_UTIL_TYPE                      
MFA-TR*          AND MR.CNSMPTN_READ_FL = 'Y'                                   
MFA-TR*      FETCH FIRST 1 ROWS ONLY                                            
MFA-TR*      WITH UR                                                            
MFA-TR*      QUERYNO 7260                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00914                                                                  
P00914     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
P00914                                                                  
P00914     EVALUATE WS-ACTIVE-RETURN-CODE                               
P00914         WHEN SUCCESSFUL-CALL                                     
P00914             CONTINUE                                             
P00914         WHEN NOT-FOUND                                           
P00914             MOVE ZEROES TO WS-ACTIVE-RETURN-CODE                 
P00914                            MN-ACCOUNT-NO                         
P00914         WHEN OTHER                                               
P00914             MOVE 'CSS_MTRD_ENVRNMT'    TO CMN-TABLE-1            
P00914             MOVE 'CSS_MTR_RD_FMT'      TO CMN-TABLE-1            
P00914             MOVE 'ACCOUNT_NO'          TO CMN-TABLE-ELEMENT-1    
P00914             MOVE AT-ACCOUNT-NO         TO CMN-HOSTVAR-ELEMENT-1  
P00914             MOVE 'SERV_ORDER_NO'       TO CMN-TABLE-ELEMENT-2    
P00914             MOVE CMN-SERV-ORDER-NO     TO CMN-HOSTVAR-ELEMENT-2  
P00914             PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT        
P00914     END-EVALUATE.                                                
P00914                                                                  
PCR914 7260-EXIT.                                                       
PCR914     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7300-SELECT-CSS-BILLING-HDR.                                  *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7300-SELECT-CSS-BILLING-HDR.                                     
                                                                        
           MOVE '7300'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CUSTOMER_NO,                                       
                     BILL_NO                                            
                INTO :BI-CUSTOMER-NO,                                   
                     :BI-BILL-NO                                        
                FROM CSS_BILLING_HDR                                    
               WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                        
                 AND BILL_NO    = ( SELECT MAX(BILL_NO)                 
                                      FROM CSS_BILLING_HDR              
                                     WHERE ACCOUNT_NO  = :BI-ACCOUNT-NO 
                                       AND DATE_BILLED IS NULL )        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CUSTOMER_NO,                                               
MFA-TR*              BILL_NO                                                    
MFA-TR*         INTO :BI-CUSTOMER-NO,                                           
MFA-TR*              :BI-BILL-NO                                                
MFA-TR*         FROM CSS_BILLING_HDR                                            
MFA-TR*        WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                                
MFA-TR*          AND BILL_NO    = ( SELECT MAX(BILL_NO)                         
MFA-TR*                               FROM CSS_BILLING_HDR                      
MFA-TR*                              WHERE ACCOUNT_NO  = :BI-ACCOUNT-NO         
MFA-TR*                                AND DATE_BILLED IS NULL )                
MFA-TR*      QUERYNO 7300                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_HDR'          TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE BI-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7300-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7310-SELECT-CSS-CNSMPTN-HIST.                                 *         
      * PERFORMED BY 5610-CHECK-FOR-CNSMPTN-HIST.                     *         
      *****************************************************************         
       7310-SELECT-CSS-CNSMPTN-HIST.                                    
                                                                        
           MOVE '7310'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y'                                                
                INTO :WS-ROWS-FOUND                                     
                FROM CSS_CNSMPTN_HIST                                   
               WHERE ACCOUNT_NO     = :CX-ACCOUNT-NO                    
                 AND BILL_NO        = :CX-BILL-NO                       
                 AND CODE_UTIL_TYPE = :CX-CODE-UTIL-TYPE                
                 AND IC_NO          = :CX-IC-NO                         
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-ROWS-FOUND                                             
MFA-TR*         FROM CSS_CNSMPTN_HIST                                           
MFA-TR*        WHERE ACCOUNT_NO     = :CX-ACCOUNT-NO                            
MFA-TR*          AND BILL_NO        = :CX-BILL-NO                               
MFA-TR*          AND CODE_UTIL_TYPE = :CX-CODE-UTIL-TYPE                        
MFA-TR*          AND IC_NO          = :CX-IC-NO                                 
MFA-TR*      QUERYNO 7310                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
                                      OR WS-MULTIPLE-ROWS-CALL          
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_CNSMPTN_HIST'         TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'CODE_UTIL_TYPE'           TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE CX-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE CX-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE CX-CODE-UTIL-TYPE          TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7310-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7330-SELECT-CSS-CONTRACT.                                     *         
      * PERFORMED BY 5652-PROCESS-CNT-BILL.                           *         
      *****************************************************************         
       7330-SELECT-CSS-CONTRACT.                                        
                                                                        
           MOVE '7330'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CODE_INTRST_METH    ,                              
                     DATE_PYMT_START     ,                              
                     INTRST_PRIOR_YR     ,                              
                     NO_SCHED_PYMTS      ,                              
                     AMT_MO_PYMT         ,                              
                     CNT_NAME_CD         ,                              
                     GL_ACCT_NO_DEF_INT  ,                              
                     AMT_DEF_INTEREST    ,                              
C26298               CNT_STATUS_CD                                      
                INTO :CT-CODE-INTRST-METH  ,                            
                     :CT-DATE-PYMT-START :WS-NULL-DT-IND-5,              
                     :CT-INTRST-PRIOR-YR   ,                            
                     :CT-NO-SCHED-PYMTS    ,                            
                     :CT-AMT-MO-PYMT       ,                            
                     :CT-CNT-NAME-CD       ,                            
                     :CT-GL-ACCT-NO-DEF-INT,                            
                     :CT-AMT-DEF-INTEREST  ,                            
C26298               :CT-CNT-STATUS-CD                                  
                FROM CSS_CONTRACT                                       
               WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL          
                 AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_INTRST_METH    ,                                      
MFA-TR*              DATE_PYMT_START     ,                                      
MFA-TR*              INTRST_PRIOR_YR     ,                                      
MFA-TR*              NO_SCHED_PYMTS      ,                                      
MFA-TR*              AMT_MO_PYMT         ,                                      
MFA-TR*              CNT_NAME_CD         ,                                      
MFA-TR*              GL_ACCT_NO_DEF_INT  ,                                      
MFA-TR*              AMT_DEF_INTEREST    ,                                      
MFA-TR*              CNT_STATUS_CD                                              
MFA-TR*         INTO :CT-CODE-INTRST-METH  ,                                    
MFA-TR*              :CT-DATE-PYMT-START:WS-NULL-DT-IND-5,                      
MFA-TR*              :CT-INTRST-PRIOR-YR   ,                                    
MFA-TR*              :CT-NO-SCHED-PYMTS    ,                                    
MFA-TR*              :CT-AMT-MO-PYMT       ,                                    
MFA-TR*              :CT-CNT-NAME-CD       ,                                    
MFA-TR*              :CT-GL-ACCT-NO-DEF-INT,                                    
MFA-TR*              :CT-AMT-DEF-INTEREST  ,                                    
MFA-TR*              :CT-CNT-STATUS-CD                                          
MFA-TR*         FROM CSS_CONTRACT                                               
MFA-TR*        WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL                  
MFA-TR*          AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                        
MFA-TR*      QUERYNO 7330                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE CT-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7330-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7331-SELECT-CSS-BILLING-HDR.                                  *         
      *****************************************************************         
       7331-SELECT-CSS-BILLING-HDR.                                     
                                                                        
           MOVE '7331'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT CUSTOMER_NO,                                       
                     BILL_NO                                            
                INTO :BI-CUSTOMER-NO,                                   
                     :BI-BILL-NO                                        
                FROM CSS_BILLING_HDR                                    
               WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                        
                 AND BILL_NO    = (SELECT MAX(BILL_NO)                  
                                     FROM CSS_BILLING_HDR               
                                    WHERE ACCOUNT_NO = :BI-ACCOUNT-NO   
                                      AND DATE_BILLED IS NULL)          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CUSTOMER_NO,                                               
MFA-TR*              BILL_NO                                                    
MFA-TR*         INTO :BI-CUSTOMER-NO,                                           
MFA-TR*              :BI-BILL-NO                                                
MFA-TR*         FROM CSS_BILLING_HDR                                            
MFA-TR*        WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                                
MFA-TR*          AND BILL_NO    = (SELECT MAX(BILL_NO)                          
MFA-TR*                              FROM CSS_BILLING_HDR                       
MFA-TR*                             WHERE ACCOUNT_NO = :BI-ACCOUNT-NO           
MFA-TR*                               AND DATE_BILLED IS NULL)                  
MFA-TR*      QUERYNO 7331                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_BILLING_HDR'          TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
              MOVE BI-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7331-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7340-SELECT-BUDGET-PLAN.                                      *         
      *****************************************************************         
       7340-SELECT-BUDGET-PLAN.                                         
                                                                        
           MOVE '7340'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT AMT_MO_PYMT    ,                                   
                     DATE_PYMT_STRT ,                                   
                     ANNIVERSARY_DATE                                   
                INTO :BU-AMT-MO-PYMT,                                   
                     :BU-DATE-PYMT-STRT :WS-NULL-DT-IND-1,               
                     :BU-ANNIVERSARY-DATE :WS-NULL-DT-IND-2              
                FROM CSS_BUDGET_PLAN                                    
               WHERE ACCOUNT_NO        = :BU-ACCOUNT-NO                 
                 AND BP_ITEM_ID        = :BU-BP-ITEM-ID                 
                 AND PYMT_PRIORITY_LVL = :BU-PYMT-PRIORITY-LVL          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT AMT_MO_PYMT    ,                                           
MFA-TR*              DATE_PYMT_STRT ,                                           
MFA-TR*              ANNIVERSARY_DATE                                           
MFA-TR*         INTO :BU-AMT-MO-PYMT,                                           
MFA-TR*              :BU-DATE-PYMT-STRT:WS-NULL-DT-IND-1,                       
MFA-TR*              :BU-ANNIVERSARY-DATE:WS-NULL-DT-IND-2                      
MFA-TR*         FROM CSS_BUDGET_PLAN                                            
MFA-TR*        WHERE ACCOUNT_NO        = :BU-ACCOUNT-NO                         
MFA-TR*          AND BP_ITEM_ID        = :BU-BP-ITEM-ID                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :BU-PYMT-PRIORITY-LVL                  
MFA-TR*      QUERYNO 7340                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF BU-ANNIVERSARY-DATE > SPACES                              
              MOVE 0                          TO WS-NULL-DT-IND-2       
           ELSE                                                         
              MOVE -1                         TO WS-NULL-DT-IND-2       
           END-IF.                                                      
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_BUDGET_PLAN'          TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'BP_ITEM_ID'               TO CMN-TABLE-ELEMENT-2    
              MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
              MOVE BU-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE BU-BP-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-2  
              MOVE BU-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7340-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7380-SELECT-DET-AR-CNTL.                                      *         
      * PERFORMED BY 5661-DETERMINE-DEPOSIT.                          *         
      *****************************************************************         
       7380-SELECT-DET-AR-CNTL.                                         
                                                                        
           MOVE '7380'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT AMT_AR_DAY_00       ,                              
                     AMT_AR_DAY_30       ,                              
                     AMT_AR_DAY_60       ,                              
                     AMT_AR_DAY_90       ,                              
                     AMT_TRAN_BALANCE                                   
                INTO :WS-AC-AMT-AR-DAY-00,                              
                     :WS-AC-AMT-AR-DAY-30,                              
                     :WS-AC-AMT-AR-DAY-60,                              
                     :WS-AC-AMT-AR-DAY-90,                              
                     :WS-AC-AMT-TRAN-BALANCE                            
                FROM CSS_AR_CNTL                                        
               WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO              
                 AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL       
                 AND ITEM_ID           = :WS-AC-ITEM-ID                 
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT AMT_AR_DAY_00       ,                                      
MFA-TR*              AMT_AR_DAY_30       ,                                      
MFA-TR*              AMT_AR_DAY_60       ,                                      
MFA-TR*              AMT_AR_DAY_90       ,                                      
MFA-TR*              AMT_TRAN_BALANCE                                           
MFA-TR*         INTO :WS-AC-AMT-AR-DAY-00,                                      
MFA-TR*              :WS-AC-AMT-AR-DAY-30,                                      
MFA-TR*              :WS-AC-AMT-AR-DAY-60,                                      
MFA-TR*              :WS-AC-AMT-AR-DAY-90,                                      
MFA-TR*              :WS-AC-AMT-TRAN-BALANCE                                    
MFA-TR*         FROM CSS_AR_CNTL                                                
MFA-TR*        WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO                      
MFA-TR*          AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL               
MFA-TR*          AND ITEM_ID           = :WS-AC-ITEM-ID                         
MFA-TR*      QUERYNO 7380                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7380-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7390-SELECT-DET-AR-CNTL.                                      *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES.                        *         
      *****************************************************************         
       7390-SELECT-DET-AR-CNTL.                                         
                                                                        
           MOVE '7390'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y'                                                
                INTO :WS-ROWS-FOUND                                     
                FROM CSS_AR_CNTL                                        
               WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO              
                 AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL       
                 AND ITEM_ID           > :WS-AC-ITEM-ID                 
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-ROWS-FOUND                                             
MFA-TR*         FROM CSS_AR_CNTL                                                
MFA-TR*        WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO                      
MFA-TR*          AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL               
MFA-TR*          AND ITEM_ID           > :WS-AC-ITEM-ID                         
MFA-TR*      QUERYNO 7390                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
                                      OR WS-MULTIPLE-ROWS-CALL          
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7390-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7400-SELECT-CSS-OFF-CYCL-ACCT.                                *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       7400-SELECT-CSS-OFF-CYCL-ACCT.                                   
                                                                        
           MOVE '7400'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y'                                                
                INTO :WS-ROWS-FOUND                                     
                FROM CSS_OFF_CYCL_ACCT                                  
               WHERE ACCOUNT_NO = :OC-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-ROWS-FOUND                                             
MFA-TR*         FROM CSS_OFF_CYCL_ACCT                                          
MFA-TR*        WHERE ACCOUNT_NO = :OC-ACCOUNT-NO                                
MFA-TR*      QUERYNO 7400                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_OFF_CYCL_ACCT'        TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE OC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7400-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7410-SELECT-BILL-ADDR-XREF.                                    *        
      * PERFORMED BY 5130-GET-OLD-ADDR-DETAILS.                        *        
      ******************************************************************        
       7410-SELECT-BILL-ADDR-XREF.                                      
                                                                        
           MOVE '7410'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y'                                                
                INTO :WS-BILL-ADDR-XREF-EXISTS                          
                FROM CSS_BILL_ADDR_XREF                                 
               WHERE ACCOUNT_NO = :AQ-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-BILL-ADDR-XREF-EXISTS                                  
MFA-TR*         FROM CSS_BILL_ADDR_XREF                                         
MFA-TR*        WHERE ACCOUNT_NO = :AQ-ACCOUNT-NO                                
MFA-TR*      QUERYNO 7410                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T18407                                    OR WS-MULTIPLE-ROWS-CALL      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILL_ADDR_XREF'       TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE AQ-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7410-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7420-SELECT-ADDR-FREEFORM.                                     *        
      * PERFORMED BY 5130-GET-OLD-ADDR-DETAILS                         *        
      ******************************************************************        
       7420-SELECT-ADDR-FREEFORM.                                       
                                                                        
           MOVE '7420'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y',                                               
                     ADDR_CITY_STATE,                                   
                     ADDR_COUNTRY,                                      
                     ADDR_STREET,                                       
                     ADDR_ZIP_CODE,                                     
                     ADDRESS_OVERFLOW,                                  
C35749               ADDR_STREET_2                                      
                INTO :WS-ADDR-FREEFORM-EXISTS,                          
                     :DZ-ADDR-CITY-STATE,                               
                     :DZ-ADDR-COUNTRY,                                  
                     :DZ-ADDR-STREET,                                   
                     :DZ-ADDR-ZIP-CODE,                                 
                     :DZ-ADDRESS-OVERFLOW,                              
C35749               :DZ-ADDR-STREET-2                                  
                FROM CSS_ADDR_FREEFORM                                  
               WHERE ADDRESS_ID = :DZ-ADDRESS-ID                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y',                                                       
MFA-TR*              ADDR_CITY_STATE,                                           
MFA-TR*              ADDR_COUNTRY,                                              
MFA-TR*              ADDR_STREET,                                               
MFA-TR*              ADDR_ZIP_CODE,                                             
MFA-TR*              ADDRESS_OVERFLOW,                                          
MFA-TR*              ADDR_STREET_2                                              
MFA-TR*         INTO :WS-ADDR-FREEFORM-EXISTS,                                  
MFA-TR*              :DZ-ADDR-CITY-STATE,                                       
MFA-TR*              :DZ-ADDR-COUNTRY,                                          
MFA-TR*              :DZ-ADDR-STREET,                                           
MFA-TR*              :DZ-ADDR-ZIP-CODE,                                         
MFA-TR*              :DZ-ADDRESS-OVERFLOW,                                      
MFA-TR*              :DZ-ADDR-STREET-2                                          
MFA-TR*         FROM CSS_ADDR_FREEFORM                                          
MFA-TR*        WHERE ADDRESS_ID = :DZ-ADDRESS-ID                                
MFA-TR*      QUERYNO 7420                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FREEFORM'        TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE DZ-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7420-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7430-SELECT-ADDR-FORMATTED.                                    *        
      * PERFORMED BY 5130-GET-OLD-ADDR-DETAILS.                        *        
      ******************************************************************        
       7430-SELECT-ADDR-FORMATTED.                                      
                                                                        
           MOVE '7430'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT 'Y',                                               
                     ADDR_PREFIX_1,                                     
                     ADDR_PREFIX_2,                                     
                     ADDR_SUFFIX,                                       
                     ADDRESS_OVERFLOW,                                  
                     CARRIER_ROUTE,                                     
                     HOUSE_NO,                                          
                     STREET_LOCATION_1,                                 
                     STREET_LOCATION_2,                                 
                     STREET_NAME,                                       
                     STREET_SUFFIX,                                     
                     ZIP_CODE,                                          
                     ZIP_CODE_PLUS_FOUR,                                
                     ZIP_CODE_TOKEN,                                    
T20548               USPS_DELIV_PT_CD                                   
                INTO :WS-ADDR-FORMATTED-EXISTS,                         
                     :DY-ADDR-PREFIX-1,                                 
                     :DY-ADDR-PREFIX-2,                                 
                     :DY-ADDR-SUFFIX,                                   
                     :DY-ADDRESS-OVERFLOW,                              
                     :DY-CARRIER-ROUTE,                                 
                     :DY-HOUSE-NO,                                      
                     :DY-STREET-LOCATION-1,                             
                     :DY-STREET-LOCATION-2,                             
                     :DY-STREET-NAME,                                   
                     :DY-STREET-SUFFIX,                                 
                     :DY-ZIP-CODE,                                      
                     :DY-ZIP-CODE-PLUS-FOUR,                            
                     :DY-ZIP-CODE-TOKEN,                                
T20548               :DY-USPS-DELIV-PT-CD                               
                FROM CSS_ADDR_FORMATTED                                 
               WHERE ADDRESS_ID = :DY-ADDRESS-ID                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y',                                                       
MFA-TR*              ADDR_PREFIX_1,                                             
MFA-TR*              ADDR_PREFIX_2,                                             
MFA-TR*              ADDR_SUFFIX,                                               
MFA-TR*              ADDRESS_OVERFLOW,                                          
MFA-TR*              CARRIER_ROUTE,                                             
MFA-TR*              HOUSE_NO,                                                  
MFA-TR*              STREET_LOCATION_1,                                         
MFA-TR*              STREET_LOCATION_2,                                         
MFA-TR*              STREET_NAME,                                               
MFA-TR*              STREET_SUFFIX,                                             
MFA-TR*              ZIP_CODE,                                                  
MFA-TR*              ZIP_CODE_PLUS_FOUR,                                        
MFA-TR*              ZIP_CODE_TOKEN,                                            
MFA-TR*              USPS_DELIV_PT_CD                                           
MFA-TR*         INTO :WS-ADDR-FORMATTED-EXISTS,                                 
MFA-TR*              :DY-ADDR-PREFIX-1,                                         
MFA-TR*              :DY-ADDR-PREFIX-2,                                         
MFA-TR*              :DY-ADDR-SUFFIX,                                           
MFA-TR*              :DY-ADDRESS-OVERFLOW,                                      
MFA-TR*              :DY-CARRIER-ROUTE,                                         
MFA-TR*              :DY-HOUSE-NO,                                              
MFA-TR*              :DY-STREET-LOCATION-1,                                     
MFA-TR*              :DY-STREET-LOCATION-2,                                     
MFA-TR*              :DY-STREET-NAME,                                           
MFA-TR*              :DY-STREET-SUFFIX,                                         
MFA-TR*              :DY-ZIP-CODE,                                              
MFA-TR*              :DY-ZIP-CODE-PLUS-FOUR,                                    
MFA-TR*              :DY-ZIP-CODE-TOKEN,                                        
MFA-TR*              :DY-USPS-DELIV-PT-CD                                       
MFA-TR*         FROM CSS_ADDR_FORMATTED                                         
MFA-TR*        WHERE ADDRESS_ID = :DY-ADDRESS-ID                                
MFA-TR*      QUERYNO 7430                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FORMATTED'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE DY-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7430-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7440-SELECT-COUNT-BILL-ADDR.                                   *        
      * PERFORMED BY 5130-GET-OLD-ADDR-DETAILS.                        *        
      ******************************************************************        
       7440-SELECT-COUNT-BILL-ADDR.                                     
                                                                        
           MOVE '7440'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT COUNT(*)                                           
                INTO :WS-ADDR-COUNT                                     
                FROM CSS_BILL_ADDR_XREF                                 
               WHERE ADDRESS_ID = :AQ-ADDRESS-ID                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT COUNT(*)                                                   
MFA-TR*         INTO :WS-ADDR-COUNT                                             
MFA-TR*         FROM CSS_BILL_ADDR_XREF                                         
MFA-TR*        WHERE ADDRESS_ID = :AQ-ADDRESS-ID                                
MFA-TR*      QUERYNO 7440                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILL_ADDR_XREF'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE AQ-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7440-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7450-SELECT-COUNT-NAME-ACCT.                                   *        
      * PERFORMED BY 5130-GET-OLD-ADDR-DETAILS.                        *        
      ******************************************************************        
       7450-SELECT-COUNT-NAME-ACCT.                                     
                                                                        
           MOVE '7450'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              SELECT COUNT(*)                                           
                INTO :WS-NAME-COUNT                                     
                FROM CSS_NAME_ACCT_XREF                                 
               WHERE ADDRESS_ID = :HT-ADDRESS-ID                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT COUNT(*)                                                   
MFA-TR*         INTO :WS-NAME-COUNT                                             
MFA-TR*         FROM CSS_NAME_ACCT_XREF                                         
MFA-TR*        WHERE ADDRESS_ID = :HT-ADDRESS-ID                                
MFA-TR*      QUERYNO 7450                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_NAME_ACCT_XREF'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE HT-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7450-EXIT.                                                       
           EXIT.                                                        
                                                                        
T22066******************************************************************        
T22066* 7460-SELECT-COUNT-LANDLORD.                                    *        
T22066* PERFORMED BY 5130-GET-OLD-ADDR-DETAILS.                        *        
T22066******************************************************************        
T22066 7460-SELECT-COUNT-LANDLORD.                                      
T22066                                                                  
T22066     MOVE '7460'                        TO ACTIVE-PARAGRAPH.      
T22066                                                                  
T22066     EXEC SQL                                                     
T22066        SELECT COUNT(*)                                           
T22066          INTO :WS-LANDLORD-COUNT                                 
T22066          FROM CSS_LANDLORD                                       
T22066         WHERE ADDRESS_ID = :SI-ADDRESS-ID                        
                                                            
T22066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT COUNT(*)                                                   
MFA-TR*         INTO :WS-LANDLORD-COUNT                                         
MFA-TR*         FROM CSS_LANDLORD                                               
MFA-TR*        WHERE ADDRESS_ID = :SI-ADDRESS-ID                                
MFA-TR*      QUERYNO 7460                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22066                                                                  
T22066     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22066                                                                  
T22066     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22066        NEXT SENTENCE                                             
T22066     ELSE                                                         
T22066        MOVE 'CSS_LANDLORD'             TO CMN-TABLE-1            
T22066        MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
T22066        MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T22066        MOVE HT-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
T22066        MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T22066        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22066     END-IF.                                                      
T22066                                                                  
T22066 7460-EXIT.                                                       
T22066     EXIT.                                                        
                                                                        
P00547******************************************************************        
P00547* 7470-CHECK-IAT-CATEGORY.                                       *        
P00547* PERFORMED BY 5920-IAT-WQ.                                      *        
P00547******************************************************************        
P00547 7470-CHECK-IAT-CATEGORY.                                         
P00547                                                                  
P00547     MOVE '7470'                        TO ACTIVE-PARAGRAPH.      
P00547                                                                  
P00547     EXEC SQL                                                     
P00547        SELECT TOP(1) 'Y'                                                
P00547          INTO :WS-IAT-CAT-FOUND                                  
P00547          FROM CSS_CATEGORY WITH(READUNCOMMITTED)                         
P00547         WHERE USER_ID = :WS-USER-ID                              
P00547           AND CATEGORY_ID = 327                                  
P00547                                       
P00547                                                      
P00547     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-IAT-CAT-FOUND                                          
MFA-TR*         FROM CSS_CATEGORY                                               
MFA-TR*        WHERE USER_ID = :WS-USER-ID                                      
MFA-TR*          AND CATEGORY_ID = 327                                          
MFA-TR*        FETCH FIRST ROW ONLY WITH UR                                     
MFA-TR*      QUERYNO 7470                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00547                                                                  
P00547     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
P00547                                                                  
P00547     EVALUATE WS-ACTIVE-RETURN-CODE                               
P00547        WHEN SUCCESSFUL-CALL                                      
P00547           CONTINUE                                               
P00547        WHEN NOT-FOUND                                            
P00547           MOVE 'N'                       TO WS-IAT-CAT-FOUND     
P00547        WHEN OTHER                                                
P00547           MOVE 'CSS_CATEGORY'            TO CMN-TABLE-1          
P00547           MOVE 'USER_ID'                 TO CMN-TABLE-ELEMENT-1  
P00547           MOVE WS-USER-ID                TO CMN-HOSTVAR-ELEMENT-1
P00547           PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT          
P00547     END-EVALUATE.                                                
P00547                                                                  
P00547 7470-EXIT.                                                       
P00547     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7550-GET-CUST-PLAN-INFO.                                      *         
      *****************************************************************         
       7550-GET-CUST-PLAN-INFO.                                         
                                                                        
           MOVE '7550'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DECLARE CUST_PLAN_CURSOR  CURSOR FOR                      
              SELECT CODE_SERVICE_TYPE                                  
                FROM CSS_CUST_PLAN                                      
               WHERE ACCOUNT_NO     = :CP-ACCOUNT-NO                    
                 AND CODE_UTIL_TYPE = 'U'                               
                 AND IC_NO          = :CP-IC-NO                         
                 OPTION(FAST 1)                                     
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ021
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE CUST_PLAN_CURSOR  CURSOR FOR                              
MFA-TR*       SELECT CODE_SERVICE_TYPE                                          
MFA-TR*         FROM CSS_CUST_PLAN                                              
MFA-TR*        WHERE ACCOUNT_NO     = :CP-ACCOUNT-NO                            
MFA-TR*          AND CODE_UTIL_TYPE = 'U'                                       
MFA-TR*          AND IC_NO          = :CP-IC-NO                                 
MFA-TR*          OPTIMIZE FOR 1 ROW                                             
MFA-TR*      QUERYNO 7550                                                       
MFA-TR*    END-EXEC.                                                            
           EXEC SQL                                                     
               OPEN CUST_PLAN_CURSOR                                    
           END-EXEC                                                     

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_CUST_PLAN'            TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'CODE_UTIL_TYPE'           TO CMN-TABLE-ELEMENT-2    
              MOVE 'IC_NO'                    TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
              MOVE CP-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE 'U'                        TO CMN-HOSTVAR-ELEMENT-2  
              MOVE CP-IC-NO                   TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
           EXEC SQL                                                     
               FETCH CUST_PLAN_CURSOR                                   
               INTO :CP-CODE-SERVICE-TYPE                               
           END-EXEC                                                     

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_CUST_PLAN'            TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'CODE_UTIL_TYPE'           TO CMN-TABLE-ELEMENT-2    
              MOVE 'IC_NO'                    TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
              MOVE CP-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE 'U'                        TO CMN-HOSTVAR-ELEMENT-2  
              MOVE CP-IC-NO                   TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
           EXEC SQL                                                     
               CLOSE CUST_PLAN_CURSOR                                   
           END-EXEC                                                     

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_CUST_PLAN'            TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'CODE_UTIL_TYPE'           TO CMN-TABLE-ELEMENT-2    
              MOVE 'IC_NO'                    TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
              MOVE CP-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE 'U'                        TO CMN-HOSTVAR-ELEMENT-2  
              MOVE CP-IC-NO                   TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7550-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7600-SELECT-GL.                                               *         
      * THIS PARA SELECTS GL-ACCOUNT-NO FOR THE GL-ACCOUNT-NAME       *         
      *****************************************************************         
       7600-SELECT-GL.                                                  
                                                                        
           EXEC SQL                                                     
               SELECT GL_ACCT_NO                                        
                 INTO :GO-GL-ACCT-NO                                    
                 FROM CSS_GL_ACCT_NO                                    
                WHERE COMPANY_NO   = :GO-COMPANY-NO                     
                  AND GL_ACCT_NAME = :GO-GL-ACCT-NAME                   
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT GL_ACCT_NO                                                
MFA-TR*          INTO :GO-GL-ACCT-NO                                            
MFA-TR*          FROM CSS_GL_ACCT_NO                                            
MFA-TR*         WHERE COMPANY_NO   = :GO-COMPANY-NO                             
MFA-TR*           AND GL_ACCT_NAME = :GO-GL-ACCT-NAME                           
MFA-TR*      QUERYNO 7600                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE '7600'                     TO ACTIVE-PARAGRAPH       
              MOVE 'CSS_GL_ACCT_NO'           TO CMN-TABLE-1            
              MOVE 'COMPANY_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'GL_ACCT_NAME'             TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
              MOVE GO-COMPANY-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE GO-GL-ACCT-NAME            TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7600-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7700-SELECT-BILLING-DET.                                       *        
      ******************************************************************        
       7700-SELECT-BILLING-DET.                                         
                                                                        
           EXEC SQL                                                     
              SELECT MAX(REVENUE_MONTH)                                 
                INTO :BG-REVENUE-MONTH :WS-REVENUE-MONTH-NULL            
                FROM CSS_BILLING_DET                                    
               WHERE ACCOUNT_NO = :BG-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT MAX(REVENUE_MONTH)                                         
MFA-TR*         INTO :BG-REVENUE-MONTH:WS-REVENUE-MONTH-NULL                    
MFA-TR*         FROM CSS_BILLING_DET                                            
MFA-TR*        WHERE ACCOUNT_NO = :BG-ACCOUNT-NO                                
MFA-TR*      QUERYNO 7700                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE  
                                                 RS-RETURN-CODE.        
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              IF WS-REVENUE-MONTH-NULL < 0 OR BG-REVENUE-MONTH = 0      
T20499           PERFORM 7730-READ-BILL-WINDOW   THRU 7730-EXIT         
              END-IF                                                    
           ELSE                                                         
              MOVE '7700'                     TO ACTIVE-PARAGRAPH       
              MOVE 'CSS_BILLING_DET'          TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
              MOVE BG-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       7700-EXIT.                                                       
           EXIT.                                                        
                                                                        
C37422*****************************************************************         
C37422* 7710-FIND-FACTOR-ROW.                                         *         
C37422*     FIND IF A RECCHGTAX ROW THAT WAS CREATED THROUGH          *         
C37422*     PREPAYMENT EXISTS (LAST_UPDATE_TS DATE = DATETIME_SETUP   *         
C37422*     FROM CSS_RECONNECT)                                       *         
C37422*****************************************************************         
C37422 7710-FIND-FACTOR-ROW.                                            
                                                                        
C37422     MOVE '7710'                        TO ACTIVE-PARAGRAPH.      
C37422                                                                  
C37422     EXEC SQL                                                     
C37422        SELECT TOP(1) 'Y'                                                
C37422         INTO  :WS-FCTRROW-EXIST                                  
C37422          FROM CSS_FIXED_FCTR FF WITH(READUNCOMMITTED)                    
C37422         WHERE ACCOUNT_NO       = :FF-ACCOUNT-NO                  
C37422           AND CODE_UTIL_TYPE   = 'G'                             
C37422           AND FACTOR_ID        = 'RECCHGTAX'                     
C37422           AND LAST_UPDATE_TS   = CIS.CHAR2TIMESTAMP(
                                                     :FF-LAST-UPDATE-TS
              )              
C37422                                            
C37422                                                           
                                                            
C37422     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*        INTO  :WS-FCTRROW-EXIST                                          
MFA-TR*         FROM CSS_FIXED_FCTR FF                                          
MFA-TR*        WHERE ACCOUNT_NO       = :FF-ACCOUNT-NO                          
MFA-TR*          AND CODE_UTIL_TYPE   = 'G'                                     
MFA-TR*          AND FACTOR_ID        = 'RECCHGTAX'                             
MFA-TR*          AND LAST_UPDATE_TS   = :FF-LAST-UPDATE-TS                      
MFA-TR*        FETCH FIRST 1 ROW ONLY                                           
MFA-TR*        WITH UR                                                          
MFA-TR*      QUERYNO 7710                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

C37422                                                                  
C37422     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
C37422     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
C37422        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                
C37422           MOVE 'Y'              TO WS-FCTRROW-EXIST              
C37422        ELSE                                                      
C37422           MOVE 'N'              TO WS-FCTRROW-EXIST              
C37422        END-IF                                                    
C37422     ELSE                                                         
C37422        MOVE 'CSS_FIXED_FACTOR'         TO CMN-TABLE-1            
C37422        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
C37422        MOVE 'FACTOR_ID'                TO CMN-TABLE-ELEMENT-2    
C37422        MOVE FF-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
C37422        MOVE 'RECCHGTAX'                TO CMN-HOSTVAR-ELEMENT-2  
C37422        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
C37422     END-IF.                                                      
                                                                        
C37422 7710-EXIT.                                                       
C37422     EXIT.                                                        
                                                                        
T20499*****************************************************************         
T20499* 7730-READ-BILL-WINDOW.                                          30631201
T20499*****************************************************************         
T20499 7730-READ-BILL-WINDOW.                                           
T20499                                                                  
T20499     EXEC SQL                                                     
T20499      SELECT MAX(REVENUE_MONTH)                                   
T20499       INTO  :BG-REVENUE-MONTH :WS-REVENUE-MONTH-NULL-2            
T20499       FROM CSS_BILL_WINDOW                                       
T20499       WHERE DATE_EXTRACT <= CAST(SYSDATETIMEOFFSET() AS DATE)            
T20499       AND BILL_CYCLE      = :AT-BILL-CYCLE                       
                                                            
T20499     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                     30631301
MFA-TR*     SELECT MAX(REVENUE_MONTH)                                   30631401
MFA-TR*      INTO  :BG-REVENUE-MONTH:WS-REVENUE-MONTH-NULL-2            30631501
MFA-TR*      FROM CSS_BILL_WINDOW                                       30631601
MFA-TR*      WHERE DATE_EXTRACT <= CURRENT DATE                         30631701
MFA-TR*      AND BILL_CYCLE      = :AT-BILL-CYCLE                       30631801
MFA-TR*      QUERYNO 7730                                                       
MFA-TR*    END-EXEC.                                                    30631901

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20499                                                                  
T20499     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
T20499                                                                  
T20499     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T20499         NEXT SENTENCE                                            
T20499     ELSE                                                         
T20499        MOVE '7730'                    TO ACTIVE-PARAGRAPH        
T20499        MOVE 'CSS_BILL_WINDOW'         TO CMN-TABLE-1             
T20499        MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
T20499        MOVE 'BILL_CYCLE'              TO CMN-TABLE-ELEMENT-2     
T20499        MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
T20499        MOVE AT-BILL-CYCLE             TO CMN-HOSTVAR-ELEMENT-2   
T20499        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
T20499     END-IF.                                                      
                                                                        
T20499 7730-EXIT.                                                       
T20499     EXIT.                                                        
                                                                        
      ******************************************************************        
      * 7860-SELECT-LOCOFC-FACTOR                                     *         
      *****************************************************************         
       7860-SELECT-LOCOFC-FACTOR.                                       
                                                                        
           MOVE '7860' TO ACTIVE-PARAGRAPH.                             
                                                                        
           EXEC SQL                                                     
              SELECT ELEC_REV_ALLOC_PCT                                 
                INTO :B1-ELEC-REV-ALLOC-PCT                             
                FROM CSS_LOCAL_OFFICE                                   
               WHERE COMPANY_NO   = :AT-COMPANY-NO                      
                 AND LOCAL_OFFICE = :AT-LOCAL-OFFICE                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT ELEC_REV_ALLOC_PCT                                         
MFA-TR*         INTO :B1-ELEC-REV-ALLOC-PCT                                     
MFA-TR*         FROM CSS_LOCAL_OFFICE                                           
MFA-TR*        WHERE COMPANY_NO   = :AT-COMPANY-NO                              
MFA-TR*          AND LOCAL_OFFICE = :AT-LOCAL-OFFICE                            
MFA-TR*      QUERYNO 7860                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_LOCAL_OFFICE'      TO CMN-TABLE-1               
              MOVE 'COMPANY_NO'            TO CMN-TABLE-ELEMENT-1       
              MOVE 'LOCAL_OFFICE'          TO CMN-TABLE-ELEMENT-2       
CBSI          MOVE 'SERV_ORDER_NO'         TO CMN-TABLE-ELEMENT-3       
              MOVE AT-COMPANY-NO           TO CMN-HOSTVAR-ELEMENT-1     
              MOVE AT-LOCAL-OFFICE         TO CMN-HOSTVAR-ELEMENT-2     
CBSI          MOVE CMN-SERV-ORDER-NO       TO CMN-HOSTVAR-ELEMENT-3     
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       7860-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************        
T22976* 7900-OPEN-LIGHT-CURSOR.                                                 
      ******************************************************************        
T22976 7900-OPEN-LIGHT-CURSOR.                                          
T22976                                                                  
T22976     MOVE '7900'                        TO ACTIVE-PARAGRAPH.      
T22976                                                                  
T22976     EXEC SQL                                                     
T22976        OPEN LIGHT-CURSOR                                         
T22976     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22976                                                                  
T22976     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22976                                                                  
T22976     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T22976        NEXT SENTENCE                                             
T22976     ELSE                                                         
T22976        MOVE 'CSS_BILL_CONTRACT'        TO CMN-TABLE-1            
T22976        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22976        MOVE UT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22976        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22976     END-IF.                                                      
                                                                        
T22976 7900-EXIT.                                                       
T22976     EXIT.                                                        
                                                                        
      ******************************************************************        
T22976* 7910-FETCH-LIGHT-CURSOR.                                                
      ******************************************************************        
T22976 7910-FETCH-LIGHT-CURSOR.                                         
T22976                                                                  
T22976     MOVE '7910'                        TO ACTIVE-PARAGRAPH.      
T22976                                                                  
T22976     EXEC SQL                                                     
T22976        FETCH LIGHT-CURSOR                                        
T22976         INTO :UT-IC-NO                                           
T22976     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22976                                                                  
T22976     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE  
T22976                                           WS-FETCH-SQLCODE.      
T22976                                                                  
T22976     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22976        NEXT SENTENCE                                             
T22976     ELSE                                                         
T22976        MOVE 'CSS_BILL_CONTRACT'        TO CMN-TABLE-1            
T22976        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22976        MOVE UT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22976        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22976     END-IF.                                                      
T22976                                                                  
T22976 7910-EXIT.                                                       
T22976     EXIT.                                                        
                                                                        
T22976******************************************************************        
T22976* 7920-CLOSE-LIGHT-CURSOR.                                                
T22976******************************************************************        
T22976 7920-CLOSE-LIGHT-CURSOR.                                         
T22976                                                                  
T22976     MOVE '7920'                        TO ACTIVE-PARAGRAPH.      
T22976                                                                  
T22976     EXEC SQL                                                     
T22976        CLOSE LIGHT-CURSOR                                        
T22976     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22976                                                                  
T22976     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22976                                                                  
T22976     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T22976        NEXT SENTENCE                                             
T22976     ELSE                                                         
T22976        MOVE 'CSS_BILL_CONTRACT'        TO CMN-TABLE-1            
T22976        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22976        MOVE UT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22976        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22976     END-IF.                                                      
T22976                                                                  
T22976 7920-EXIT.                                                       
T22976     EXIT.                                                        
                                                                        
T20243******************************************************************        
T20243* 7921-FETCH-ACCOUNT.                                                     
T20243* GETS THE LAST NORMAL BILL NO FROM THE CSS-ACCOUNT              *        
T20243******************************************************************        
T20243 7921-FETCH-ACCOUNT.                                              
T20243                                                                  
T20243     MOVE '7921' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        SELECT                                                    
T20243               LAST_NRML_BILL_NO                                  
T20243        INTO                                                      
T20243               :AT-LAST-NRML-BILL-NO                              
T20243        FROM                                                      
T20243               CSS_ACCOUNT                                        
T20243        WHERE                                                     
T20243               ACCOUNT_NO =  :AT-ACCOUNT-NO                       
                                                            
T20243     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT                                                            
MFA-TR*              LAST_NRML_BILL_NO                                          
MFA-TR*       INTO                                                              
MFA-TR*              :AT-LAST-NRML-BILL-NO                                      
MFA-TR*       FROM                                                              
MFA-TR*              CSS_ACCOUNT                                                
MFA-TR*       WHERE                                                             
MFA-TR*              ACCOUNT_NO =  :AT-ACCOUNT-NO                               
MFA-TR*      QUERYNO 7921                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
T20243     IF  WS-ACTIVE-RETURN-CODE EQUAL TO SUCCESSFUL-CALL           
T20243         NEXT SENTENCE                                            
T20243     ELSE                                                         
T20243         MOVE 'CSS_ACCOUNT'           TO CMN-TABLE-1              
T20243         MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1      
T20243         MOVE AT-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1    
T20243         PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT             
T20243     END-IF.                                                      
T20243                                                                  
T20243 7921-EXIT.                                                       
T20243      EXIT.                                                       
                                                                        
T20243******************************************************************        
T20243* 7922-READ-BILLING-DET.                                                  
T20243* CHECKS WHETHER A UTE OR UTG REC EXISTS IN CSS-BILLING-DET FOR  *        
T20243* THE LAST NORMAL BILL NO                                        *        
T20243******************************************************************        
T20243 7922-READ-BILLING-DET.                                           
T20243                                                                  
T20243     MOVE '7922' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        SELECT DISTINCT 'Y'                                       
T20243        INTO  :WS-ELECGAS-EXISTS                                  
T20243        FROM   CSS_BILLING_DET                                    
T20243        WHERE  ACCOUNT_NO        = :BG-ACCOUNT-NO                 
T20243        AND    BILL_NO           = :BG-BILL-NO                    
T20243        AND    CODE_UTIL_TYPE    = :BG-CODE-UTIL-TYPE             
                                                            
T20243     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT DISTINCT 'Y'                                               
MFA-TR*       INTO  :WS-ELECGAS-EXISTS                                          
MFA-TR*       FROM   CSS_BILLING_DET                                            
MFA-TR*       WHERE  ACCOUNT_NO        = :BG-ACCOUNT-NO                         
MFA-TR*       AND    BILL_NO           = :BG-BILL-NO                            
MFA-TR*       AND    CODE_UTIL_TYPE    = :BG-CODE-UTIL-TYPE                     
MFA-TR*      QUERYNO 7922                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243                                                                  
T20243     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE                        
T20243                     RS-RETURN-CODE.                              
T20243     IF  WS-ACTIVE-RETURN-CODE EQUAL  TO SUCCESSFUL-CALL          
T20243                                      OR NOT-FOUND                
T20243         NEXT SENTENCE                                            
T20243     ELSE                                                         
T20243         MOVE 'CSS_BILLING_DET'       TO CMN-TABLE-1              
T20243         MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1      
T20243         MOVE 'BILL_NO'               TO CMN-TABLE-ELEMENT-2      
T20243         MOVE 'CODE_UTIL_TYPE'        TO CMN-TABLE-ELEMENT-3      
T20243         MOVE BG-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1    
T20243         MOVE BG-BILL-NO              TO CMN-HOSTVAR-ELEMENT-2    
T20243         MOVE BG-CODE-UTIL-TYPE       TO CMN-HOSTVAR-ELEMENT-3    
T20243         PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT              
T20243     END-IF.                                                      
T20243                                                                  
T20243 7922-EXIT.                                                       
T20243      EXIT.                                                       
                                                                        
T20243******************************************************************        
T20243* CURSOR ON CSS_CUST_PLAN TO GET THE SERVICE TYPES AVAILABLE FOR *        
T20243* THE UNMETERED ACCOUNT                                          *        
T20243******************************************************************        
T20243 7924-DECLARE-CUST-PLAN.                                          
T20243                                                                  
T20243     MOVE '7924' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        DECLARE CUST-PLAN-CURSOR CURSOR FOR                       
T20243           SELECT CODE_SERVICE_TYPE                               
T20243           FROM  CSS_CUST_PLAN                                    
T20243           WHERE ACCOUNT_NO = :CP-ACCOUNT-NO                      
                                                            
T20243     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DECLARE CUST-PLAN-CURSOR CURSOR FOR                               
MFA-TR*          SELECT CODE_SERVICE_TYPE                                       
MFA-TR*          FROM  CSS_CUST_PLAN                                            
MFA-TR*          WHERE ACCOUNT_NO = :CP-ACCOUNT-NO                              
MFA-TR*      QUERYNO 7924                                                       
MFA-TR*    END-EXEC.                                                            
T20243                                                                  
T20243 7924-EXIT.                                                       
T20243      EXIT.                                                       
                                                                        
T20243******************************************************************        
T20243* 7926-OPEN-CUST-PLAN.                                                    
T20243* OPENS  CUST-PLAN-CURSOR                                        *        
T20243******************************************************************        
T20243 7926-OPEN-CUST-PLAN.                                             
T20243                                                                  
T20243     MOVE '7926' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        OPEN CUST-PLAN-CURSOR                                     
T20243     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243     MOVE  SQLCODE   TO  WS-ACTIVE-RETURN-CODE.                   
T20243     IF WS-ACTIVE-RETURN-CODE EQUAL TO SUCCESSFUL-CALL            
T20243        NEXT SENTENCE                                             
T20243     ELSE                                                         
T20243        MOVE 'CSS_CUST_PLAN'         TO CMN-TABLE-1               
T20243        MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1       
T20243        MOVE CP-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1     
T20243        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T20243     END-IF.                                                      
T20243                                                                  
T20243 7926-EXIT.                                                       
T20243      EXIT.                                                       
                                                                        
T20243******************************************************************        
T20243* 7927-FETCH-CUST-PLAN.                                                   
T20243* FETCHES THE CODE-SERVICE-TYPE FROM CSS_CUST_PLAN FOR THE       *        
T20243* UNMETERED ACCOUNT                                              *        
T20243******************************************************************        
T20243 7927-FETCH-CUST-PLAN.                                            
T20243     MOVE '7927' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        FETCH CUST-PLAN-CURSOR                                    
T20243        INTO  :CP-CODE-SERVICE-TYPE                               
T20243     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243     MOVE SQLCODE   TO  WS-ACTIVE-RETURN-CODE.                    
T20243     IF WS-ACTIVE-RETURN-CODE EQUAL TO SUCCESSFUL-CALL            
T20243        IF CP-CODE-SERVICE-TYPE = 'E'                             
T20243           SET UTE-EXISTS TO TRUE                                 
T20243        END-IF                                                    
T20243        IF CP-CODE-SERVICE-TYPE = 'G'                             
T20243           SET UTG-EXISTS TO TRUE                                 
T20243        END-IF                                                    
T20243     ELSE                                                         
T20243        IF WS-ACTIVE-RETURN-CODE EQUAL TO NOT-FOUND               
T20243           NEXT SENTENCE                                          
T20243        ELSE                                                      
T20243           MOVE 'CSS_CUST_PLAN'         TO CMN-TABLE-1            
T20243           MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1    
T20243           MOVE CP-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T20243           PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT           
T20243        END-IF                                                    
T20243     END-IF.                                                      
T20243                                                                  
T20243 7927-EXIT.                                                       
T20243     EXIT.                                                        
T20243                                                                  
T20243******************************************************************        
T20243* 7928-CLOSE-CUST-PLAN.                                                   
T20243* CLOSES THE CUST-PLAN-CURSOR                                    *        
T20243******************************************************************        
T20243 7928-CLOSE-CUST-PLAN.                                            
T20243                                                                  
T20243     MOVE '7928' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        CLOSE CUST-PLAN-CURSOR                                    
T20243     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243     MOVE  SQLCODE   TO  WS-ACTIVE-RETURN-CODE.                   
T20243     IF WS-ACTIVE-RETURN-CODE EQUAL TO SUCCESSFUL-CALL            
T20243        NEXT SENTENCE                                             
T20243     ELSE                                                         
T20243        MOVE 'CSS_CUST_PLAN'         TO CMN-TABLE-1               
T20243        MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1       
T20243        MOVE CP-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1     
T20243        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T20243     END-IF.                                                      
T20243                                                                  
T20243 7928-EXIT.                                                       
T20243       EXIT.                                                      
                                                                        
A04847******************************************************************        
A04847* 7929-SPLIT-AMT.                                                         
A04847* SPLITS AR-TRAN-BALANCE INTO UTE AND UTG                        *        
A04847******************************************************************        
A04847 7929-SPLIT-AMT.                                                  
A04847                                                                  
A04847     IF AT-ELEC-REV-ALLOC-PCT = 0                                 
A04847        MOVE AT-COMPANY-NO  TO B1-COMPANY-NO                      
A04847        MOVE AT-LOCAL-OFFICE                                      
A04847             TO B1-LOCAL-OFFICE                                   
A04847        PERFORM 7860-SELECT-LOCOFC-FACTOR THRU 7860-EXIT          
A04847        MOVE B1-ELEC-REV-ALLOC-PCT  TO                            
A04847             WS-ELEC-REV-ALLOC-PCT                                
A04847        COMPUTE WS-UTILITY-BALANCE-UTE =                          
A04847                (WS-ELEC-REV-ALLOC-PCT / 100)                     
A04847                    *  WS-AMT-POSTED                              
A04847     ELSE                                                         
A04847        MOVE AT-ELEC-REV-ALLOC-PCT  TO                            
A04847             WS-ELEC-REV-ALLOC-PCT                                
A04847        COMPUTE WS-UTILITY-BALANCE-UTE =                          
A04847               (WS-ELEC-REV-ALLOC-PCT / 100) * WS-AMT-POSTED      
A04847     END-IF.                                                      
A04847                                                                  
A04847     COMPUTE WS-UTILITY-BALANCE-UTG =                             
A04847                      WS-AMT-POSTED - WS-UTILITY-BALANCE-UTE.     
A04847                                                                  
A04847 7929-EXIT.                                                       
A04847     EXIT.                                                        
                                                                        
T20243************************************************************              
T20243* 7930-SUM-AMT-BILL-ITEM.                                  *              
T20243* SUM AMT_BILL_ITEM .                                      *              
T20243************************************************************              
T20243 7930-SUM-AMT-BILL-ITEM.                                          
T20243                                                                  
T20243     MOVE '7930' TO ACTIVE-PARAGRAPH.                             
T20243     EXEC SQL                                                     
T20243        SELECT SUM(AMT_BILL_ITEM +                                
T20243                   AMT_CITY_TAX  +                                
T20243                   AMT_OTHER_TAX +                                
T20243                   AMT_STATE_TAX )                                
T20243        INTO  :WS-AMT-POSTED :WS-AMT-POSTED-NULL                   
T20243        FROM   CSS_BILLING_DET                                    
T20243        WHERE  ACCOUNT_NO        = :BG-ACCOUNT-NO                 
T20243        AND    BILL_NO           = :BG-BILL-NO                    
T20243        AND    CODE_BILL_ITM_TYPE = 'C'                           
                                                            
T20243     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT SUM(AMT_BILL_ITEM +                                        
MFA-TR*                  AMT_CITY_TAX  +                                        
MFA-TR*                  AMT_OTHER_TAX +                                        
MFA-TR*                  AMT_STATE_TAX )                                        
MFA-TR*       INTO  :WS-AMT-POSTED:WS-AMT-POSTED-NULL                           
MFA-TR*       FROM   CSS_BILLING_DET                                            
MFA-TR*       WHERE  ACCOUNT_NO        = :BG-ACCOUNT-NO                         
MFA-TR*       AND    BILL_NO           = :BG-BILL-NO                            
MFA-TR*       AND    CODE_BILL_ITM_TYPE = 'C'                                   
MFA-TR*      QUERYNO 7930                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T20243                                                                  
T20243     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE                        
T20243                     RS-RETURN-CODE.                              
T20243     IF  WS-ACTIVE-RETURN-CODE EQUAL TO SUCCESSFUL-CALL           
T20243         IF WS-AMT-POSTED-NULL  < 0                               
T20243            MOVE 0                       TO WS-AMT-POSTED         
T20243         END-IF                                                   
T20243     ELSE                                                         
T20243         IF WS-ACTIVE-RETURN-CODE EQUAL TO NOT-FOUND              
T20243            MOVE 0                       TO WS-AMT-POSTED         
T20243         ELSE                                                     
T20243            MOVE 'CSS_BILLING_DET'       TO CMN-TABLE-1           
T20243            MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1   
T20243            MOVE 'BILL_NO'               TO CMN-TABLE-ELEMENT-2   
T20243            MOVE BG-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1 
T20243            MOVE BG-BILL-NO              TO CMN-HOSTVAR-ELEMENT-2 
T20243            PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT           
T20243         END-IF                                                   
T20243     END-IF.                                                      
T20243                                                                  
T20243 7930-EXIT.                                                       
T20243     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7940-OPEN-THD-PRTY-CURSOR.                                              
      *****************************************************************         
C32832 7940-OPEN-THD-PRTY-CURSOR.                                       
                                                                        
C32832     MOVE '7940'                TO ACTIVE-PARAGRAPH.              
                                                                        
C32832     EXEC SQL                                                     
C32832        OPEN THD-PRTY-CURSOR                                      
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE               TO WS-ACTIVE-RETURN-CODE          
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
C32832          NEXT SENTENCE                                           
C32832     ELSE                                                         
C32832           MOVE 'CSS_THD_PRTY'         TO CMN-TABLE-1             
C32832           MOVE 'ACCOUNT_NO'           TO CMN-TABLE-ELEMENT-1     
C32832           MOVE ZW-ACCOUNT-NO          TO CMN-HOSTVAR-ELEMENT-1   
C32832           PERFORM 9900-SQL-ERROR-ROUTINE     THRU 9900-EXIT      
C32832     END-IF.                                                      
                                                                        
C32832 7940-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      ****************************************************************          
      * 7950-FETCH-THD-PRTY-CURSOR.                                             
      *****************************************************************         
C32832 7950-FETCH-THD-PRTY-CURSOR.                                      
                                                                        
C32832     MOVE '7950'                        TO ACTIVE-PARAGRAPH.      
C32832     EXEC SQL                                                     
C32832      FETCH THD-PRTY-CURSOR                                       
C32832       INTO   :ZW-THD-PRTY-ID,                                    
C32832              :ZW-THD-PRTY-STATUS,                                
C32832              :ZW-DATE-INACTIVE :WS-NULL-DATE-INACTIVE,            
C32832              :ZW-DATE-NEXT-ANNIV :WS-NULL-DATE-NEXT-ANNIV         
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     IF WS-NULL-DATE-NEXT-ANNIV < 0                               
C32832        MOVE SPACES      TO ZW-DATE-NEXT-ANNIV                    
C32832     END-IF.                                                      
                                                                        
C32832     IF WS-NULL-DATE-INACTIVE  < 0                                
C32832        MOVE SPACES      TO ZW-DATE-INACTIVE                      
C32832     END-IF.                                                      
                                                                        
C32832     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE         
C32832                                      WS-FETCH-SQLCODE.           
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE  EQUAL  SUCCESSFUL-CALL             
C32832                                    OR NOT-FOUND                  
C32832           NEXT SENTENCE                                          
C32832     ELSE                                                         
C32832           MOVE 'CSS_THD_PRTY      ' TO CMN-TABLE-1               
C32832           MOVE 'ACCOUNT_NO    '    TO CMN-TABLE-ELEMENT-1        
C32832           MOVE ZW-ACCOUNT-NO       TO CMN-HOSTVAR-ELEMENT-1      
C32832           PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT         
C32832     END-IF.                                                      
                                                                        
C32832 7950-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      ****************************************************************          
      * 7960-CLOSE-THD-PRTY-CURSOR.                                             
      ****************************************************************          
C32832 7960-CLOSE-THD-PRTY-CURSOR.                                      
                                                                        
C32832     EXEC SQL                                                     
C32832       CLOSE THD-PRTY-CURSOR                                      
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
                                                                        
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE  EQUAL  SUCCESSFUL-CALL             
C32832         NEXT SENTENCE                                            
C32832     ELSE                                                         
C32832         MOVE 'CSS_THD_PRTY     '        TO CMN-TABLE-1           
C32832         MOVE 'ACCOUNT_NO    '           TO CMN-TABLE-ELEMENT-1   
C32832         MOVE ZW-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1 
C32832         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
C32832     END-IF.                                                      
                                                                        
C32832 7960-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7965-OPEN-TP-HIST-CURSOR.                                               
      *****************************************************************         
C32832 7965-OPEN-TP-HIST-CURSOR.                                        
                                                                        
C32832     MOVE '7965'                TO ACTIVE-PARAGRAPH.              
                                                                        
C32832     EXEC SQL                                                     
C32832        OPEN TP-HIST-CURSOR                                       
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE               TO WS-ACTIVE-RETURN-CODE          
C32832     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
C32832          NEXT SENTENCE                                           
C32832     ELSE                                                         
C32832           MOVE 'CSS_THD_PRTY_HIST'    TO CMN-TABLE-1             
C32832           MOVE 'THD_PRTY_ID'          TO CMN-TABLE-ELEMENT-1     
C32832           MOVE ZX-THD-PRTY-ID         TO CMN-HOSTVAR-ELEMENT-1   
C32832           PERFORM 9900-SQL-ERROR-ROUTINE     THRU 9900-EXIT      
C32832     END-IF.                                                      
                                                                        
C32832 7965-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      ****************************************************************          
      * 7970-FETCH-TP-HIST-CURSOR.                                              
      *****************************************************************         
C32832 7970-FETCH-TP-HIST-CURSOR.                                       
                                                                        
C32832     MOVE '7970'                        TO ACTIVE-PARAGRAPH.      
C32832     EXEC SQL                                                     
C32832      FETCH TP-HIST-CURSOR                                        
C32832       INTO   :ZX-DATE-TRANS,                                     
C32832              :ZX-LETTER-TYPE-CD,                                 
C32832              :ZX-LETTER-STATUS                                   
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE         
C32832                                      WS-FETCH-SQLCODE.           
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE  EQUAL  SUCCESSFUL-CALL             
C32832                                    OR NOT-FOUND                  
C32832           NEXT SENTENCE                                          
C32832     ELSE                                                         
C32832           MOVE 'CSS_THD_PRTY_HIST ' TO CMN-TABLE-1               
C32832           MOVE 'THD_PRTY_ID'       TO CMN-TABLE-ELEMENT-1        
C32832           MOVE ZX-THD-PRTY-ID      TO CMN-HOSTVAR-ELEMENT-1      
C32832           PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT         
C32832     END-IF.                                                      
                                                                        
C32832 7970-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      ****************************************************************          
      * 7975-CLOSE-TP-HIST-CURSOR.                                              
      ****************************************************************          
C32832 7975-CLOSE-TP-HIST-CURSOR.                                       
                                                                        
C32832     EXEC SQL                                                     
C32832       CLOSE TP-HIST-CURSOR                                       
C32832     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE  EQUAL  SUCCESSFUL-CALL             
C32832         NEXT SENTENCE                                            
C32832     ELSE                                                         
C32832         MOVE 'CSS_THD_PRTY_HIST'        TO CMN-TABLE-1           
C32832         MOVE 'THD_PRTY_ID   '           TO CMN-TABLE-ELEMENT-1   
C32832         MOVE ZX-THD-PRTY-ID             TO CMN-HOSTVAR-ELEMENT-1 
C32832         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
C32832     END-IF.                                                      
                                                                        
C32832 7975-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 7990-SELECT-DEP-PAY-AMT                                       *         
      *      MODULE GETS THE TOTAL PAYMENTS ON A SPECIFIED DEPOSIT    *         
      *****************************************************************         
PCR482 7990-SELECT-DEP-PAY-AMT.                                         
PCR482     EXEC SQL                                                     
PCR482        SELECT   SUM(DEP_PAY_AMT)                                 
PCR482          INTO   :WS-TOTAL-PAYMENTS :WS-TOTAL-PAYMENTS-NI          
PCR482          FROM   CSS_DEP_PAY_HST                                  
PCR482         WHERE   ACCOUNT_NO        = :DP-ACCOUNT-NO               
PCR482           AND   DEPOSIT_CERT_NO   = :DP-DEPOSIT-CERT-NO          
                                                            
PCR482     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT   SUM(DEP_PAY_AMT)                                         
MFA-TR*         INTO   :WS-TOTAL-PAYMENTS:WS-TOTAL-PAYMENTS-NI                  
MFA-TR*         FROM   CSS_DEP_PAY_HST                                          
MFA-TR*        WHERE   ACCOUNT_NO        = :DP-ACCOUNT-NO                       
MFA-TR*          AND   DEPOSIT_CERT_NO   = :DP-DEPOSIT-CERT-NO                  
MFA-TR*      QUERYNO 7990                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR482                                                                  
PCR482     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE.           
PCR482                                                                  
PCR482     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
PCR482         IF WS-TOTAL-PAYMENTS-NI < 0                              
PCR482             MOVE ZEROES      TO WS-TOTAL-PAYMENTS                
PCR482         END-IF                                                   
PCR482     ELSE                                                         
PCR482         MOVE '7990'                       TO ACTIVE-PARAGRAPH    
CBSI           MOVE 'CSS_DEP_PAY_HST'           TO CMN-TABLE-1          
CBSI           MOVE 'ACCOUNT_NO'                TO CMN-TABLE-ELEMENT-1  
CBSI           MOVE 'DEPOSIT_CERT_NO'           TO CMN-TABLE-ELEMENT-2  
CBSI           MOVE 'SERV_ORDER_NO'             TO CMN-TABLE-ELEMENT-3  
CBSI           MOVE DP-ACCOUNT-NO               TO CMN-HOSTVAR-ELEMENT-1
CBSI           MOVE DP-DEPOSIT-CERT-NO          TO CMN-HOSTVAR-ELEMENT-2
CBSI           MOVE CMN-SERV-ORDER-NO           TO CMN-HOSTVAR-ELEMENT-3
PCR482         PERFORM 9700-PROCESS-ABEND           THRU 9700-EXIT      
PCR482     END-IF.                                                      
PCR482                                                                  
PCR482 7990-EXIT.                                                       
PCR482     EXIT.                                                        
                                                                        
PCR393*****************************************************************         
T17746* 7991-OPEN-TOT-AR-CNTL.                                        *         
T17746*****************************************************************         
T17746 7991-OPEN-TOT-AR-CNTL.                                           
T17746                                                                  
T17746     MOVE '7991'                        TO ACTIVE-PARAGRAPH.      
T17746                                                                  
T17746     EXEC SQL                                                     
T17746        OPEN TOT-AR-CNTL                                          
T17746     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T17746        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T17746        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T17746        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746 7991-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 7992-FETCH-TOT-AR-CNTL.                                       *         
T17746*****************************************************************         
T17746 7992-FETCH-TOT-AR-CNTL.                                          
T17746                                                                  
T17746     MOVE '7992'                        TO ACTIVE-PARAGRAPH.      
T17746                                                                  
T17746     EXEC SQL                                                     
T17746         FETCH TOT-AR-CNTL                                        
T17746          INTO :AC-ITEM-ID      ,                                 
T17746               :AC-PYMT-PRIORITY-LVL,                             
T17746               :AC-AMT-AR-DAY-00,                                 
T17746               :AC-AMT-AR-DAY-30,                                 
T17746               :AC-AMT-AR-DAY-60,                                 
T17746               :AC-AMT-AR-DAY-90,                                 
T17746               :AC-AMT-UNUSED-CR,                                 
T17746               :AC-AMT-TRAN-BALANCE                               
T17746     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T17746        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T17746        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T17746        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746 7992-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 7993-CLOSE-TOT-AR-CNTL.                                       *         
T17746*****************************************************************         
T17746 7993-CLOSE-TOT-AR-CNTL.                                          
T17746                                                                  
CBSI       MOVE '7993'                        TO ACTIVE-PARAGRAPH.      
T17746                                                                  
T17746     EXEC SQL                                                     
CBSI           CLOSE TOT-AR-CNTL                                        
T17746     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T17746        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T17746        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
T17746        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T17746     END-IF.                                                      
T17746                                                                  
T17746 7993-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 7994-UPDATE-ACCT.                                                       
T17746*****************************************************************         
T17746 7994-UPDATE-ACCT.                                                
T17746     EXEC SQL                                                     
T17746         UPDATE CSS_ACCOUNT                                       
T17746            SET TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE         
T17746          WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO               
                                                            
T17746     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ACCOUNT                                               
MFA-TR*           SET TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE                 
MFA-TR*         WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                       
MFA-TR*      QUERYNO 7994                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE '7994'                    TO ACTIVE-PARAGRAPH        
T17746        MOVE 'CSS_ACCOUNT'             TO CMN-TABLE-1             
T17746        MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
T17746        MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
T17746        PERFORM 9700-PROCESS-ABEND     THRU 9700-EXIT             
T17746     END-IF.                                                      
                                                                        
T17746 7994-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 7995-UPDATE-AR-CNTL.                                                    
T17746*****************************************************************         
T17746 7995-UPDATE-AR-CNTL.                                             
                                                                        
T17746     EXEC SQL                                                     
T17746         UPDATE CSS_AR_CNTL                                       
T17746         SET    AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,            
T17746                AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,            
T17746                AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,            
T17746                AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90             
T17746         WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                
T17746           AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL         
T17746           AND  ITEM_ID           = :AC-ITEM-ID                   
                                                            
T17746     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_AR_CNTL                                               
MFA-TR*        SET    AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,                    
MFA-TR*               AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,                    
MFA-TR*               AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,                    
MFA-TR*               AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90                     
MFA-TR*        WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*          AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                 
MFA-TR*          AND  ITEM_ID           = :AC-ITEM-ID                           
MFA-TR*      QUERYNO 7995                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE '7995'                   TO ACTIVE-PARAGRAPH         
T17746        MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
T17746        MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
T17746        MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'ITEM_ID'                TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
T17746        MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
T17746        MOVE AC-PYMT-PRIORITY-LVL     TO CMN-HOSTVAR-ELEMENT-2    
T17746        MOVE AC-ITEM-ID               TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
T17746        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T17746     END-IF.                                                      
T17746 7995-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17746* 7996-UPDATE-DPP.                                                        
T17746*****************************************************************         
T17746 7996-UPDATE-DPP.                                                 
T17746     EXEC SQL                                                     
T17746         UPDATE CSS_AR_CNTL                                       
T17746         SET    AMT_TRAN_BALANCE  = AMT_TRAN_BALANCE +            
T17746                                    :AC-AMT-TRAN-BALANCE          
T17746         WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                
T17746           AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL         
T20025           AND  ITEM_ID           > 30000000                      
T17746           AND  ITEM_ID           < 40000000                      
                                                            
T17746     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_AR_CNTL                                               
MFA-TR*        SET    AMT_TRAN_BALANCE  = AMT_TRAN_BALANCE +                    
MFA-TR*                                   :AC-AMT-TRAN-BALANCE                  
MFA-TR*        WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*          AND  PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                 
MFA-TR*          AND  ITEM_ID           > 30000000                              
MFA-TR*          AND  ITEM_ID           < 40000000                              
MFA-TR*      QUERYNO 7996                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17746                                                                  
T17746     MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
T17746                                                                  
T17746     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T17746        NEXT SENTENCE                                             
T17746     ELSE                                                         
T17746        MOVE '7996'                   TO ACTIVE-PARAGRAPH         
T17746        MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
T17746        MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
T17746        MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'ITEM_ID'                TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
T17746        MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
T17746        MOVE AC-PYMT-PRIORITY-LVL     TO CMN-HOSTVAR-ELEMENT-2    
T17746        MOVE AC-ITEM-ID               TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
T17746        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T17746     END-IF.                                                      
T17746 7996-EXIT.                                                       
T17746     EXIT.                                                        
                                                                        
T17746*****************************************************************         
T17989* 7997-CIA-SUMM-EXISTS.                                                   
T17746*****************************************************************         
T17989 7997-CIA-SUMM-EXISTS.                                            
T17989     EXEC SQL                                                     
T17989         SELECT 'Y'                                               
T17989         INTO :WS-CIA-SUMM-FLAG                                   
T17989         FROM CSS_AR_CNTL                                         
T17989         WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                
T17989           AND  PYMT_PRIORITY_LVL = 70                            
T17989           AND  ITEM_ID           = 0                             
                                                            
T17989     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y'                                                       
MFA-TR*        INTO :WS-CIA-SUMM-FLAG                                           
MFA-TR*        FROM CSS_AR_CNTL                                                 
MFA-TR*        WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*          AND  PYMT_PRIORITY_LVL = 70                                    
MFA-TR*          AND  ITEM_ID           = 0                                     
MFA-TR*      QUERYNO 7997                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17989                                                                  
T17989     MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
T17989                                                                  
T17989     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
T17989        NEXT SENTENCE                                             
T17989     ELSE                                                         
T17989        MOVE '7997'                   TO ACTIVE-PARAGRAPH         
T17989        MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
T17989        MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
T17989        MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'ITEM_ID'                TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
T17989        MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
T17989        MOVE 70                       TO CMN-HOSTVAR-ELEMENT-2    
T17989        MOVE 0                        TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
T17989        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T17989     END-IF.                                                      
T17989 7997-EXIT.                                                       
T17989     EXIT.                                                        
                                                                        
T17989*****************************************************************         
T17989* 7998-CIA-DET1-EXISTS.                                                   
T17989*****************************************************************         
T17989 7998-CIA-DET1-EXISTS.                                            
T17989     EXEC SQL                                                     
T17989         SELECT 'Y'                                               
T17989         INTO :WS-CIA-DET1-FLAG                                   
T17989         FROM CSS_AR_CNTL                                         
T17989         WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                
T17989           AND  PYMT_PRIORITY_LVL = 70                            
T17989           AND  ITEM_ID           = 1                             
                                                            
T17989     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y'                                                       
MFA-TR*        INTO :WS-CIA-DET1-FLAG                                           
MFA-TR*        FROM CSS_AR_CNTL                                                 
MFA-TR*        WHERE  ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*          AND  PYMT_PRIORITY_LVL = 70                                    
MFA-TR*          AND  ITEM_ID           = 1                                     
MFA-TR*      QUERYNO 7998                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17989                                                                  
T17989     MOVE SQLCODE                     TO WS-ACTIVE-RETURN-CODE.   
T17989                                                                  
T17989     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
T17989        NEXT SENTENCE                                             
T17989     ELSE                                                         
T17989        MOVE '7998'                   TO ACTIVE-PARAGRAPH         
T17989        MOVE 'CSS_AR_CNTL'            TO CMN-TABLE-1              
T17989        MOVE 'ACCOUNT_NO'             TO CMN-TABLE-ELEMENT-1      
T17989        MOVE 'PYMT_PRIORITY_LVL'      TO CMN-TABLE-ELEMENT-2      
CBSI          MOVE 'ITEM_ID'                TO CMN-TABLE-ELEMENT-3      
CBSI          MOVE 'SERV_ORDER_NO'          TO CMN-TABLE-ELEMENT-4      
T17989        MOVE AC-ACCOUNT-NO            TO CMN-HOSTVAR-ELEMENT-1    
T17989        MOVE 70                       TO CMN-HOSTVAR-ELEMENT-2    
T17989        MOVE 1                        TO CMN-HOSTVAR-ELEMENT-3    
CBSI          MOVE CMN-SERV-ORDER-NO        TO CMN-HOSTVAR-ELEMENT-4    
T17989        PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT              
T17989     END-IF.                                                      
T17989 7998-EXIT.                                                       
T17989     EXIT.                                                        
                                                                        
PCR393*****************************************************************         
PCR393* 8000-UPDATE-CONTRACT.                                         *         
PCR393*****************************************************************         
PCR393 8000-UPDATE-CONTRACT.                                            
PCR393                                                                  
PCR393     MOVE '8000'                        TO ACTIVE-PARAGRAPH.      
PCR393                                                                  
PCR393     EXEC SQL                                                     
PCR393        UPDATE CSS_CONTRACT                                       
PCR393           SET CNT_STATUS_CD     = :CT-CNT-STATUS-CD    ,         
PCR393               CONTRACT_COMMENTS = :CT-CONTRACT-COMMENTS,         
PCR393               STATUS_CHANGE_DT  = IIF(TRY_CONVERT(DATE, 
                                                   :CT-STATUS-CHANGE-DT
              ) IS NULL OR (PATINDEX('%.%', :CT-STATUS-CHANGE-DT
              ) <> 0) OR (LEN(:CT-STATUS-CHANGE-DT
              ) <> 10), CIS.CHAR2DATE(:CT-STATUS-CHANGE-DT
              ), CONVERT(DATE, :CT-STATUS-CHANGE-DT) ) ,         
PCR393               LAST_UPDATE_TS    = CIS.CHAR2TIMESTAMP(
                                                     :CT-LAST-UPDATE-TS
              )             
PCR393         WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                 
PCR393           AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL          
PCR393           AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                
                                                            
PCR393     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_CONTRACT                                               
MFA-TR*          SET CNT_STATUS_CD     = :CT-CNT-STATUS-CD    ,                 
MFA-TR*              CONTRACT_COMMENTS = :CT-CONTRACT-COMMENTS,                 
MFA-TR*              STATUS_CHANGE_DT  = :CT-STATUS-CHANGE-DT ,                 
MFA-TR*              LAST_UPDATE_TS    = :CT-LAST-UPDATE-TS                     
MFA-TR*        WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL                  
MFA-TR*          AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                        
MFA-TR*      QUERYNO 8000                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

PCR393                                                                  
PCR393     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
PCR393                                                                  
PCR393     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
PCR393        NEXT SENTENCE                                             
PCR393     ELSE                                                         
PCR393        MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
PCR393        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
PCR393        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
PCR393        MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
PCR393        MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
PCR393        MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
PCR393        MOVE CT-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
PCR393        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
PCR393     END-IF.                                                      
PCR393                                                                  
PCR393 8000-EXIT.                                                       
PCR393     EXIT.                                                        
                                                                        
T21446***************************************************************** 15170000
T21446* 8050-SELECT-MAX-CNT-ITEM-ID                                   * 15180000
T21446* THIS PARA SELECTS MAXIMUM CONTRACT ITEM ID USED FOR AN ACCOUNT* 15200000
T21446***************************************************************** 15210000
T21446 8050-SELECT-MAX-CNT-ITEM-ID.                                     
                                                                        
T21446     EXEC SQL                                                     
T21446         SELECT MAX(CNT_ITEM_ID)                                  
T21446           INTO :WS-CNT-ITEM-ID :WS-NULL-IND01                     
T21446           FROM CSS_CONTRACT                                      
T21446          WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                
T21446            AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL         
                                                            
T21446     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     15250000
MFA-TR*        SELECT MAX(CNT_ITEM_ID)                                  15260000
MFA-TR*          INTO :WS-CNT-ITEM-ID:WS-NULL-IND01                     15270000
MFA-TR*          FROM CSS_CONTRACT                                      15280000
MFA-TR*         WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                15290000
MFA-TR*           AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL         15300000
MFA-TR*      QUERYNO 8050                                                       
MFA-TR*    END-EXEC.                                                    15310000

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
T21446     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T21446                                                                  
T21446     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T21446        NEXT SENTENCE                                             
T21446     ELSE                                                         
T21446        MOVE '8050'                     TO ACTIVE-PARAGRAPH       
T51726        MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
T51726        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T51726        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T51726        MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T51726        MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T21446        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T21446     END-IF.                                                      
T21446                                                                  
T21446 8050-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 17016000
T21446* 8100-INSERT-CONTRACT                                          * 17020000
T21446* INSERT THE CONTRACT RECORD INTO CSS_CONTRACT TABLE            * 17040000
T21446***************************************************************** 17050000
T21446 8100-INSERT-CONTRACT.                                            
T21446                                                                  
T21446     EXEC SQL                                                     
T21446         INSERT INTO CSS_CONTRACT                                 
T21446                (ACCOUNT_NO        ,                              
T21446                 PYMT_PRIORITY_LVL ,                              
T21446                 CNT_ITEM_ID       ,                              
T21446                 DATE_CONTRACT     ,                              
T21446                 AMT_MO_PYMT       ,                              
T21446                 DATE_PYMT_START   ,                              
T21446                 CODE_INTRST_METH  ,                              
T21446                 INTRST_RATE       ,                              
T21446                 NO_SCHED_PYMTS    ,                              
T21446                 AMT_ORIG_ENTERED  ,                              
T21446                 AMT_TAX_STATE     ,                              
T21446                 AMT_TAX_CITY      ,                              
T21446                 AMT_TAX_OTHER     ,                              
T21446                 CODE_CONTRACT_TYPE,                              
T21446                 CNT_STATUS_CD     ,                              
T21446                 CNT_NAME_CD       ,                              
T21446                 USER_ID           ,                              
T21446                 LIEN_CD           ,                              
T21446                 LAST_UPDATE_TS    ,                              
T21446                 CODE_BILL_TYPE    ,                              
T21446                 REBATE_CD         ,                              
                       CREDIT_EXEMPT_CODE,                              
T21446                 CONTRACT_COMMENTS)                               
T21446         VALUES (:CT-ACCOUNT-NO        ,                          
T21446                 :CT-PYMT-PRIORITY-LVL ,                          
T21446                 :CT-CNT-ITEM-ID       ,                          
T21446                 IIF(TRY_CONVERT(DATE, :CT-DATE-CONTRACT
              ) IS NULL OR (PATINDEX('%.%', :CT-DATE-CONTRACT
              ) <> 0) OR (LEN(:CT-DATE-CONTRACT) <> 10), CIS.CHAR2DATE(
                                                      :CT-DATE-CONTRACT
              ), CONVERT(DATE, :CT-DATE-CONTRACT) )     ,                      
T21446                 :CT-AMT-MO-PYMT       ,                          
T21446                 IIF(TRY_CONVERT(DATE, :CT-DATE-PYMT-START
              ) IS NULL OR (PATINDEX('%.%', :CT-DATE-PYMT-START
              ) <> 0) OR (LEN(:CT-DATE-PYMT-START
              ) <> 10), CIS.CHAR2DATE(:CT-DATE-PYMT-START
              ), CONVERT(DATE, :CT-DATE-PYMT-START) )   ,                      
T21446                 :CT-CODE-INTRST-METH  ,                          
T21446                 :CT-INTRST-RATE       ,                          
T21446                 :CT-NO-SCHED-PYMTS    ,                          
T21446                 :CT-AMT-ORIG-ENTERED  ,                          
T21446                 :CT-AMT-TAX-STATE     ,                          
T21446                 :CT-AMT-TAX-CITY      ,                          
T21446                 :CT-AMT-TAX-OTHER     ,                          
T21446                 :CT-CODE-CONTRACT-TYPE,                          
T21446                 :CT-CNT-STATUS-CD     ,                          
T21446                 :CT-CNT-NAME-CD       ,                          
T21446                 :CT-USER-ID           ,                          
T21446                 :CT-LIEN-CD           ,                          
T21446                 CIS.CHAR2TIMESTAMP(:WS-CURRENT-TIMESTAMP) ,              
T21446                 :CT-CODE-BILL-TYPE    ,                          
T21446                 :CT-REBATE-CD         ,                          
                       ' ',                                             
T21446                 :CT-CONTRACT-COMMENTS)                           
T21446     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                     17090000
MFA-TR*        INSERT INTO CSS_CONTRACT                                 17100000
MFA-TR*               (ACCOUNT_NO        ,                              17110000
MFA-TR*                PYMT_PRIORITY_LVL ,                              17120000
MFA-TR*                CNT_ITEM_ID       ,                              17130000
MFA-TR*                DATE_CONTRACT     ,                              17140000
MFA-TR*                AMT_MO_PYMT       ,                              17150000
MFA-TR*                DATE_PYMT_START   ,                              17160000
MFA-TR*                CODE_INTRST_METH  ,                              17170000
MFA-TR*                INTRST_RATE       ,                              17180000
MFA-TR*                NO_SCHED_PYMTS    ,                              17190000
MFA-TR*                AMT_ORIG_ENTERED  ,                              17200000
MFA-TR*                AMT_TAX_STATE     ,                              17210000
MFA-TR*                AMT_TAX_CITY      ,                              17220000
MFA-TR*                AMT_TAX_OTHER     ,                                      
MFA-TR*                CODE_CONTRACT_TYPE,                              17230000
MFA-TR*                CNT_STATUS_CD     ,                              17240000
MFA-TR*                CNT_NAME_CD       ,                              17250000
MFA-TR*                USER_ID           ,                              17260000
MFA-TR*                LIEN_CD           ,                              17270000
MFA-TR*                LAST_UPDATE_TS    ,                              17280000
MFA-TR*                CODE_BILL_TYPE    ,                              17300000
MFA-TR*                REBATE_CD         ,                              17310000
MFA-TR*                CREDIT_EXEMPT_CODE,                                      
MFA-TR*                CONTRACT_COMMENTS)                               17330000
MFA-TR*        VALUES (:CT-ACCOUNT-NO        ,                          17340000
MFA-TR*                :CT-PYMT-PRIORITY-LVL ,                          17350000
MFA-TR*                :CT-CNT-ITEM-ID       ,                          17360000
MFA-TR*                :CT-DATE-CONTRACT     ,                          17370000
MFA-TR*                :CT-AMT-MO-PYMT       ,                          17380000
MFA-TR*                :CT-DATE-PYMT-START   ,                          17390000
MFA-TR*                :CT-CODE-INTRST-METH  ,                          17400000
MFA-TR*                :CT-INTRST-RATE       ,                          17410000
MFA-TR*                :CT-NO-SCHED-PYMTS    ,                          17420000
MFA-TR*                :CT-AMT-ORIG-ENTERED  ,                          17430000
MFA-TR*                :CT-AMT-TAX-STATE     ,                          17440000
MFA-TR*                :CT-AMT-TAX-CITY      ,                          17450000
MFA-TR*                :CT-AMT-TAX-OTHER     ,                                  
MFA-TR*                :CT-CODE-CONTRACT-TYPE,                          17460000
MFA-TR*                :CT-CNT-STATUS-CD     ,                          17470000
MFA-TR*                :CT-CNT-NAME-CD       ,                          17480000
MFA-TR*                :CT-USER-ID           ,                          17490000
MFA-TR*                :CT-LIEN-CD           ,                          17500000
MFA-TR*                :WS-CURRENT-TIMESTAMP ,                          17510000
MFA-TR*                :CT-CODE-BILL-TYPE    ,                          17530000
MFA-TR*                :CT-REBATE-CD         ,                          17540000
MFA-TR*                ' ',                                                     
MFA-TR*                :CT-CONTRACT-COMMENTS)                           17560000
MFA-TR*    END-EXEC.                                                    17570000

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T21446                                                                  
T21446     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T21446                                                                  
T21446     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T21446        NEXT SENTENCE                                             
T21446     ELSE                                                         
T21446        MOVE '8100'                     TO ACTIVE-PARAGRAPH       
T21446        MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
T21446        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T21446        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T21446        MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
T21446        MOVE 'DATE_CONTRACT'            TO CMN-TABLE-ELEMENT-4    
T21446        MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T21446        MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T21446        MOVE CT-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
T21446        MOVE CT-DATE-CONTRACT           TO CMN-HOSTVAR-ELEMENT-4  
T21446        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T21446     END-IF.                                                      
T21446                                                                  
T21446 8100-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 17792000
T21446* 8125-INSERT-CNT-DETAIL                                        * 17793000
T21446***************************************************************** 17797000
T21446 8125-INSERT-CNT-DETAIL.                                          
T21446                                                                  
T21446     EXEC SQL                                                     
T21446          INSERT INTO CSS_CNT_DETAIL                              
T21446               (ACCOUNT_NO        ,                               
T21446                CNT_ITEM_ID       ,                               
T21446                CODE_SERVICE_TYPE ,                               
T21446                CHARGE_AM         ,                               
T21446                CHARGE_TYPE_CD    ,                               
T21446                COST_CENTER       ,                               
T21446                GL_ACCT_NO        ,                               
                      PYMT_PRIORITY_LVL ,                               
T21446                WRT_OFF_GL_ACCT_NO)                               
T21446         VALUES                                                   
T21446               (:EA-ACCOUNT-NO        ,                           
T21446                :EA-CNT-ITEM-ID       ,                           
T21446                :EA-CODE-SERVICE-TYPE ,                           
T21446                :EA-CHARGE-AM         ,                           
T21446                :EA-CHARGE-TYPE-CD    ,                           
T21446                :EA-COST-CENTER       ,                           
T21446                :EA-GL-ACCT-NO        ,                           
                      :EA-PYMT-PRIORITY-LVL ,                           
T21446                :EA-WRT-OFF-GL-ACCT-NO)                           
T21446     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T21446                                                                  
T21446     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T21446                                                                  
T21446     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T21446        NEXT SENTENCE                                             
T21446     ELSE                                                         
T21446        MOVE '8125'                     TO ACTIVE-PARAGRAPH       
T21446        MOVE 'CSS_CNT_DETAIL'           TO CMN-TABLE-1            
T21446        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T21446        MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-2    
T21446        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-3    
T21446        MOVE 'CODE_SERVICE_TYPE'        TO CMN-TABLE-ELEMENT-4    
T21446        MOVE EA-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T21446        MOVE EA-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-2  
              MOVE EA-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-3  
T21446        MOVE EA-CODE-SERVICE-TYPE       TO CMN-HOSTVAR-ELEMENT-4  
T21446        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T21446     END-IF.                                                      
T21446                                                                  
T21446 8125-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
T21446***************************************************************** 15870000
T21446* 8200-SELECT-CONTRACT-INFO                                     * 15880000
T21446* THIS PARA SELECTS CONTRACT-INFO DETAILS                       * 15900000
T21446***************************************************************** 15910000
T21446 8200-SELECT-CONTRACT-INFO.                                       
T21446                                                                  
T21446     EXEC SQL                                                     
T21446         SELECT GL_ACCT_NO        ,                               
T21446                COST_CENTER       ,                               
T21446                REBATE_CD         ,                               
T21446                INTEREST_CD       ,                               
T21446                DFLT_INTRST_RT    ,                               
T21446                WRT_OFF_GL_ACCT_NO                                
T21446           INTO :K6-GL-ACCT-NO        ,                           
T21446                :K6-COST-CENTER       ,                           
T21446                :K6-REBATE-CD         ,                           
T21446                :K6-INTEREST-CD       ,                           
T21446                :K6-DFLT-INTRST-RT    ,                           
T21446                :K6-WRT-OFF-GL-ACCT-NO                            
T21446           FROM CSS_CONTRACT_INFO                                 
T21446          WHERE CNT_NAME_CD = :K6-CNT-NAME-CD                     
                                                            
T21446     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     15950000
MFA-TR*        SELECT GL_ACCT_NO        ,                               15970000
MFA-TR*               COST_CENTER       ,                               15980000
MFA-TR*               REBATE_CD         ,                               15990000
MFA-TR*               INTEREST_CD       ,                               15991000
MFA-TR*               DFLT_INTRST_RT    ,                               15992000
MFA-TR*               WRT_OFF_GL_ACCT_NO                                15998000
MFA-TR*          INTO :K6-GL-ACCT-NO        ,                           16010000
MFA-TR*               :K6-COST-CENTER       ,                           16020000
MFA-TR*               :K6-REBATE-CD         ,                           16030000
MFA-TR*               :K6-INTEREST-CD       ,                           16031000
MFA-TR*               :K6-DFLT-INTRST-RT    ,                           16032000
MFA-TR*               :K6-WRT-OFF-GL-ACCT-NO                            16038000
MFA-TR*          FROM CSS_CONTRACT_INFO                                 16040000
MFA-TR*         WHERE CNT_NAME_CD = :K6-CNT-NAME-CD                     16050000
MFA-TR*      QUERYNO 8200                                                       
MFA-TR*    END-EXEC.                                                    16070000

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T21446                                                                  
T21446     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T21446                                                                  
T21446     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T21446        NEXT SENTENCE                                             
T21446     ELSE                                                         
T21446        MOVE '8200'                     TO ACTIVE-PARAGRAPH       
T21446        MOVE 'CSS_CONTRACT_INFO'        TO CMN-TABLE-1            
T21446        MOVE 'CNT_NAME_CD'              TO CMN-TABLE-ELEMENT-1    
T21446        MOVE K6-CNT-NAME-CD             TO CMN-HOSTVAR-ELEMENT-1  
T21446        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T21446     END-IF.                                                      
T21446                                                                  
T21446 8200-EXIT.                                                       
T21446     EXIT.                                                        
                                                                        
      *****************************************************************         
T22976* 8250-UPDATE-CONTRACT.                                                   
      *****************************************************************         
T22976 8250-UPDATE-CONTRACT.                                            
T22976                                                                  
T22976     MOVE '8250'                        TO ACTIVE-PARAGRAPH.      
T22976                                                                  
T22976     EXEC SQL                                                     
T22976        UPDATE CSS_BILL_CONTRACT                                  
T22976           SET CNTRCT_END_DT     = IIF(TRY_CONVERT(DATE, 
                                                      :WS-DATE-COMPLETE
              ) IS NULL OR (PATINDEX('%.%', :WS-DATE-COMPLETE
              ) <> 0) OR (LEN(:WS-DATE-COMPLETE) <> 10), CIS.CHAR2DATE(
                                                      :WS-DATE-COMPLETE
              ), CONVERT(DATE, :WS-DATE-COMPLETE) )              
T22976         WHERE ACCOUNT_NO        = :AT-ACCOUNT-NO                 
T22976           AND CODE_UTIL_TYPE    = 'U'                            
T22976           AND IC_NO             = :UT-IC-NO                      
T22976           AND CNTRCT_END_DT     > IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )               
                                                            
T22976     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_BILL_CONTRACT                                          
MFA-TR*          SET CNTRCT_END_DT     = :WS-DATE-COMPLETE                      
MFA-TR*        WHERE ACCOUNT_NO        = :AT-ACCOUNT-NO                         
MFA-TR*          AND CODE_UTIL_TYPE    = 'U'                                    
MFA-TR*          AND IC_NO             = :UT-IC-NO                              
MFA-TR*          AND CNTRCT_END_DT     > :WS-CURRENT-DATE                       
MFA-TR*      QUERYNO 8250                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22976                                                                  
T22976     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22976                                                                  
T22976     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22976        NEXT SENTENCE                                             
T22976     ELSE                                                         
T22976        MOVE 'CSS_BILL_CONTRACT'        TO CMN-TABLE-1            
T22976        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22976        MOVE 'IC_NO'                    TO CMN-TABLE-ELEMENT-3    
T22976        MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22976        MOVE UT-IC-NO                   TO CMN-HOSTVAR-ELEMENT-2  
T22976        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22976     END-IF.                                                      
T22976                                                                  
T22976 8250-EXIT.                                                       
T22976     EXIT.                                                        
                                                                        
P00307******************************************************************        
P00307* 8300-DELETE-ACCT-ATTRIBUTE.                                    *        
P00307******************************************************************        
P00307 8300-DELETE-ACCT-ATTRIBUTE.                                      
P00307                                                                  
P00307     MOVE '8300'                        TO ACTIVE-PARAGRAPH.      
P00307                                                                  
P00307     EXEC SQL                                                     
P00307         DELETE FROM CSS_ACCT_ATTRIBUTE                           
P00307          WHERE ACCOUNT_NO     = :YP-ACCOUNT-NO                   
P00307            AND ATTRIBUTE_DESC = 'BBP_REVIEW_EXEMPT'              
P00307                                                      
P00307     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DELETE FROM CSS_ACCT_ATTRIBUTE                                   
MFA-TR*         WHERE ACCOUNT_NO     = :YP-ACCOUNT-NO                           
MFA-TR*           AND ATTRIBUTE_DESC = 'BBP_REVIEW_EXEMPT'                      
MFA-TR*       QUERYNO 8300                                                      
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00307                                                                  
P00307     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
P00307                                                                  
P00307     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00307        NEXT SENTENCE                                             
P00307     ELSE                                                         
P00307        MOVE 'CSS_ACCT_ATTRIBUTE'      TO CMN-TABLE-1             
P00307        MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
P00307        MOVE YP-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
P00307        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
P00307     END-IF.                                                      
P00307                                                                  
P00307 8300-EXIT.                                                       
P00307     EXIT.                                                        
P00307*                                                                         
      *****************************************************************         
      * 8305-JRNL-ACCT-STAT-CHG.                                      *         
      *****************************************************************         
       8305-JRNL-ACCT-STAT-CHG.                                         
                                                                        
           MOVE 'F'                       TO MH-CODE-TRAN-TYPE.         
           MOVE WS-ACCOUNT-NO             TO MH-ACCOUNT-NO.             
A37666     MOVE ZEROES                    TO MH-CUSTOMER-NO.            
A37666     MOVE ZEROES                    TO MH-PREMISE-NO.             
           MOVE WS-USER-ID                TO MH-USER-ID.                
           MOVE PF-RESP-AREA-ID           TO MH-RESP-AREA-ID.           
           MOVE PROGRAM-NAME              TO MH-APPL-PROGRAM-ID.        
           MOVE SPACES                    TO MH-TRAN-COMMENT-TEXT.      
           MOVE 0                         TO MH-TRAN-COMMENT-LEN.       
           MOVE WS-TODAYS-DATE            TO MH-DATE-TRANS.             
           MOVE AT-LAST-UPDATE-TS         TO MH-TRANS-HIST-SEQ-NO       
                                             MI-TRANS-HIST-SEQ-NO.      
           MOVE 0                         TO MI-TRAN-APPL-NO.           
                                                                        
           ADD +1                         TO MI-TRAN-APPL-NO.           
           MOVE +1                        TO MI-CHG-COLUMN-VALUE-LEN    
                                             MI-PRV-COLUMN-VALUE-LEN.   
           MOVE 'B'                       TO MI-CHG-COLUMN-VALUE-TEXT.  
           MOVE AT-CODE-ACCT-STAT         TO MI-PRV-COLUMN-VALUE-TEXT.  
           MOVE 'CODE ACCT STAT'          TO MI-COLUMN-DESC.            
           MOVE '67'                      TO MI-TABLE-ID.               
                                                                        
           PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT.            
                                                                        
           MOVE SPACES                    TO MI-TABLE-ID.               
                                                                        
           MOVE 'Y'                       TO WS-ACCT-CHG-JRNL-DONE.     
                                                                        
       8305-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8310-UPDATE-CSS-ACCOUNT.                                      *         
      * PERFORMED BY 5000-UPDATE                                      *         
      *              5601-USE-CREDIT-BALANCES                         *         
      *              5661-DETERMINE-DEPOSIT.                          *         
      *****************************************************************         
       8310-UPDATE-CSS-ACCOUNT.                                         
                                                                        
           MOVE '8310'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_ACCOUNT                                        
                 SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT,       
                     CODE_BILL_PEND     = :AT-CODE-BILL-PEND    ,       
                     CODE_ACCT_STAT     = :WS-B                 ,       
                     TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE  ,       
                     LAST_UPDATE_TS     = CIS.CHAR2TIMESTAMP(
                                                     :AT-LAST-UPDATE-TS
              )    ,       
                     ADDRESS_ID         = :AT-ADDRESS-ID        ,       
                     ADDRESS_FORMAT     = :AT-ADDRESS-FORMAT    ,       
                     DATE_LAST_ACTION   = IIF(TRY_CONVERT(DATE, 
                                                   :AT-DATE-LAST-ACTION
              ) IS NULL OR (PATINDEX('%.%', :AT-DATE-LAST-ACTION
              ) <> 0) OR (LEN(:AT-DATE-LAST-ACTION
              ) <> 10), CIS.CHAR2DATE(:AT-DATE-LAST-ACTION
              ), CONVERT(DATE, :AT-DATE-LAST-ACTION) )  ,       
                     CODE_TEMP_BILL     = :AT-CODE-TEMP-BILL    ,       
                     CODE_P_BILL_DEST   = :AT-CODE-P-BILL-DEST  ,       
C29238               CODE_PERM_BILL     = :AT-CODE-PERM-BILL            
               WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_ACCOUNT                                                
MFA-TR*          SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT,               
MFA-TR*              CODE_BILL_PEND     = :AT-CODE-BILL-PEND    ,               
MFA-TR*              CODE_ACCT_STAT     = :WS-B                 ,               
MFA-TR*              TOTAL_AR_BALANCE   = :AT-TOTAL-AR-BALANCE  ,               
MFA-TR*              LAST_UPDATE_TS     = :AT-LAST-UPDATE-TS    ,               
MFA-TR*              ADDRESS_ID         = :AT-ADDRESS-ID        ,               
MFA-TR*              ADDRESS_FORMAT     = :AT-ADDRESS-FORMAT    ,               
MFA-TR*              DATE_LAST_ACTION   = :AT-DATE-LAST-ACTION  ,               
MFA-TR*              CODE_TEMP_BILL     = :AT-CODE-TEMP-BILL    ,               
MFA-TR*              CODE_P_BILL_DEST   = :AT-CODE-P-BILL-DEST  ,               
MFA-TR*              CODE_PERM_BILL     = :AT-CODE-PERM-BILL                    
MFA-TR*        WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                        
MFA-TR*      QUERYNO 8310                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ACCOUNT'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'DATE_LAST_ACTION'         TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'CODE_TEMP_BILL'           TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE AT-DATE-LAST-ACTION        TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE AT-CODE-TEMP-BILL          TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8310-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8311-UPDATE-AT-CODES.                                         *         
      *****************************************************************         
       8311-UPDATE-AT-CODES.                                            
                                                                        
           MOVE '8311'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_ACCOUNT                                        
                 SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT        
               WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_ACCOUNT                                                
MFA-TR*          SET CODES_DATA_PRESENT = :AT-CODES-DATA-PRESENT                
MFA-TR*        WHERE ACCOUNT_NO         = :AT-ACCOUNT-NO                        
MFA-TR*      QUERYNO 8311                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_ACCOUNT'              TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
              MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8311-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8330-UPDATE-BILL-ADDR-XREF.                                   *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8330-UPDATE-BILL-ADDR-XREF.                                      
                                                                        
           MOVE '8330'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_BILL_ADDR_XREF                                 
                 SET ADDRESS_ID = :AQ-ADDRESS-ID                        
               WHERE ACCOUNT_NO = :AQ-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_BILL_ADDR_XREF                                         
MFA-TR*          SET ADDRESS_ID = :AQ-ADDRESS-ID                                
MFA-TR*        WHERE ACCOUNT_NO = :AQ-ACCOUNT-NO                                
MFA-TR*      QUERYNO 8330                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILL_ADDR_XREF'       TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
T5172         MOVE AQ-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE AQ-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8330-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8350-UPDATE-CSS-DFA-ACCT.                                     *         
      * PERFORMED BY 5651-PROCESS-DFA-BILL.                           *         
      *****************************************************************         
       8350-UPDATE-CSS-DFA-ACCT.                                        
                                                                        
           MOVE '8350'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_DFA_ACCT                                       
                 SET AMT_MO_PYMT       = :DA-AMT-MO-PYMT,               
                     LAST_UPDATE_TS    = CIS.CHAR2TIMESTAMP(
                                                     :DA-LAST-UPDATE-TS
              )             
               WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL          
                 AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_DFA_ACCT                                               
MFA-TR*          SET AMT_MO_PYMT       = :DA-AMT-MO-PYMT,                       
MFA-TR*              LAST_UPDATE_TS    = :DA-LAST-UPDATE-TS                     
MFA-TR*        WHERE ACCOUNT_NO        = :DA-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :DA-PYMT-PRIORITY-LVL                  
MFA-TR*          AND DFA_ITEM_ID       = :DA-DFA-ITEM-ID                        
MFA-TR*      QUERYNO 8350                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DFA_ACCT'             TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'DFA_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE DA-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE DA-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE DA-DFA-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8350-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8360-UPDATE-CSS-CONTRACT.                                     *         
      * PERFORMED BY 5652-PROCESS-CNT-BILL.                           *         
      *****************************************************************         
       8360-UPDATE-CSS-CONTRACT.                                        
                                                                        
           MOVE '8360'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_CONTRACT                                       
                 SET AMT_MO_PYMT       = :CT-AMT-MO-PYMT     ,          
                     INTRST_PRIOR_YR   = :CT-INTRST-PRIOR-YR ,          
                     LAST_UPDATE_TS    = CIS.CHAR2TIMESTAMP(
                                                     :CT-LAST-UPDATE-TS
              )  ,          
                     USER_ID           = :CT-USER-ID         ,          
                     STATUS_CHANGE_DT  = IIF(TRY_CONVERT(DATE, 
                                                   :CT-STATUS-CHANGE-DT
              ) IS NULL OR (PATINDEX('%.%', :CT-STATUS-CHANGE-DT
              ) <> 0) OR (LEN(:CT-STATUS-CHANGE-DT
              ) <> 10), CIS.CHAR2DATE(:CT-STATUS-CHANGE-DT
              ), CONVERT(DATE, :CT-STATUS-CHANGE-DT) ),          
                     AMT_DEF_INTEREST  = :CT-AMT-DEF-INTEREST,          
T16187               CNT_STATUS_CD     = :CT-CNT-STATUS-CD,             
T19105               DATE_PYMT_START   = IIF(TRY_CONVERT(DATE, 
                                                    :CT-DATE-PYMT-START
              ) IS NULL OR (PATINDEX('%.%', :CT-DATE-PYMT-START
              ) <> 0) OR (LEN(:CT-DATE-PYMT-START
              ) <> 10), CIS.CHAR2DATE(:CT-DATE-PYMT-START
              ), CONVERT(DATE, :CT-DATE-PYMT-START) )            
               WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL          
                 AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_CONTRACT                                               
MFA-TR*          SET AMT_MO_PYMT       = :CT-AMT-MO-PYMT     ,                  
MFA-TR*              INTRST_PRIOR_YR   = :CT-INTRST-PRIOR-YR ,                  
MFA-TR*              LAST_UPDATE_TS    = :CT-LAST-UPDATE-TS  ,                  
MFA-TR*              USER_ID           = :CT-USER-ID         ,                  
MFA-TR*              STATUS_CHANGE_DT  = :CT-STATUS-CHANGE-DT,                  
MFA-TR*              AMT_DEF_INTEREST  = :CT-AMT-DEF-INTEREST,                  
MFA-TR*              CNT_STATUS_CD     = :CT-CNT-STATUS-CD,                     
MFA-TR*              DATE_PYMT_START   = :CT-DATE-PYMT-START                    
MFA-TR*        WHERE ACCOUNT_NO        = :CT-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :CT-PYMT-PRIORITY-LVL                  
MFA-TR*          AND CNT_ITEM_ID       = :CT-CNT-ITEM-ID                        
MFA-TR*      QUERYNO 8360                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_CONTRACT'             TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'CNT_ITEM_ID'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE CT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE CT-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE CT-CNT-ITEM-ID             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8360-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8380-UPDATE-CSS-DEP-ON-HAND.                                  *         
      * PERFORMED BY 5665-UPDATE-DEPOSIT-RECORDS.                     *         
      *****************************************************************         
       8380-UPDATE-CSS-DEP-ON-HAND.                                     
                                                                        
           MOVE '8380'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_DEP_ON_HAND                                    
                 SET DATE_INTST_CALC_TO                                 
                        = IIF(TRY_CONVERT(DATE, :DO-DATE-INTST-CALC-TO 
                                                :WS-NULL-DT-IND-7
              ) IS NULL OR (PATINDEX('%.%', :DO-DATE-INTST-CALC-TO 
                                                      :WS-NULL-DT-IND-7
              ) <> 0) OR (LEN(:DO-DATE-INTST-CALC-TO :WS-NULL-DT-IND-7
              ) <> 10), CIS.CHAR2DATE(:DO-DATE-INTST-CALC-TO 
                                                      :WS-NULL-DT-IND-7
              ), CONVERT(DATE, :DO-DATE-INTST-CALC-TO :WS-NULL-DT-IND-7
              ) ),      
                     INTRST_YTD         = :DO-INTRST-YTD        ,       
                     TOTAL_INTRST       = :DO-TOTAL-INTRST      ,       
c28160*              CODE_REFUND_ELIG   = :DO-CODE-REFUND-ELIG  ,               
                     CODE_REFUND_STATUS = :DO-CODE-REFUND-STATUS,       
                     EMPL_HOLD_INIT     = :DO-EMPL-HOLD-INIT    ,       
                     DATE_REFUNDED                                      
                        = IIF(TRY_CONVERT(DATE, :DO-DATE-REFUNDED 
                                                :WS-NULL-DT-IND-8
              ) IS NULL OR (PATINDEX('%.%', :DO-DATE-REFUNDED 
                                                      :WS-NULL-DT-IND-8
              ) <> 0) OR (LEN(:DO-DATE-REFUNDED :WS-NULL-DT-IND-8
              ) <> 10), CIS.CHAR2DATE(:DO-DATE-REFUNDED 
                                                      :WS-NULL-DT-IND-8
              ), CONVERT(DATE, :DO-DATE-REFUNDED :WS-NULL-DT-IND-8) ),         
                     AMT_REFUNDED       = :WS-AMT-REFUNDED      ,       
                     AMT_DEPOSIT        = :WS-AMT-DEPOSIT       ,       
                     CODE_REFUND_REASON = :DO-CODE-REFUND-REASON,       
                     CODE_REFUND_TYPE   = :DO-CODE-REFUND-TYPE  ,       
                     CODE_REFUND_FROM   = :DO-CODE-REFUND-FROM  ,       
                     DEPOSIT_STATUS_CD  = :DO-DEPOSIT-STATUS-CD         
               WHERE ACCOUNT_NO         = :DO-ACCOUNT-NO                
                 AND DEPOSIT_CERT_NO    = :DO-DEPOSIT-CERT-NO           
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_DEP_ON_HAND                                            
MFA-TR*          SET DATE_INTST_CALC_TO                                         
MFA-TR*                 = :DO-DATE-INTST-CALC-TO:WS-NULL-DT-IND-7,              
MFA-TR*              INTRST_YTD         = :DO-INTRST-YTD        ,               
MFA-TR*              TOTAL_INTRST       = :DO-TOTAL-INTRST      ,               
MFA-TR*              CODE_REFUND_ELIG   = :DO-CODE-REFUND-ELIG  ,               
MFA-TR*              CODE_REFUND_STATUS = :DO-CODE-REFUND-STATUS,               
MFA-TR*              EMPL_HOLD_INIT     = :DO-EMPL-HOLD-INIT    ,               
MFA-TR*              DATE_REFUNDED                                              
MFA-TR*                 = :DO-DATE-REFUNDED:WS-NULL-DT-IND-8,                   
MFA-TR*              AMT_REFUNDED       = :WS-AMT-REFUNDED      ,               
MFA-TR*              AMT_DEPOSIT        = :WS-AMT-DEPOSIT       ,               
MFA-TR*              CODE_REFUND_REASON = :DO-CODE-REFUND-REASON,               
MFA-TR*              CODE_REFUND_TYPE   = :DO-CODE-REFUND-TYPE  ,               
MFA-TR*              CODE_REFUND_FROM   = :DO-CODE-REFUND-FROM  ,               
MFA-TR*              DEPOSIT_STATUS_CD  = :DO-DEPOSIT-STATUS-CD                 
MFA-TR*        WHERE ACCOUNT_NO         = :DO-ACCOUNT-NO                        
MFA-TR*          AND DEPOSIT_CERT_NO    = :DO-DEPOSIT-CERT-NO                   
MFA-TR*      QUERYNO 8380                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_DEP_ON_HAND'          TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'DEPOSIT_CERT_NO'          TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'DATE_INTST_CALC_TO'       TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE DO-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE DO-DEPOSIT-CERT-NO         TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE DO-DATE-INTST-CALC-TO      TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8380-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8400-UPDATE-CSS-BILLING-HDR.                                  *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       8400-UPDATE-CSS-BILLING-HDR.                                     
                                                                        
           MOVE '8400'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_BILLING_HDR                                    
                 SET CODE_BILL_STATUS = :BI-CODE-BILL-STATUS,           
                     CODE_BILL_TYPE   = :BI-CODE-BILL-TYPE              
               WHERE ACCOUNT_NO       = :BI-ACCOUNT-NO                  
                 AND BILL_NO          = :BI-BILL-NO                     
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_BILLING_HDR                                            
MFA-TR*          SET CODE_BILL_STATUS = :BI-CODE-BILL-STATUS,                   
MFA-TR*              CODE_BILL_TYPE   = :BI-CODE-BILL-TYPE                      
MFA-TR*        WHERE ACCOUNT_NO       = :BI-ACCOUNT-NO                          
MFA-TR*          AND BILL_NO          = :BI-BILL-NO                             
MFA-TR*      QUERYNO 8400                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_HDR'          TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'CODE_BILL_STATUS'         TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE BI-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE BI-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE BI-CODE-BILL-STATUS        TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8400-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8420-UPDATE-CSS-BILLING-DET.                                  *         
      * PERFORMED BY 5610-CHECK-FOR-CNSMPTN-HIST.                     *         
      *****************************************************************         
       8420-UPDATE-CSS-BILLING-DET.                                     
                                                                        
           MOVE '8420'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_BILLING_DET                                    
T19626*          SET CODE_BILL_ITM_IND = :BG-CODE-BILL-ITM-IND,                 
T19715           SET BTU_FACTOR        = :BG-BTU-FACTOR                 
               WHERE CURRENT OF CSS-BILLING-DET                         
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_DET'          TO CMN-TABLE-1            
CBSI  *       MOVE 'CODE_BILL_ITM_IND'        TO CMN-TABLE-ELEMENT-1            
T19715        MOVE 'BTU_FACTOR'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
CBSI  *       MOVE BG-CODE-BILL-ITM-IND       TO CMN-HOSTVAR-ELEMENT-1          
T19715        MOVE CMN-BTU-FACTOR             TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8420-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8440-UPDATE-SUMM-AR-CNTL.                                     *         
      * PERFORMED BY 5666-PAY-DEP-DET-FM                              *         
      *              5682-FM-TO-WRITE-OFF-EXTRA.                      *         
      *****************************************************************         
       8440-UPDATE-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '8440'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_AR_CNTL                                        
                 SET AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,             
                     AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,             
                     AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,             
                     AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90,             
                     AMT_UNUSED_CR     = :AC-AMT-UNUSED-CR,             
                     TOT_SUMM_UNBILLED = :AC-TOT-SUMM-UNBILLED          
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                 AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_AR_CNTL                                                
MFA-TR*          SET AMT_AR_DAY_00     = :AC-AMT-AR-DAY-00,                     
MFA-TR*              AMT_AR_DAY_30     = :AC-AMT-AR-DAY-30,                     
MFA-TR*              AMT_AR_DAY_60     = :AC-AMT-AR-DAY-60,                     
MFA-TR*              AMT_AR_DAY_90     = :AC-AMT-AR-DAY-90,                     
MFA-TR*              AMT_UNUSED_CR     = :AC-AMT-UNUSED-CR,                     
MFA-TR*              TOT_SUMM_UNBILLED = :AC-TOT-SUMM-UNBILLED                  
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 8440                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8440-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8450-UPDATE-DET-AR-CNTL.                                      *         
      * PERFORMED BY 5652-PROCESS-CNT-BILL.                           *         
      *****************************************************************         
       8450-UPDATE-DET-AR-CNTL.                                         
                                                                        
           MOVE '8450'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_AR_CNTL                                        
                 SET AMT_AR_DAY_00     = :WS-AC-AMT-AR-DAY-00   ,       
                     AMT_AR_DAY_30     = :WS-AC-AMT-AR-DAY-30   ,       
                     AMT_AR_DAY_60     = :WS-AC-AMT-AR-DAY-60   ,       
                     AMT_AR_DAY_90     = :WS-AC-AMT-AR-DAY-90   ,       
                     AMT_TRAN_BALANCE  = :WS-AC-AMT-TRAN-BALANCE        
               WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO              
                 AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL       
                 AND ITEM_ID           = :WS-AC-ITEM-ID                 
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_AR_CNTL                                                
MFA-TR*          SET AMT_AR_DAY_00     = :WS-AC-AMT-AR-DAY-00   ,               
MFA-TR*              AMT_AR_DAY_30     = :WS-AC-AMT-AR-DAY-30   ,               
MFA-TR*              AMT_AR_DAY_60     = :WS-AC-AMT-AR-DAY-60   ,               
MFA-TR*              AMT_AR_DAY_90     = :WS-AC-AMT-AR-DAY-90   ,               
MFA-TR*              AMT_TRAN_BALANCE  = :WS-AC-AMT-TRAN-BALANCE                
MFA-TR*        WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO                      
MFA-TR*          AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL               
MFA-TR*          AND ITEM_ID           = :WS-AC-ITEM-ID                         
MFA-TR*      QUERYNO 8450                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8450-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8460-UPDATE-CSS-OFF-CYCL-ACCT.                                *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       8460-UPDATE-CSS-OFF-CYCL-ACCT.                                   
                                                                        
           MOVE '8460'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_OFF_CYCL_ACCT                                  
                 SET CREDIT_LETTER_IND  = :OC-CREDIT-LETTER-IND,        
                     LAST_UPDATE_TS     = CIS.CHAR2TIMESTAMP(
                                                     :OC-LAST-UPDATE-TS
              )            
               WHERE ACCOUNT_NO         = :OC-ACCOUNT-NO                
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_OFF_CYCL_ACCT                                          
MFA-TR*          SET CREDIT_LETTER_IND  = :OC-CREDIT-LETTER-IND,                
MFA-TR*              LAST_UPDATE_TS     = :OC-LAST-UPDATE-TS                    
MFA-TR*        WHERE ACCOUNT_NO         = :OC-ACCOUNT-NO                        
MFA-TR*      QUERYNO 8460                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_OFF_CYCL_ACCT'        TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'CREDIT_LETTER_IND'        TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'LAST_UPDATE_TS'           TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE OC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE OC-CREDIT-LETTER-IND       TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE OC-LAST-UPDATE-TS          TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8460-EXIT.                                                       
           EXIT.                                                        
                                                                        
T17989*****************************************************************         
T17989* 8470-UPDATE-CIA.                                              *         
T17989*****************************************************************         
T17989 8470-UPDATE-CIA.                                                 
T17989                                                                  
T17989     MOVE '8470'                        TO ACTIVE-PARAGRAPH.      
T17989                                                                  
T17989     EXEC SQL                                                     
T17989        UPDATE CSS_AR_CNTL                                        
T17989           SET AMT_UNUSED_CR     = AMT_UNUSED_CR                  
                                         + :AC-AMT-UNUSED-CR,           
T17989               AMT_TRAN_BALANCE  = AMT_TRAN_BALANCE               
T17989                                   + :AC-AMT-TRAN-BALANCE         
T17989         WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
T17989           AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
T17989           AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
T17989     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_AR_CNTL                                                
MFA-TR*          SET AMT_UNUSED_CR     = AMT_UNUSED_CR                          
MFA-TR*                                  + :AC-AMT-UNUSED-CR,                   
MFA-TR*              AMT_TRAN_BALANCE  = AMT_TRAN_BALANCE                       
MFA-TR*                                  + :AC-AMT-TRAN-BALANCE                 
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 8470                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17989                                                                  
T17989     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T17989                                                                  
T17989     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T17989        NEXT SENTENCE                                             
T17989     ELSE                                                         
T17989        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T17989        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T17989        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T17989        MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T17989        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T17989        MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T17989        MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
T17989        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T17989     END-IF.                                                      
T17989 8470-EXIT.                                                       
T17989     EXIT.                                                        
                                                                        
C32671*****************************************************************         
C32671* 8480-UPDATE-PJS.                                              *         
C32671*****************************************************************         
C32671 8480-UPDATE-PJS.                                                 
C32671                                                                  
C32671     MOVE '8480'                        TO ACTIVE-PARAGRAPH.      
C32671                                                                  
C32671     EXEC SQL                                                     
C32671        UPDATE CSS_PROJ_SHARE                                     
C32671           SET SHARE_STATUS_CD   = 'I'                            
C32671              ,ACCT_TERM_DT      = CAST(SYSDATETIMEOFFSET() 
           AS DATE)                   
C32671         WHERE ACCOUNT_NO        = :PJ-ACCOUNT-NO                 
C32671           AND SHARE_STATUS_CD  <> 'I'                            
                                                            
C32671     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_PROJ_SHARE                                             
MFA-TR*          SET SHARE_STATUS_CD   = 'I'                                    
MFA-TR*             ,ACCT_TERM_DT      = CURRENT DATE                           
MFA-TR*        WHERE ACCOUNT_NO        = :PJ-ACCOUNT-NO                         
MFA-TR*          AND SHARE_STATUS_CD  <> 'I'                                    
MFA-TR*      QUERYNO 8480                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

C32671                                                                  
C32671     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
C32671                                                                  
C32671     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
C32671        NEXT SENTENCE                                             
C32671     ELSE                                                         
C32671        MOVE 'CSS_PROJ_SHARE'           TO CMN-TABLE-1            
C32671        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
C32671        MOVE PJ-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
C32671        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
C32671     END-IF.                                                      
C32671 8480-EXIT.                                                       
C32671     EXIT.                                                        
                                                                        
A00581*****************************************************************         
A00581* 8490-UPDATE-MED-CERT.                                         *         
A00581*****************************************************************         
A00581 8490-UPDATE-MED-CERT.                                            
A00581                                                                  
A00581     MOVE '8490'                        TO ACTIVE-PARAGRAPH.      
A00581                                                                  
A00581     EXEC SQL                                                     
A00581        UPDATE CSS_CUST_ALERT                                     
A00581           SET DATE_EXPIRE       = IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )               
A00581         WHERE ACCOUNT_NO        = :AT-ACCOUNT-NO                 
A00581           AND DATE_EXPIRE       > IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )               
A00581                                                      
A00581     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_CUST_ALERT                                             
MFA-TR*          SET DATE_EXPIRE       = :WS-CURRENT-DATE                       
MFA-TR*        WHERE ACCOUNT_NO        = :AT-ACCOUNT-NO                         
MFA-TR*          AND DATE_EXPIRE       > :WS-CURRENT-DATE                       
MFA-TR*      QUERYNO 8490                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

A00581                                                                  
A00581     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
A00581                                                                  
A00581     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
A00581        NEXT SENTENCE                                             
A00581     ELSE                                                         
A00581        MOVE 'CSS_CUST_ALERT'           TO CMN-TABLE-1            
A00581        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
A00581        MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
A00581        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
A00581     END-IF.                                                      
A00581 8490-EXIT.                                                       
A00581     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8500-INSERT-SUMM-AR-CNTL.                                     *         
      *****************************************************************         
       8500-INSERT-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '8500'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_AR_CNTL                                   
                     (ACCOUNT_NO           ,                            
                      PYMT_PRIORITY_LVL    ,                            
                      ITEM_ID              ,                            
                      AMT_AR_DAY_00        ,                            
                      AMT_AR_DAY_30        ,                            
                      AMT_AR_DAY_60        ,                            
                      AMT_AR_DAY_90        ,                            
                      AMT_UNUSED_CR        ,                            
                      TOT_SUMM_UNBILLED    ,                            
                      AMT_TRAN_BALANCE     ,                            
                      LAST_UPDATE_TS)                                   
              VALUES (:AC-ACCOUNT-NO       ,                            
                      :AC-PYMT-PRIORITY-LVL,                            
                      :AC-ITEM-ID          ,                            
                      :AC-AMT-AR-DAY-00    ,                            
                      :AC-AMT-AR-DAY-30    ,                            
                      :AC-AMT-AR-DAY-60    ,                            
                      :AC-AMT-AR-DAY-90    ,                            
                      :AC-AMT-UNUSED-CR    ,                            
                      :AC-TOT-SUMM-UNBILLED,                            
                      :AC-AMT-TRAN-BALANCE  ,                           
                      CIS.CHAR2TIMESTAMP(:AC-LAST-UPDATE-TS))                   
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       INSERT INTO CSS_AR_CNTL                                           
MFA-TR*              (ACCOUNT_NO           ,                                    
MFA-TR*               PYMT_PRIORITY_LVL    ,                                    
MFA-TR*               ITEM_ID              ,                                    
MFA-TR*               AMT_AR_DAY_00        ,                                    
MFA-TR*               AMT_AR_DAY_30        ,                                    
MFA-TR*               AMT_AR_DAY_60        ,                                    
MFA-TR*               AMT_AR_DAY_90        ,                                    
MFA-TR*               AMT_UNUSED_CR        ,                                    
MFA-TR*               TOT_SUMM_UNBILLED    ,                                    
MFA-TR*               AMT_TRAN_BALANCE     ,                                    
MFA-TR*               LAST_UPDATE_TS)                                           
MFA-TR*       VALUES (:AC-ACCOUNT-NO       ,                                    
MFA-TR*               :AC-PYMT-PRIORITY-LVL,                                    
MFA-TR*               :AC-ITEM-ID          ,                                    
MFA-TR*               :AC-AMT-AR-DAY-00    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-30    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-60    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-90    ,                                    
MFA-TR*               :AC-AMT-UNUSED-CR    ,                                    
MFA-TR*               :AC-TOT-SUMM-UNBILLED,                                    
MFA-TR*               :AC-AMT-TRAN-BALANCE  ,                                   
MFA-TR*               :AC-LAST-UPDATE-TS)                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8500-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8510-INSERT-CSS-OFF-CYCL-ACCT.                                *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       8510-INSERT-CSS-OFF-CYCL-ACCT.                                   
                                                                        
           MOVE '8510'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_OFF_CYCL_ACCT                             
                     (ACCOUNT_NO        ,                               
                      CODE_BILL_OFF_CYCL,                               
                      CUSTOMER_NO       ,                               
                      ITEM_ID           ,                               
                      CREDIT_LETTER_IND ,                               
                      LAST_UPDATE_TS)                                   
              VALUES (:OC-ACCOUNT-NO        ,                           
                      :OC-CODE-BILL-OFF-CYCL,                           
                      :OC-CUSTOMER-NO       ,                           
                      :OC-ITEM-ID           ,                           
                      :OC-CREDIT-LETTER-IND ,                           
                      CIS.CHAR2TIMESTAMP(:OC-LAST-UPDATE-TS))                   
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       INSERT INTO CSS_OFF_CYCL_ACCT                                     
MFA-TR*              (ACCOUNT_NO        ,                                       
MFA-TR*               CODE_BILL_OFF_CYCL,                                       
MFA-TR*               CUSTOMER_NO       ,                                       
MFA-TR*               ITEM_ID           ,                                       
MFA-TR*               CREDIT_LETTER_IND ,                                       
MFA-TR*               LAST_UPDATE_TS)                                           
MFA-TR*       VALUES (:OC-ACCOUNT-NO        ,                                   
MFA-TR*               :OC-CODE-BILL-OFF-CYCL,                                   
MFA-TR*               :OC-CUSTOMER-NO       ,                                   
MFA-TR*               :OC-ITEM-ID           ,                                   
MFA-TR*               :OC-CREDIT-LETTER-IND ,                                   
MFA-TR*               :OC-LAST-UPDATE-TS)                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_OFF_CYCL_ACCT'        TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'CODE_BILL_OFF_CYCL'       TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'CUSTOMER_NO'              TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE OC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE OC-CODE-BILL-OFF-CYCL      TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE OC-CUSTOMER-NO             TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8510-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8520-INSERT-CSS-BUDGET-HIST.                                  *         
      *****************************************************************         
       8520-INSERT-CSS-BUDGET-HIST.                                     
                                                                        
           MOVE '8520'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_BUDGET_HIST                               
                     (ACCOUNT_NO        ,                               
                      AMT_MO_PYMT       ,                               
                      BALANCE_FORWARD   ,                               
                      BUD_HIST_SEQ_NO   ,                               
                      CHANGE_REASON     ,                               
                      DATE_PYMT_STRT    ,                               
                      EPP_ESTIMATE      ,                               
                      ITEM_ID           ,                               
                      LAST_UPDATE_TS    ,                               
                      METHOD_OF_ESTIMATE,                               
                      PYMT_PRIORITY_LVL ,                               
                      EPP_MTHS_RMNG_QT  ,                               
                      REMARKS           ,                               
                      UTILITY_BALANCE)                                  
              VALUES (:BH-ACCOUNT-NO        ,                           
                      :BH-AMT-MO-PYMT       ,                           
                      :BH-BALANCE-FORWARD   ,                           
                      CIS.CHAR2TIMESTAMP(:BH-BUD-HIST-SEQ-NO)   ,               
                      :BH-CHANGE-REASON     ,                           
                      IIF(TRY_CONVERT(DATE, :BH-DATE-PYMT-STRT 
                                            :WS-NULL-DT-IND-1
              ) IS NULL OR (PATINDEX('%.%', :BH-DATE-PYMT-STRT 
                                                      :WS-NULL-DT-IND-1
              ) <> 0) OR (LEN(:BH-DATE-PYMT-STRT :WS-NULL-DT-IND-1
              ) <> 10), CIS.CHAR2DATE(:BH-DATE-PYMT-STRT 
                                                      :WS-NULL-DT-IND-1
              ), CONVERT(DATE, :BH-DATE-PYMT-STRT :WS-NULL-DT-IND-1) ),        
                      :BH-EPP-ESTIMATE      ,                           
                      :BH-ITEM-ID           ,                           
                      CIS.CHAR2TIMESTAMP(:BH-LAST-UPDATE-TS)    ,               
                      :BH-METHOD-OF-ESTIMATE,                           
                      :BH-PYMT-PRIORITY-LVL ,                           
                      :BH-EPP-MTHS-RMNG-QT  ,                           
                      :BH-REMARKS           ,                           
                      :BH-UTILITY-BALANCE)                              
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       INSERT INTO CSS_BUDGET_HIST                                       
MFA-TR*              (ACCOUNT_NO        ,                                       
MFA-TR*               AMT_MO_PYMT       ,                                       
MFA-TR*               BALANCE_FORWARD   ,                                       
MFA-TR*               BUD_HIST_SEQ_NO   ,                                       
MFA-TR*               CHANGE_REASON     ,                                       
MFA-TR*               DATE_PYMT_STRT    ,                                       
MFA-TR*               EPP_ESTIMATE      ,                                       
MFA-TR*               ITEM_ID           ,                                       
MFA-TR*               LAST_UPDATE_TS    ,                                       
MFA-TR*               METHOD_OF_ESTIMATE,                                       
MFA-TR*               PYMT_PRIORITY_LVL ,                                       
MFA-TR*               EPP_MTHS_RMNG_QT  ,                                       
MFA-TR*               REMARKS           ,                                       
MFA-TR*               UTILITY_BALANCE)                                          
MFA-TR*       VALUES (:BH-ACCOUNT-NO        ,                                   
MFA-TR*               :BH-AMT-MO-PYMT       ,                                   
MFA-TR*               :BH-BALANCE-FORWARD   ,                                   
MFA-TR*               :BH-BUD-HIST-SEQ-NO   ,                                   
MFA-TR*               :BH-CHANGE-REASON     ,                                   
MFA-TR*               :BH-DATE-PYMT-STRT:WS-NULL-DT-IND-1,                      
MFA-TR*               :BH-EPP-ESTIMATE      ,                                   
MFA-TR*               :BH-ITEM-ID           ,                                   
MFA-TR*               :BH-LAST-UPDATE-TS    ,                                   
MFA-TR*               :BH-METHOD-OF-ESTIMATE,                                   
MFA-TR*               :BH-PYMT-PRIORITY-LVL ,                                   
MFA-TR*               :BH-EPP-MTHS-RMNG-QT  ,                                   
MFA-TR*               :BH-REMARKS           ,                                   
MFA-TR*               :BH-UTILITY-BALANCE)                                      
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
CBSI          MOVE 'CSS_BUDGET_HIST'          TO CMN-TABLE-1            
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'DATE_PYMT_STRT'           TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
CBSI          MOVE BH-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE BH-DATE-PYMT-STRT          TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE BH-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8520-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8530-INSERT-ADDR-FORMATTED.                                   *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8530-INSERT-ADDR-FORMATTED.                                      
                                                                        
           MOVE '8530'                        TO ACTIVE-PARAGRAPH.      
                                                                        
C35749     MOVE 'Y' TO WS-FORMATTED-ADDED.                              
C35749     MOVE WS-NEW-ADDR-ID-COMP TO WS-ADDR-ID-ADDED.                
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_ADDR_FORMATTED                            
                         (ADDRESS_ID,                                   
                          HOUSE_NO,                                     
                          ADDR_PREFIX_1,                                
                          ADDR_PREFIX_2,                                
                          STREET_NAME,                                  
                          STREET_SUFFIX,                                
                          STREET_LOCATION_1,                            
                          STREET_LOCATION_2,                            
                          ADDRESS_OVERFLOW,                             
                          ZIP_CODE,                                     
                          ZIP_CODE_PLUS_FOUR,                           
                          ZIP_CODE_TOKEN,                               
                          ADDR_SUFFIX,                                  
                          CARRIER_ROUTE,                                
                          ADDR_USAGE_CD,                                
                          USPS_DELIV_PT_CD)                             
                  VALUES (:WS-NEW-ADDR-ID-COMP,                         
                          :WS-HOUSE-NO,                                 
                          :WS-ADDR-PREFIX-1,                            
                          :WS-ADDR-PREFIX-2,                            
                          :WS-STREET-NAME,                              
                          :WS-STREET-SUFFIX,                            
                          :WS-STREET-LOCATION-1,                        
                          :WS-STREET-LOCATION-2,                        
                          :WS-ADDRESS-OVERFLOW,                         
                          :WS-ZIP-CODE,                                 
                          :WS-ZIP-CODE-PLUS-FOUR,                       
                          :WS-ZIP-CODE-TOKEN,                           
                          :WS-ADDR-SUFFIX,                              
                          :WS-CARRIER-ROUTE,                            
                          :WS-F,                                        
                          :WS-USPS-DEL-POINT)                           
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FORMATTED'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'HOUSE_NO'                 TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ZIP_CODE'                 TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-NEW-ADDR-ID-COMP        TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE WS-HOUSE-NO                TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE WS-ZIP-CODE                TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8530-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8540-INSERT-BILL-ADDR-XREF.                                   *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8540-INSERT-BILL-ADDR-XREF.                                      
                                                                        
           MOVE '8540'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
                DELETE FROM CSS_BILL_ADDR_XREF                          
                 WHERE ACCOUNT_NO = :AQ-ACCOUNT-NO                      
                   AND COMPANY_NO = :AQ-COMPANY-NO                      
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_BILL_ADDR_XREF'       TO CMN-TABLE-1            
              MOVE 'COMPANY_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-2    
              MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
              MOVE AQ-COMPANY-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE AQ-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-2  
              MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_BILL_ADDR_XREF                            
                         (ADDRESS_ID,                                   
                          NAME_ID,                                      
                          COMPANY_NO,                                   
                          ACCOUNT_NO)                                   
                  VALUES (:AQ-ADDRESS-ID,                               
                          :AQ-NAME-ID,                                  
                          :AQ-COMPANY-NO,                               
                          :AQ-ACCOUNT-NO)                               
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILL_ADDR_XREF'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'COMPANY_NO'               TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AQ-ADDRESS-ID              TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE AQ-COMPANY-NO              TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE AQ-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8540-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8550-INSERT-ADDR-FREEFORM.                                    *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8550-INSERT-ADDR-FREEFORM.                                       
                                                                        
           MOVE '8550'                        TO ACTIVE-PARAGRAPH.      
                                                                        
C35749     MOVE 'Y' TO WS-FREEFORM-ADDED.                               
C35749     MOVE WS-NEW-ADDR-ID-COMP TO WS-ADDR-ID-ADDED.                
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_ADDR_FREEFORM                             
                         (ADDRESS_ID,                                   
                          ADDR_STREET,                                  
                          ADDR_CITY_STATE,                              
                          ADDR_ZIP_CODE,                                
                          ADDR_COUNTRY,                                 
                          ADDRESS_OVERFLOW,                             
C35749                    ADDR_STREET_2)                                
                  VALUES (:WS-NEW-ADDR-ID-COMP,                         
                          :WS-ADDR-ST,                                  
                          :WS-FINAL-BILL-CY-ST,                         
                          :WS-ADDR-ZIP-CODE,                            
                          :WS-ADDR-COUNTRY,                             
                          :WS-FINAL-BILL-OVFL,                          
C35749                    :WS-ADDR-ST-2)                                
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FREEFORM'        TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'ADDR_STREET'              TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'ADDR_ZIP_CODE'            TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-NEW-ADDR-ID-COMP        TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE WS-ADDR-ST                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE WS-ADDR-ZIP-CODE           TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8550-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8560-UPDATE-THD-PRTY                                          *         
      *****************************************************************         
C32832 8560-UPDATE-THD-PRTY.                                            
                                                                        
C32832     MOVE '8560'             TO ACTIVE-PARAGRAPH.                 
                                                                        
C32832     EXEC SQL                                                     
C32832       UPDATE CSS_THD_PRTY                                        
C32832         SET THD_PRTY_STATUS = 'I',                               
C32832             DATE_INACTIVE   = IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) ),                  
C32832             DATE_NEXT_ANNIV = IIF(TRY_CONVERT(DATE, 
                                                   :ZW-DATE-NEXT-ANNIV 
                                               :WS-NULL-DATE-NEXT-ANNIV
              ) IS NULL OR (PATINDEX('%.%', :ZW-DATE-NEXT-ANNIV 
                                               :WS-NULL-DATE-NEXT-ANNIV
              ) <> 0) OR (LEN(:ZW-DATE-NEXT-ANNIV 
                                               :WS-NULL-DATE-NEXT-ANNIV
              ) <> 10), CIS.CHAR2DATE(:ZW-DATE-NEXT-ANNIV 
                                               :WS-NULL-DATE-NEXT-ANNIV
              ), CONVERT(DATE, :ZW-DATE-NEXT-ANNIV 
                                               :WS-NULL-DATE-NEXT-ANNIV
              ) )           
C32832         WHERE ACCOUNT_NO = :ZW-ACCOUNT-NO                        
C32832           AND THD_PRTY_ID  = :ZW-THD-PRTY-ID                     
                                                            
C32832     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*      UPDATE CSS_THD_PRTY                                                
MFA-TR*        SET THD_PRTY_STATUS = 'I',                                       
MFA-TR*            DATE_INACTIVE   = :WS-CURRENT-DATE,                          
MFA-TR*            DATE_NEXT_ANNIV = :ZW-DATE-NEXT-ANNIV                        
MFA-TR*                              :WS-NULL-DATE-NEXT-ANNIV                   
MFA-TR*        WHERE ACCOUNT_NO = :ZW-ACCOUNT-NO                                
MFA-TR*          AND THD_PRTY_ID  = :ZW-THD-PRTY-ID                             
MFA-TR*      QUERYNO 8560                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE.           
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
C32832         NEXT SENTENCE                                            
C32832     ELSE                                                         
C32832         MOVE 'CSS_THD_PRTY'             TO CMN-TABLE-1           
C32832         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1   
C32832         MOVE 'THD_PRTY_ID'              TO CMN-TABLE-ELEMENT-2   
C32832         MOVE 'THD_PRTY_STATUS'          TO CMN-TABLE-ELEMENT-3   
C32832         MOVE ZW-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1 
C32832         MOVE ZW-THD-PRTY-ID             TO CMN-HOSTVAR-ELEMENT-2 
C32832         MOVE ZW-THD-PRTY-STATUS         TO CMN-HOSTVAR-ELEMENT-3 
C32832         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
C32832     END-IF.                                                      
                                                                        
C32832 8560-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8570-UPDATE-THD-PRTY-HIST                                     *         
      *****************************************************************         
C32832 8570-UPDATE-THD-PRTY-HIST.                                       
                                                                        
                                                                        
C32832     MOVE '8570'             TO ACTIVE-PARAGRAPH.                 
                                                                        
C32832     EXEC SQL                                                     
C32832       UPDATE CSS_THD_PRTY_HIST                                   
C32832         SET LETTER_STATUS = 'N'                                  
C32832         WHERE THD_PRTY_ID = :ZX-THD-PRTY-ID                      
C32832            AND DATE_TRANS = CIS.CHAR2TIMESTAMP(:ZX-DATE-TRANS)           
C32832            AND LETTER_STATUS = 'P'                               
                                                            
C32832     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*      UPDATE CSS_THD_PRTY_HIST                                           
MFA-TR*        SET LETTER_STATUS = 'N'                                          
MFA-TR*        WHERE THD_PRTY_ID = :ZX-THD-PRTY-ID                              
MFA-TR*           AND DATE_TRANS = :ZX-DATE-TRANS                               
MFA-TR*           AND LETTER_STATUS = 'P'                                       
MFA-TR*      QUERYNO 8570                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE.           
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
C32832         NEXT SENTENCE                                            
C32832     ELSE                                                         
C32832         MOVE 'CSS_THD_PRTY_HIST'        TO CMN-TABLE-1           
C32832         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1   
C32832         MOVE 'THD_PRTY_ID'              TO CMN-TABLE-ELEMENT-2   
C32832         MOVE ZW-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1 
C32832         MOVE ZX-THD-PRTY-ID             TO CMN-HOSTVAR-ELEMENT-2 
C32832         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
C32832     END-IF.                                                      
                                                                        
C32832 8570-EXIT.                                                       
C32832     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8580-INSERT-THD-PRTY-HIST.                                    *         
      *****************************************************************         
C32832 8580-INSERT-THD-PRTY-HIST.                                       
                                                                        
C32832     MOVE '8580'             TO ACTIVE-PARAGRAPH.                 
                                                                        
C32832     EXEC SQL                                                     
C32832       INSERT INTO CSS_THD_PRTY_HIST                              
C32832                 (THD_PRTY_ID,                                    
C32832                  DATE_TRANS,                                     
C32832                  LETTER_TYPE_CD,                                 
C32832                  LETTER_STATUS,                                  
C32832                  DATE_MAILED,                                    
C32832                  USER_ID)                                        
C32832           VALUES (:ZX-THD-PRTY-ID,                               
C32832                   CIS.CHAR2TIMESTAMP(:ZX-DATE-TRANS),                    
C32832                   :ZX-LETTER-TYPE-CD,                            
C32832                   :ZX-LETTER-STATUS,                             
C32832                   IIF(TRY_CONVERT(DATE, :ZX-DATE-MAILED 
                                               :WS-NULL-DATE-MAILED
              ) IS NULL OR (PATINDEX('%.%', :ZX-DATE-MAILED 
                                                   :WS-NULL-DATE-MAILED
              ) <> 0) OR (LEN(:ZX-DATE-MAILED :WS-NULL-DATE-MAILED
              ) <> 10), CIS.CHAR2DATE(:ZX-DATE-MAILED 
                                                   :WS-NULL-DATE-MAILED
              ), CONVERT(DATE, :ZX-DATE-MAILED :WS-NULL-DATE-MAILED) ),        
C32832                   :ZX-USER-ID)                                   
C32832     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*      INSERT INTO CSS_THD_PRTY_HIST                                      
MFA-TR*                (THD_PRTY_ID,                                            
MFA-TR*                 DATE_TRANS,                                             
MFA-TR*                 LETTER_TYPE_CD,                                         
MFA-TR*                 LETTER_STATUS,                                          
MFA-TR*                 DATE_MAILED,                                            
MFA-TR*                 USER_ID)                                                
MFA-TR*          VALUES (:ZX-THD-PRTY-ID,                                       
MFA-TR*                  :ZX-DATE-TRANS,                                        
MFA-TR*                  :ZX-LETTER-TYPE-CD,                                    
MFA-TR*                  :ZX-LETTER-STATUS,                                     
MFA-TR*                  :ZX-DATE-MAILED:WS-NULL-DATE-MAILED,                   
MFA-TR*                  :ZX-USER-ID)                                           
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
C32832     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE.           
                                                                        
C32832     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
C32832         NEXT SENTENCE                                            
C32832     ELSE                                                         
C32832         MOVE 'CSS_THD_PRTY_HIST'        TO CMN-TABLE-1           
C32832         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1   
C32832         MOVE 'THD_PRTY_ID'              TO CMN-TABLE-ELEMENT-2   
C32832         MOVE ZW-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1 
C32832         MOVE ZX-THD-PRTY-ID             TO CMN-HOSTVAR-ELEMENT-2 
C32832         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
C32832     END-IF.                                                      
                                                                        
C32832 8580-EXIT.                                                       
C32832     EXIT.                                                        
      *****************************************************************         
      * 8600-INSERT-SUMM-AR-CNTL.                                     *         
      *****************************************************************         
       8600-INSERT-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '8600'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_AR_CNTL                                   
                     (ACCOUNT_NO           ,                            
                      PYMT_PRIORITY_LVL    ,                            
                      ITEM_ID              ,                            
                      AMT_AR_DAY_00        ,                            
                      AMT_AR_DAY_30        ,                            
                      AMT_AR_DAY_60        ,                            
                      AMT_AR_DAY_90        ,                            
                      AMT_UNUSED_CR        ,                            
                      TOT_SUMM_UNBILLED    ,                            
                      AMT_TRAN_BALANCE     ,                            
                      LAST_UPDATE_TS)                                   
              VALUES (:AC-ACCOUNT-NO       ,                            
                      :AC-PYMT-PRIORITY-LVL,                            
                      :AC-ITEM-ID          ,                            
                      :AC-AMT-AR-DAY-00    ,                            
                      :AC-AMT-AR-DAY-30    ,                            
                      :AC-AMT-AR-DAY-60    ,                            
                      :AC-AMT-AR-DAY-90    ,                            
                      :AC-AMT-UNUSED-CR    ,                            
                      :AC-TOT-SUMM-UNBILLED,                            
                      :AC-AMT-TRAN-BALANCE  ,                           
                      CIS.CHAR2TIMESTAMP(:AC-LAST-UPDATE-TS))                   
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       INSERT INTO CSS_AR_CNTL                                           
MFA-TR*              (ACCOUNT_NO           ,                                    
MFA-TR*               PYMT_PRIORITY_LVL    ,                                    
MFA-TR*               ITEM_ID              ,                                    
MFA-TR*               AMT_AR_DAY_00        ,                                    
MFA-TR*               AMT_AR_DAY_30        ,                                    
MFA-TR*               AMT_AR_DAY_60        ,                                    
MFA-TR*               AMT_AR_DAY_90        ,                                    
MFA-TR*               AMT_UNUSED_CR        ,                                    
MFA-TR*               TOT_SUMM_UNBILLED    ,                                    
MFA-TR*               AMT_TRAN_BALANCE     ,                                    
MFA-TR*               LAST_UPDATE_TS)                                           
MFA-TR*       VALUES (:AC-ACCOUNT-NO       ,                                    
MFA-TR*               :AC-PYMT-PRIORITY-LVL,                                    
MFA-TR*               :AC-ITEM-ID          ,                                    
MFA-TR*               :AC-AMT-AR-DAY-00    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-30    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-60    ,                                    
MFA-TR*               :AC-AMT-AR-DAY-90    ,                                    
MFA-TR*               :AC-AMT-UNUSED-CR    ,                                    
MFA-TR*               :AC-TOT-SUMM-UNBILLED,                                    
MFA-TR*               :AC-AMT-TRAN-BALANCE  ,                                   
MFA-TR*               :AC-LAST-UPDATE-TS)                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
              MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
              MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
              MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
              MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
              MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
              MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8600-EXIT.                                                       
           EXIT.                                                        
                                                                        
T17984******************************************************************        
T17984* 8700-SEARCH-FOR-RCC.                                           *        
T17984*     CHECK TO SEE IF THERE IS A RCC FOR THIS ACCOUNT.           *        
T17984******************************************************************        
T17984 8700-SEARCH-FOR-RCC.                                             
T17984                                                                  
T17984     MOVE '8700'                        TO ACTIVE-PARAGRAPH.      
T17984                                                                  
T17984     EXEC SQL                                                     
T17984         SELECT 'Y',                                              
C37422                DATETIME_SETUP                                    
T17984           INTO :WS-RCC-FOUND,                                    
C37422                :WS-DATETIME-SETUP                                
T17984           FROM CSS_RECONNECT                                     
T17984          WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                       
                                                            
T17984     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y',                                                      
MFA-TR*               DATETIME_SETUP                                            
MFA-TR*          INTO :WS-RCC-FOUND,                                            
MFA-TR*               :WS-DATETIME-SETUP                                        
MFA-TR*          FROM CSS_RECONNECT                                             
MFA-TR*         WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                               
MFA-TR*      QUERYNO 8700                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17984                                                                  
T17984     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
T17984                                                                  
T17984     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T17984        NEXT SENTENCE                                             
T17984     ELSE                                                         
T17984        MOVE 'CSS_RECONNECT'           TO CMN-TABLE-1             
T17984        MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
T17984        MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
T17984        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
T17984     END-IF.                                                      
T17984                                                                  
T17984 8700-EXIT.                                                       
T17984     EXIT.                                                        
T17984                                                                  
T17984******************************************************************        
T17984* 8710-DELETE-RCC.                                               *        
T17984*     DELETE THE RECONNECT ROW FROM THE CSS_RECONNECT TABLE FOR  *        
T17984*     THE GIVEN ACCOUNT.                                         *        
T17984******************************************************************        
T17984 8710-DELETE-RCC.                                                 
T17984                                                                  
T17984     MOVE '8710'                        TO ACTIVE-PARAGRAPH.      
T17984                                                                  
T17984     EXEC SQL                                                     
T17984         DELETE FROM CSS_RECONNECT                                
T17984          WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                       
                                                            
T17984     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DELETE FROM CSS_RECONNECT                                        
MFA-TR*         WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                               
MFA-TR*      QUERYNO 8710                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T17984                                                                  
T17984     MOVE SQLCODE                      TO WS-ACTIVE-RETURN-CODE.  
T17984                                                                  
T17984     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T17984        NEXT SENTENCE                                             
T17984     ELSE                                                         
T5172         MOVE 'CSS_RECONNECT'           TO CMN-TABLE-1             
T5172         MOVE 'ACCOUNT_NO'              TO CMN-TABLE-ELEMENT-1     
CBSI          MOVE 'SERV_ORDER_NO'           TO CMN-TABLE-ELEMENT-2     
T5172         MOVE AT-ACCOUNT-NO             TO CMN-HOSTVAR-ELEMENT-1   
CBSI          MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-2   
T17984        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
T17984     END-IF.                                                      
T17984                                                                  
T17984 8710-EXIT.                                                       
T17984     EXIT.                                                        
                                                                        
A37666 8800-UPDATE-CUSTOMER.                                            
A37666                                                                  
A37666     MOVE '8800'             TO ACTIVE-PARAGRAPH.                 
A37666                                                                  
A37666     MOVE ZEROES TO CU-AUTO-XFER-TO-ACCT.                         
A37666     MOVE -1 TO WS-NULL-CU.                                       
A37666                                                                  
A37666     EXEC SQL                                                     
A37666       UPDATE CSS_CUSTOMER                                        
A37666         SET AUTO_XFER_TO_ACCT = :CU-AUTO-XFER-TO-ACCT 
                                       :WS-NULL-CU,
A37666             AUTO_XFER_UPDT_DT = IIF(TRY_CONVERT(DATE, 
                                                       :WS-CURRENT-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURRENT-DATE
              ) <> 0) OR (LEN(:WS-CURRENT-DATE) <> 10), CIS.CHAR2DATE(
                                                       :WS-CURRENT-DATE
              ), CONVERT(DATE, :WS-CURRENT-DATE) )                 
A37666       WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                        
A37666                                                      
A37666     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*      UPDATE CSS_CUSTOMER                                                
MFA-TR*        SET AUTO_XFER_TO_ACCT = :CU-AUTO-XFER-TO-ACCT:WS-NULL-CU,        
MFA-TR*            AUTO_XFER_UPDT_DT = :WS-CURRENT-DATE                         
MFA-TR*      WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                                
MFA-TR*      QUERYNO 8800                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

A37666                                                                  
A37666     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE.           
A37666                                                                  
A37666     EVALUATE WS-ACTIVE-RETURN-CODE                               
A37666         WHEN SUCCESSFUL-CALL                                     
A37666         WHEN NOT-FOUND                                           
A37666             CONTINUE                                             
A37666         WHEN OTHER                                               
A37666             MOVE 'CSS_CUSTOMER'         TO CMN-TABLE-1           
A37666             MOVE 'CUSTOMER_NO'          TO CMN-TABLE-ELEMENT-1   
A37666             MOVE CU-CUSTOMER-NO         TO CMN-HOSTVAR-ELEMENT-1 
A37666         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
A37666     END-EVALUATE.                                                
A37666                                                                  
A37666 8800-EXIT.                                                       
A37666     EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8810-DELETE-CSS-BILLING-HDR.                                  *         
      * PERFORMED BY 5600-PROCESS-FINAL-BILL.                         *         
      *****************************************************************         
       8810-DELETE-CSS-BILLING-HDR.                                     
                                                                        
           MOVE '8810'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_BILLING_HDR                               
               WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                        
                 AND BILL_NO    = :BI-BILL-NO                           
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_BILLING_HDR                                       
MFA-TR*        WHERE ACCOUNT_NO = :BI-ACCOUNT-NO                                
MFA-TR*          AND BILL_NO    = :BI-BILL-NO                                   
MFA-TR*      QUERYNO 8810                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_BILLING_HDR'          TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'BILL_NO'                  TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
T5172         MOVE BI-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE BI-BILL-NO                 TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8810-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8830-DELETE-ADDR-FORMATTED.                                   *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8830-DELETE-ADDR-FORMATTED.                                      
                                                                        
           MOVE '8830'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_ADDR_FORMATTED                            
               WHERE ADDRESS_ID = :WS-OLD-ADDRESS-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_ADDR_FORMATTED                                    
MFA-TR*        WHERE ADDRESS_ID = :WS-OLD-ADDRESS-ID                            
MFA-TR*      QUERYNO 8830                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FORMATTED'       TO CMN-TABLE-1            
T5172         MOVE 'ADDRESS_ID'               TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE WS-OLD-ADDRESS-ID          TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8830-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8850-DELETE-SUMM-AR-CNTL.                                     *         
      * PERFORMED BY 5666-PAY-DEP-DET-FM.                             *         
      *****************************************************************         
       8850-DELETE-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '8850'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_AR_CNTL                                   
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                 AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_AR_CNTL                                           
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 8850                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'               TO CMN-TABLE-1           
T5172         MOVE 'ACCOUNT_NO'                TO CMN-TABLE-ELEMENT-1   
T5172         MOVE 'PYMT_PRIORITY_LVL'         TO CMN-TABLE-ELEMENT-2   
T5172         MOVE 'ITEM_ID'                   TO CMN-TABLE-ELEMENT-3   
CBSI          MOVE 'SERV_ORDER_NO'             TO CMN-TABLE-ELEMENT-4   
T5172         MOVE AC-ACCOUNT-NO               TO CMN-HOSTVAR-ELEMENT-1 
T5172         MOVE AC-PYMT-PRIORITY-LVL        TO CMN-HOSTVAR-ELEMENT-2 
T5172         MOVE AC-ITEM-ID                  TO CMN-HOSTVAR-ELEMENT-3 
CBSI          MOVE CMN-SERV-ORDER-NO           TO CMN-HOSTVAR-ELEMENT-4 
              PERFORM 9900-SQL-ERROR-ROUTINE   THRU 9900-EXIT           
           END-IF.                                                      
                                                                        
       8850-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8860-DELETE-SUMM-AR-CNTL.                                     *         
      * PERFORMED BY 5601-USE-CREDIT-BALANCES.                        *         
      *****************************************************************         
       8860-DELETE-SUMM-AR-CNTL.                                        
                                                                        
           MOVE '8860'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_AR_CNTL                                   
               WHERE CURRENT OF SUMM-AR-CNTL                            
           END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-1  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8860-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8870-DELETE-ADDR-FREEFORM.                                    *         
      *                                                               *         
      * PERFORMED BY 5100-PROCESS-FB-ADDRESS.                         *         
      *****************************************************************         
       8870-DELETE-ADDR-FREEFORM.                                       
                                                                        
           MOVE '8870'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_ADDR_FREEFORM                             
               WHERE ADDRESS_ID = :WS-OLD-ADDRESS-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_ADDR_FREEFORM                                     
MFA-TR*        WHERE ADDRESS_ID = :WS-OLD-ADDRESS-ID                            
MFA-TR*      QUERYNO 8870                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_ADDR_FREEFORM'        TO CMN-TABLE-1            
CBSI          MOVE 'ADDRESS_ID '              TO CMN-TABLE-ELEMENT-1    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-2    
T5172         MOVE WS-OLD-ADDRESS-ID          TO CMN-HOSTVAR-ELEMENT-1  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-2  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8870-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8880-DELETE-DET-AR-CNTL.                                      *         
      *                                                               *         
      * PERFORMED BY 5666-PAY-DEP-DET-FM.                             *         
      *****************************************************************         
       8880-DELETE-DET-AR-CNTL.                                         
                                                                        
           MOVE '8880'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_AR_CNTL                                   
               WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO              
                 AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL       
                 AND ITEM_ID           = :WS-AC-ITEM-ID                 
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_AR_CNTL                                           
MFA-TR*        WHERE ACCOUNT_NO        = :WS-AC-ACCOUNT-NO                      
MFA-TR*          AND PYMT_PRIORITY_LVL = :WS-AC-PYMT-PRIORITY-LVL               
MFA-TR*          AND ITEM_ID           = :WS-AC-ITEM-ID                         
MFA-TR*      QUERYNO 8880                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE WS-AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE WS-AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE WS-AC-ITEM-ID              TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8880-EXIT.                                                       
           EXIT.                                                        
                                                                        
      *****************************************************************         
      * 8881-DELETE-AR-CNTL.                                          *         
      *                                                               *         
      *****************************************************************         
       8881-DELETE-AR-CNTL.                                             
                                                                        
           MOVE '8881'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_AR_CNTL                                   
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                 AND ITEM_ID           = :AC-ITEM-ID                    
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_AR_CNTL                                           
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*          AND ITEM_ID           = :AC-ITEM-ID                            
MFA-TR*      QUERYNO 8881                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T5172         MOVE 'ITEM_ID'                  TO CMN-TABLE-ELEMENT-3    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-4    
T5172         MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T5172         MOVE AC-ITEM-ID                 TO CMN-HOSTVAR-ELEMENT-3  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-4  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8881-EXIT.                                                       
           EXIT.                                                        
      *****************************************************************         
      * 8890-DELETE-AR-CNTL-DEP.                                      *         
      *                                                               *         
      * PERFORMED BY 5660-APPLY-DEPOSIT-TO-BILL.                      *         
      *****************************************************************         
       8890-DELETE-AR-CNTL-DEP.                                         
                                                                        
           MOVE '8890'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              DELETE FROM CSS_AR_CNTL                                   
               WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                 
                 AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL          
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       DELETE FROM CSS_AR_CNTL                                           
MFA-TR*        WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                         
MFA-TR*          AND PYMT_PRIORITY_LVL = :AC-PYMT-PRIORITY-LVL                  
MFA-TR*      QUERYNO 8890                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
              NEXT SENTENCE                                             
           ELSE                                                         
T5172         MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T5172         MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T5172         MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
CBSI          MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
T5172         MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T5172         MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
CBSI          MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
              PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
        8890-EXIT.                                                      
           EXIT.                                                        
                                                                        
ACT103***************************************************************** 10403000
ACT103*    8895-INSERT-WORK-QUEUE.                                      10405000
ACT103***************************************************************** 10407000
ACT103 8895-INSERT-WORK-QUEUE.                                          
                                                                        
ACT103     INITIALIZE   WS-MCSCB077-OUTPUT.                             
ACT103     INITIALIZE   ABEND-FUNCTION.                                 
                                                                        
ACT103     CALL MCSCB077 USING CWS00077-FIELDS,                         
ACT103                         ABEND-FILE,                              
ACT103                         WS-MCSCB077-RET-CODE.                    
                                                                        
ACT103     MOVE WS-MCSCB077-RET-CODE     TO WS-ACTIVE-RETURN-CODE       
ACT103                                                                  
ACT103     IF ABEND-FUNCTION > SPACES OR WS-MCSCB077-RET-CODE NOT = 0   
ACT103        MOVE PROGRAM-NAME          TO ABEND-PROGRAM               
ACT103        MOVE '8895'                TO ACTIVE-PARAGRAPH            
ACT103        MOVE 'CALL'                TO ABEND-FUNCTION              
ACT103        MOVE 'MCSCB077'            TO TABLE-1                     
ACT103        MOVE 'CUSTOMER NO'         TO TABLE-ELEMENT-1             
ACT103        MOVE WS-77-CUSTOMER-NO     TO HOSTVAR-ELEMENT-1           
ACT103        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
ACT103     END-IF.                                                      
                                                                        
ACT103 8895-EXIT.                                                       
ACT103      EXIT.                                                       
                                                                        
C37422*****************************************************************         
C37422* 8896-UPDATE-ACCOUNT-H.                                                  
C37422*      UPDATE CODE ACCT_BILLED TO 'X' TO PREVENT BILLING                  
C37422*****************************************************************         
C37422 8896-UPDATE-ACCOUNT-H.                                           
C37422                                                                  
C37422     MOVE '8896'                        TO ACTIVE-PARAGRAPH.      
C37422                                                                  
C37422     EXEC SQL                                                     
C37422        UPDATE CSS_ACCOUNT                                        
C37422           SET CODE_ACCT_BILLED = 'X'                             
C37422           WHERE ACCOUNT_NO     = :AT-ACCOUNT-NO                  
                                                            
C37422     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_ACCOUNT                                                
MFA-TR*          SET CODE_ACCT_BILLED = 'X'                                     
MFA-TR*          WHERE ACCOUNT_NO     = :AT-ACCOUNT-NO                          
MFA-TR*      QUERYNO 8896                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

C37422                                                                  
C37422     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
C37422     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C37422        CONTINUE                                                  
C37422     ELSE                                                         
C37422        MOVE 'CSS_ACCOUNT'              TO CMN-TABLE-1            
C37422        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
C37422        MOVE AT-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
C37422        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
C37422     END-IF.                                                      
C37422                                                                  
C37422 8896-EXIT.                                                       
C37422     EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 8900-DELETE-AR-CNTL.                                          *         
T22772* PERFORMED BY 5605-USE-AMT-TRAN.                               *         
T22772*****************************************************************         
T22772 8900-DELETE-AR-CNTL.                                             
T22772                                                                  
T22772     MOVE '8900'                        TO ACTIVE-PARAGRAPH.      
T22772     EXEC SQL                                                     
T22772        DELETE FROM CSS_AR_CNTL                                   
T22772         WHERE CURRENT OF AMT-TRAN                                
T22772     END-EXEC.                                                    

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772*                                                                         
T22772     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T22772        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22772        MOVE 'PYMT_PRIORITY_LVL'        TO CMN-TABLE-ELEMENT-2    
T22772        MOVE 'SERV_ORDER_NO'            TO CMN-TABLE-ELEMENT-3    
T22772        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22772        MOVE AC-PYMT-PRIORITY-LVL       TO CMN-HOSTVAR-ELEMENT-2  
T22772        MOVE CMN-SERV-ORDER-NO          TO CMN-HOSTVAR-ELEMENT-3  
T22772        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22772     END-IF.                                                      
T22772 8900-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
T23387*****************************************************************         
T23387* 8910-CHK-RCC-DEBIT                                            *         
T23387* CHECK IF RCC ROW WITH TRAN BAL > 0 EXISTS. IF EXISTS, RETAIN  *         
T23387* RCC SUMM ROW, ELSE DELETE SUMM ROW                            *         
T23387*****************************************************************         
T23387 8910-CHK-RCC-DEBIT.                                              
T23387*                                                                         
T23387     MOVE '8910'                        TO ACTIVE-PARAGRAPH.      
T23387     EXEC SQL                                                     
T23387         SELECT 'Y'                                               
T23387           INTO :WS-RCC-EXISTS                                    
T23387           FROM CSS_AR_CNTL                                       
T23387          WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                       
T23387            AND ITEM_ID           > 0                             
T23387            AND PYMT_PRIORITY_LVL = 60                            
T23387            AND AMT_TRAN_BALANCE  > 0                             
                                                            
T23387     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y'                                                       
MFA-TR*          INTO :WS-RCC-EXISTS                                            
MFA-TR*          FROM CSS_AR_CNTL                                               
MFA-TR*         WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                               
MFA-TR*           AND ITEM_ID           > 0                                     
MFA-TR*           AND PYMT_PRIORITY_LVL = 60                                    
MFA-TR*           AND AMT_TRAN_BALANCE  > 0                                     
MFA-TR*      QUERYNO 8910                                                       
MFA-TR*    END-EXEC.                                                            

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T23387                                                                  
T23387     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T23387     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR                
T23387                                WS-MULTIPLE-ROWS-CALL             
T23387        NEXT SENTENCE                                             
T23387     ELSE                                                         
T23387        IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                      
T23387           PERFORM 8920-DELETE-RCC-SUMM            THRU 8920-EXIT 
T23387        ELSE                                                      
T23387           MOVE 'CSS_AR_CNTL'           TO CMN-TABLE-1            
T23387           MOVE 'ACCOUNT_NO'            TO CMN-TABLE-ELEMENT-1    
T23387           MOVE 'PYMT_PRIORITY_LVL'     TO CMN-TABLE-ELEMENT-2    
T23387           MOVE 'SERV_ORDER_NO'         TO CMN-TABLE-ELEMENT-3    
T23387           MOVE AC-ACCOUNT-NO           TO CMN-HOSTVAR-ELEMENT-1  
T23387           MOVE AC-PYMT-PRIORITY-LVL    TO CMN-HOSTVAR-ELEMENT-2  
T23387           MOVE CMN-SERV-ORDER-NO       TO CMN-HOSTVAR-ELEMENT-3  
T23387           PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT         
T23387        END-IF                                                    
T23387     END-IF.                                                      
T23387 8910-EXIT.                                                       
T23387     EXIT.                                                        
                                                                        
T22772*****************************************************************         
T22772* 8920-DELETE-RCC-SUMM                                          *         
T22772* DELETE RCC SUMMARY ROW                                        *         
T22772* PERFORMED BY 5605-USE-AMT-TRAN                                *         
T22772*****************************************************************         
T22772 8920-DELETE-RCC-SUMM.                                            
T22772     MOVE '8920'                        TO ACTIVE-PARAGRAPH.      
T22772         EXEC SQL                                                 
T22772             DELETE FROM CSS_AR_CNTL                              
T22772              WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                   
T22772                AND PYMT_PRIORITY_LVL = 60                        
                                                            
T22772         END-EXEC.                                                

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*        EXEC SQL                                                         
MFA-TR*            DELETE FROM CSS_AR_CNTL                                      
MFA-TR*             WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                           
MFA-TR*               AND PYMT_PRIORITY_LVL = 60                                
MFA-TR*            QUERYNO 8920                                                 
MFA-TR*        END-EXEC.                                                        

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772*                                                                         
T22772     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE 'CSS_AR_CNTL'              TO CMN-TABLE-1            
T22772        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
T22772        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
T22772        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
T22772     END-IF.                                                      
T22772 8920-EXIT.                                                       
T22772     EXIT.                                                        
T22772                                                                  
P00471*                                                                         
P00471*****************************************************************         
P00471* 8930-DELETE-DPPDROP-EXEMPT                                    *         
P00471* DELETES DPP DROP EXEMPT ROW FROM THE CSS_ATTRIBUTE TABLE WHEN *         
P00471* THE DPP ACCOUNT IS FINAL BILLED                               *         
P00471*****************************************************************         
P00471 8930-DELETE-DPPDROP-EXEMPT.                                      
P00471     MOVE '8930'                        TO ACTIVE-PARAGRAPH.      
P00471         EXEC SQL                                                 
P00471             DELETE FROM CSS_ACCT_ATTRIBUTE                       
P00471              WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                   
P00471                AND ATTRIBUTE_DESC = 'AUTODPPDRPEXEMPIND'         
P00471                                                      
P00471         END-EXEC.                                                

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*        EXEC SQL                                                         
MFA-TR*            DELETE FROM CSS_ACCT_ATTRIBUTE                               
MFA-TR*             WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                           
MFA-TR*               AND ATTRIBUTE_DESC = 'AUTODPPDRPEXEMPIND'                 
MFA-TR*            QUERYNO 8930                                                 
MFA-TR*        END-EXEC.                                                        

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00471                                                                  
P00471     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
P00471     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00471        NEXT SENTENCE                                             
P00471     ELSE                                                         
P00471        MOVE 'CSS_ACCT_ATTRIBUTE'       TO CMN-TABLE-1            
P00471        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
P00471        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
P00471        MOVE 'ATTRIBUTE DESC'           TO CMN-TABLE-ELEMENT-2    
P00471        MOVE 'AUTODPPDRPEXEMPIND'       TO CMN-HOSTVAR-ELEMENT-2  
P00471        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
P00471     END-IF.                                                      
P00471*                                                                         
P00471 8930-EXIT.                                                       
P00471     EXIT.                                                        
P00471*                                                                         
P00471*****************************************************************         
P00471* 8935-DELETE-AUTO-DPPDROP                                      *         
P00471* DELETES DPP DROP ROW FROM THE CSS_ATTRIBUTE TABLE WHEN        *         
P00471* THE DPP ACCOUNT IS FINAL BILLED                               *         
P00471*****************************************************************         
P00471 8935-DELETE-AUTO-DPPDROP.                                        
P00471     MOVE '8935'                        TO ACTIVE-PARAGRAPH.      
P00471         EXEC SQL                                                 
P00471             DELETE FROM CSS_ACCT_ATTRIBUTE                       
P00471              WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                   
P00471                AND ATTRIBUTE_DESC = 'AUTO_DROP_DPP'              
P00471                                                      
P00471         END-EXEC.                                                

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*        EXEC SQL                                                         
MFA-TR*            DELETE FROM CSS_ACCT_ATTRIBUTE                               
MFA-TR*             WHERE ACCOUNT_NO = :AC-ACCOUNT-NO                           
MFA-TR*               AND ATTRIBUTE_DESC = 'AUTO_DROP_DPP'                      
MFA-TR*            QUERYNO 8935                                                 
MFA-TR*        END-EXEC.                                                        

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00471                                                                  
P00471     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
P00471     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00471        NEXT SENTENCE                                             
P00471     ELSE                                                         
P00471        MOVE 'CSS_ACCT_ATTRIBUTE'       TO CMN-TABLE-1            
P00471        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
P00471        MOVE AC-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
P00471        MOVE 'ATTRIBUTE DESC'           TO CMN-TABLE-ELEMENT-2    
P00471        MOVE 'AUTO_DROP_DPP'            TO CMN-HOSTVAR-ELEMENT-2  
P00471        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
P00471     END-IF.                                                      
P00471*                                                                         
P00471 8935-EXIT.                                                       
P00471     EXIT.                                                        
P00471*                                                                         
P00471*****************************************************************         
P00471* 8940-DELETE-SPCL-BILL-MSG.                                    *         
P00471* DELETES ROW FROM CSS_SPCL_BILL_MSG WHERE MDG_ID = 91030 WHEN  *         
P00471* THE DPP ACCOUNT IS FINAL BILLED                               *         
P00471*****************************************************************         
P00471 8940-DELETE-SPCL-BILL-MSG.                                       
P00471     MOVE '8940'                        TO ACTIVE-PARAGRAPH.      
P00471         EXEC SQL                                                 
P00471             DELETE FROM CSS_SPCL_BILL_MSG                        
P00471              WHERE ACCOUNT_NO = :U1-ACCOUNT-NO                   
P00471                AND BILL_MSG_ID  = '91030'                        
P00471                                                      
P00471         END-EXEC.                                                

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*        EXEC SQL                                                         
MFA-TR*            DELETE FROM CSS_SPCL_BILL_MSG                                
MFA-TR*             WHERE ACCOUNT_NO = :U1-ACCOUNT-NO                           
MFA-TR*               AND BILL_MSG_ID  = '91030'                                
MFA-TR*            QUERYNO 8940                                                 
MFA-TR*        END-EXEC.                                                        

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

P00471                                                                  
P00471     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
P00471     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00471        NEXT SENTENCE                                             
P00471     ELSE                                                         
P00471        MOVE 'CSS_SPCL_BILL_MSG'        TO CMN-TABLE-1            
P00471        MOVE 'ACCOUNT_NO'               TO CMN-TABLE-ELEMENT-1    
P00471        MOVE U1-ACCOUNT-NO              TO CMN-HOSTVAR-ELEMENT-1  
P00471        MOVE 'BILL_MSG_ID'              TO CMN-TABLE-ELEMENT-2    
P00471        MOVE '91030'                    TO CMN-HOSTVAR-ELEMENT-2  
P00471        PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            
P00471     END-IF.                                                      
P00471*                                                                         
P00471 8940-EXIT.                                                       
P00471     EXIT.                                                        
P00471*                                                                         
                                                                        
T22772*****************************************************************         
T22772* 8990-SELECT-CIA-EXISTS.                                       *         
T22772*                                                               *         
T22772* PERFORMED BY 5605-USE-AMT-TRAN.                               *         
T22772*****************************************************************         
T22772 8990-SELECT-CIA-EXISTS.                                          
T22772     EXEC SQL                                                     
T22772         SELECT 'Y'                                               
T22772           INTO :WS-CIA-EXISTS                                    
T22772           FROM CSS_AR_CNTL                                       
T22772          WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                
T22772            AND ITEM_ID           = 1                             
T22772            AND PYMT_PRIORITY_LVL = 70                            
                                                            
T22772     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y'                                                       
MFA-TR*          INTO :WS-CIA-EXISTS                                            
MFA-TR*          FROM CSS_AR_CNTL                                               
MFA-TR*         WHERE ACCOUNT_NO        = :AC-ACCOUNT-NO                        
MFA-TR*           AND ITEM_ID           = 1                                     
MFA-TR*           AND PYMT_PRIORITY_LVL = 70                                    
MFA-TR*        QUERYNO 8990                                                     
MFA-TR*    END-EXEC                                                             

MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

T22772     MOVE SQLCODE             TO WS-ACTIVE-RETURN-CODE            
T22772*                                                                         
T22772     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T22772        NEXT SENTENCE                                             
T22772     ELSE                                                         
T22772        MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
T22772        MOVE '5605'                    TO ACTIVE-PARAGRAPH        
T22772        MOVE 'SELECT'                  TO ABEND-FUNCTION          
T22772        MOVE 'CSS_AR_CNTL'             TO TABLE-1                 
T22772        MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1         
T22772        MOVE WS-AC-ACCOUNT-NO          TO HOSTVAR-ELEMENT-1       
T22772        MOVE AC-PYMT-PRIORITY-LVL      TO CMN-HOSTVAR-ELEMENT-2   
T22772        MOVE CMN-SERV-ORDER-NO         TO CMN-HOSTVAR-ELEMENT-3   
T22772        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
T22772      END-IF.                                                     
T22772 8990-EXIT.                                                       
T22772     EXIT.                                                        
                                                                        
T24436******************************************************************        
T24436* LOADING GL NUMBERS                                                      
T24436******************************************************************        
T24436* 9350-LINK-SCSCO061.                                            *        
T24436*    CALLS THE SUBPROGRAM SCSCO061                               *        
T24436******************************************************************        
T24436 9350-LINK-SCSCO061.                                              
T24436*                                                                         
T24436     MOVE SPACES                    TO ABEND-FUNCTION.            
T24436     PERFORM 9400-CALL-CPD00061     THRU 9400-EXIT.               
T24436     IF ABEND-FUNCTION  > SPACES                                  
T24436        PERFORM 9700-PROCESS-ABEND  THRU 9700-EXIT                
T24436     END-IF.                                                      
T24436                                                                  
T24436 9350-EXIT.                                                       
T24436     EXIT.                                                        
T24436*                                                                         
T24436******************************************************************        
T24436* 9400-CALL-CPD00061                                             *        
T24436*     CALLS THE COPYBOOK CPD00061                                *        
T24436******************************************************************        
T24436 9400-CALL-CPD00061.                                              
T24436                                                                  
REARCH     CALL MCSCO061  USING  WS-GL-ACCT-NAME                        
REARCH                           WS-GL-ACCT-MAJOR-FIELDS                
REARCH                           WS-VALID-COMPANY-NOS                   
REARCH                           WS-GL-NAME-INFO                        
REARCH                           WS-GL-ACCT-NO-TABLE                    
REARCH                           ABEND-FILE                             
REARCH                           RS-RETURN-CODE.                        
REARCH     MOVE RS-RETURN-CODE            TO WS-ACTIVE-RETURN-CODE,     
REARCH                                       S-RETURN-CODE.             
REARCH                                                                  
REARCH     IF ABEND-FUNCTION  > SPACES                                  
REARCH       IF ABEND-FUNCTION EQUAL 'BADDATA'                          
REARCH           MOVE -1                  TO RS-RETURN-CODE,            
REARCH                                       WS-ACTIVE-RETURN-CODE      
REARCH       END-IF                                                     
REARCH       PERFORM 9700-PROCESS-ABEND    THRU 9700-EXIT               
REARCH     END-IF.                                                      
                                                                        
T24436 9400-EXIT.                                                       
T24436     EXIT.                                                        
T24436*                                                                         
      ****************************************************************          
      * 9600-TERMINATE-LINK.                                         *          
      *                                                              *          
      * RETURN CONTROL TO CICS OR NEXT HIGHER LOGICAL LEVEL.         *          
      ****************************************************************          
       9600-TERMINATE-LINK.                                             
                                                                        
           MOVE '9600'                        TO ACTIVE-PARAGRAPH.      
                                                                        
REARCH     EXIT PROGRAM.                                                
                                                                        
       9600-EXIT.                                                       
            EXIT.                                                       
                                                                        
      ****************************************************************          
      * CPD0023C CICS ABEND PROCESSING FOR DB2 ABENDS IN CPD00023    *          
      *                                                              *          
      ****************************************************************          
           EXEC SQL                                                             
              INCLUDE CPD0023C                                                  
           END-EXEC.                                                            
                                                                        
                                                                        
      ****************************************************************          
      * 9900-SQL-ERROR-ROUTINE.                                      *          
      *                                                              *          
      ****************************************************************          
       9900-SQL-ERROR-ROUTINE.                                          
                                                                        
           MOVE WS-YES                   TO CMN-ABEND-CHECK.            
           MOVE WS-ACTIVE-RETURN-CODE    TO CMN-RETURN-CODE.            
           MOVE ACTIVE-PARAGRAPH         TO CMN-ACTIVE-PARAGRAPH.       
           MOVE PROGRAM-NAME             TO CMN-PROGRAM-NAME.           
                                                                        
REARCH     EXIT PROGRAM.                                                
                                                                        
       9900-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ****************************************************************          
      * 9000-SEND-ERROR-RESULT.                                      *          
      *                                                              *          
      ****************************************************************          
       9000-SEND-ERROR-RESULT.                                          
                                                                        
       9000-EXIT.                                                       
           EXIT.                                                        
                                                                        
PCR052*-------------COPYBOOK CPD00080 FOR INSERTING ROW--------------*          
PCR052*---------------------INTO CSS_REFUND--------------------------*          
PCR052     EXEC SQL                                                             
PCR052         INCLUDE CPD00080                                                 
PCR052     END-EXEC.                                                            
                                                                        
NONUTL     EXEC SQL                                                             
NONUTL        INCLUDE CPD00312                                                  
NONUTL     END-EXEC.                                                            
                                                                        
