       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.     PCSBW143.                                        
       AUTHOR.         SREENI GUNTUPALLI                                
       INSTALLATION.                                                    
       DATE-WRITTEN.   10/09/2003.                                      
       DATE-COMPILED.                                                   
      *****************************************************************         
      **              SOUTH CAROLINA ELECTRIC & GAS                  **         
      **                                                             **         
      ********            CUSTOMER SERVICE SYSTEM             *********         
      ********                   DB2                          *********         
      *****************************************************************         
      **                                                             **         
      **              PROGRAM  MODIFICATION  LOG                     **         
      **                                                             **         
      ** DATE       INITIALS       REASON                            **         
      **                                                             **         
      ** 10/09/03   SG18894        DEVELOPMENT OF NEW PROGRAM TO     **         
      **                           POST METER READS TO CIS.          **         
C29853** 02/18/04   SG18894        CHANGES MADE TO ACCOMMODATE SEB   **         
      **                           AGL READS & PSNC METRETEK READS   **         
C30662** 03/31/04   SG18894        CHANGES MADE TO CREATE A WQ IF THE**         
      **                           DEMAND READS ARE SAME AS LAST MNTHS*         
      **                                                              *         
27793 ** 14 SEP 2004 RF10596       DO NOT GENERATE A WQ DURING MID    *         
      **                           MONTH UNLESS A PARM IS SET STATING *         
      **                           TO CREATE ONE.  ALSO, STOP CREATING*         
      **                           'NEW SERVICES' WQ.                 *         
      **                           ALSO, FLAG 'CUSTOMER HAS CARDS' NO *         
      **                           READ AS A SKIPPED READ RATHER THAN *         
      **                           REGULAR READ ON METER READ HISTORY *         
      **                           PANEL.                             *         
      **                                                              *         
C31826** 11/09/04   SG18894        CHANGES MADE UPDATE THE INDEXES   **         
      **                           CORRECTLY WHEN SEASON CHANGE OCCURS*         
      **                                                              *         
C31977** 01/05/05   SG18894        DO NOT INCREASE NO-CONSEC-CRD-READ *         
      **                           COUNT IN THIS PGM. PANEL 208 UPDATES         
      **                           IT AS NEEDED, WHEN THE READ POSTED *         
C31697** 02/18/05   SG18894        VALIDATE AND POST A NEW UCG READ ON*         
      **                           PSNC INSTRUMENTED METERS           *         
      **                           CHANGES MADE TO CREATE A WQ, IF A  *         
      **                           READING IS POSTED TWICE            *         
      **                                                              *         
30989 ** 04/11/05   RDF            P COMP METER PRESSURE CHANGES      *         
      **                                                              *         
T33376** 10/13/05   JC91900        DEFAULT READ TIME TO '00:01:00'    *         
T33376**                           WHEN INVALID VALUE READ FROM FILE. *         
C33023** 12/12/05   NC94746        AGL METER CHARGE CHANGES FOR SEB   *         
C33023**                           ACCOUNTS. A FIXED FACTOR VALUE WILL*         
C33023**                           BE CHARGED FOR EACH METER READ.    *         
C33889** 07/10/06   AD94658        CREATE WQ COMMENTS WITH 'AMR METER'*         
C33889**                           AS THE PREFIX FOR ALL AMR METERED  *         
C33889**                           ACCOUNTS.                          *         
C33950** 07/10/06   AD94658        THE 8500-UPDATE-BILLING-DET LOGIC  *         
C33950**                           HAS BEEN MOVED TO DISPLAY THE      *         
C33950**                           CORRECT ACCT NO IN CASE OF ABENDS. *         
C33884** 08/30/06   SG18894        CHANGE FOR NEW READ SOURCE OF ITRON*         
C33884**                           AMR MOBILE                         *         
C33884** 09/20/06   SG18894        CHANGES MADE TO DELETE THE READ    *         
C33884**                           SOURCE VALIDATION                  *         
C35066** 08/08/07   NC94746        CHANGES DUE TO REPLACING OF READING*         
C35066**                           FILE WITH BILLING FILE FROM ITRON  *         
C35066**                           (1) HI-LO FIELD EXCEPTION READS    *         
C35066**                               HELD UNTIL BILL CYCLE OPEN.    *         
C35066**                           (2) SUPERVISOR ESTIMATED READS     *         
C35066**                               HELD UNTIL BILL CYCLE OPEN.    *         
C35418** 08/08/07   NC94746        PREFIX WQ TEXT WITH "AMR READ "    *         
C35418**                           ONLY FOR AMR READS IRRESPECTIVE OF *         
C35418**                           METER IS AMR OR NOT.               *         
C35066** 08/10/07   NC94746        FIX IMPLEMENTED NOT TO REPORT DUP  *         
C35066**                           READ WQ'S FOR SEB ACCOUNTS.        *         
C36317** 09/30/07   NC94746        POPULATE 90 AS READ CYCLE EVEN FOR *         
C36317**                           INFORMATIONAL MID-MONTH READS LIKE *         
C36317**                           NORMAL MID-MONTH READS.            *         
C36317**                           SECURE RATE ACCOUNTS WITH NO READS *         
C36317**                           WILL CREATE WQ IRRESPECTVE OF      *         
C36317**                           ESTIMATE OK FLAG. WQ TEXT REPHRASED*         
C36533**                                                              *         
C36533** 01/15/08    NC94746       ENHANCED PROGRAM TO PROCESS AROP   *         
C36533**                           OUT OF CYCLE ACCOUNTS BY CREATING  *         
C36533**                           SPECIAL ROUTES IN METER READING &  *         
C36533**                           READ POSTING.                      *         
C36533**                                                              *         
C37129** 05/05/08    NC94746       DO NOT POST READING ON PENDING-OFF *         
C37129**                           ORDER ACCOUNT UNTIL BILL CYCLE     *         
C37129**                           CLOSING DATE. THIS WILL GIVE ENOUGH*         
C37129**                           TIME FOR AROP TO PRORATE READING.  *         
C37129**                                                              *         
C37037** 06/15/08    NC94746       FIX FOR RESTART LOGIC TO VALIDATE  *         
C37037**                           RESTART RECORD FROM INPUT FILE.    *         
C37037**                                                              *         
C35597** 07/18/08    SS95855       AGL METER READ PASS THROUGH CHARGES*         
C35597*                            NOT BILLING CORRECTLY ON SOME CANC-*         
C35597*                            EL/REBILLS                         *         
C37526** 09/16/08    SS95855       FLAG ACCOUNTS WITH READ DATES IN   *         
C37526**                           THE FUTURE AS INVALID.             *         
C36829** 09/16/08    SS95855       CHECK FOR INVALID DATES AND CREATE *         
C36829**                           WQ AND SKIP ACCT INSTEAD OF GETTING*         
C36829**                           SQLCODE -304                       *         
C37833** 10/28/08    SS95855       REMOVE LOGIC THAT INSERTS INTO     *         
      **                           CSS_IDO_METER_READ                 *         
A00914** 06/23/09    GD97441       1. DON'T CREATE ZERO USE WQ IF     *         
A00914**             ACT0001          REV-MTH-LST-NRML = 0 FOR SEB.   *         
A00914**             ACT0003       2. DON'T CALC LOAD FACTOR IF       *         
A00914**                              WS-TOTAL-KWH/WS-NO-READ-DAYS=0. *         
A00914**             ACT0004       3. DON'T CREATE DEMAND WQ IF CURR  *         
A00914**                              USAGE = PREVIOUS USAGE.         *         
A00914**             ACT0005       4. END CONTROL RECORD PROCESSING   *         
A00914**                              HAS BEEN CHANGED FOR FCS PROJECT*         
A01738** 10/06/09    SB93596       1. DON'T POPULATE EMPID IN CX TABLE*         
A01738**                           2. CREATE WORK QUE TEXT FOR LOW FAIL*        
A01738**                              AND HIGH FAIL                   *         
A00795** 12/25/09    NC94746       NEW HI-LO COPYBOOK CHANGES.        *         
P00246** 01/29/09    SS97726       CREATE SEPARATE BG IF CX DAYS > 45 *         
P00246**                           (NORMAL READS) FOR SEB ACCOUNTS TO *         
P00246**                           SUPPORT NEW FUNCTION TO OVERRIDE   *         
P00246**                           BILL CYCLE, BILL DATE AND REV MONTH*         
P00251** 02/01/10    SS95855       Net Metering                       *         
P00251**                           - Check for cogeneration read and  *         
P00251**                           set the debit/credit code on CX to *         
P00251**                           credit.                            *         
P00251**                           - Read_process_cd & Read_status_cd *         
P00251**                           added to meter reading data popul- *         
P00251**                           ated in WQ's for Panel208 use.     *         
P00251**                           - Populate new columns for table   *         
P00251**                           CSS_ROUTE_REPORT.                  *         
P00251**                           - Generate Un-authorized WQ's for  *         
P00251**                           rate PR1.                          *         
P00251** 05/11/10    SS95855       Route_Report had '0' for Code_Usage*         
P00251**                           _Id for SEB. Changed the code to   *         
P00251**                           fix the Code_Usage_Id.             *         
A02306** 05/24/10    SJ97149       INSERTING CHECK FOR METER-READ-DATE*         
A02306**                           CHANGE EXISTS FOR A METER IN ORDER *         
A02306**                           TO POST SEPARATELY.                *         
A02367** 06/23/10    SJ97149       Posting the meter if the pending   *         
A02367**                           order date is greater than 2 DAYS  *         
A02367**                           OF bill_window close DATE WITH OUT *         
A02367**                           holding until the last date.       *         
A02367**                           GETTING CORRECT NO-DIALS FOR THE   *         
A02367**                           CORRESPONDING REGISTER-ID CHANGES  *         
P00251** 08/26/10    SS95855       Create WQ for the PR1 Customers    *         
P00251**                           when the basic KWH consumption > 0 *         
P00251**                           Stop generating WQ for PR1 Customer*         
P00251**                           when the basic KWH consumption is 0*         
A02711** 08/27/10    SJ97149       DO NOT CREATE ZERO WQ ON SECURED   *         
A02711**                           RATE ACCOUNTS WHEN ACCOUNT IS NOT  *         
A02711**                           ACTIVE AND METER TURNOFF           *         
P00447** 10/26/10    SS95855       Create WQ for Electric Meters if   *         
P00447**                           Meter Constant is Zero.            *         
P00462** 05/20/11    NC94746       MDM & SMART SYNCH RELATED CHANGES. *         
P00462**                                                              *         
A03291** 06/21/11    vijay         Generate category-173 WQ if account*         
A03291**                           is Inactive or meter is Off or     *         
A03291**                           Inactive.                          *         
A03352*  07/12/11    MC95456       CHANGE WQ CATEGORY FROM 143 TO     *         
A03352*                            528 - SCEG (ROUTING CATEGORY OF 4) *         
A03352*                            529 - PSNC (ROUTING CATEGORY OF 1) *         
P00508**                                                              *         
P00508** 10/20/11    NC94746       MDMS PROJECT CHANGES.              *         
P00508**                                                              *         
A03494** 07/19/11   MC95456     1.FOR SEB CREATE WQ INSTEAD OF DISPLAY          
A03494**                          'METER ALREADY READ ON OR AFTER ITRON         
A03494**                          READ DATE' WHEN DIFFRENCE IS +/- 6.           
A03494**                                                                        
A03494**            Vijay       2.Fix logic of updating CODE_ACCT_BILLED        
A03494**                          WHEN THERE ARE NO CX POSTING FOR SEB.         
      **                                                                        
A03172** 09/29/11   MC95456     GENERATE WQ ON INACTIVE PR1 METER               
A03172**                        ONLY IF THE REGISTER USAGE > 5 KWH              
ACT045** 09/29/11   BD09555     Get ccf limit from delinquency table            
ACT045** A03967                 instead of hard-code                            
ACT064** 06/26/12   VP43661     Icorrect Usage on WQ Catergory#142 when         
ACT064** A03967                 meter read twice on the same day.               
A04462** 10/15/12   DB41297     BYPASS HI-LO CHECK AND ZERO USE FOR             
A04462**                        STANDBY GENERATOR.                              
ACT127** 08/06/13   VIJAY       CHANGE CATEGORY ID TO 141 FOR NEGATIVE          
ACT127** A04527                 USAGE WQ.                                       
A04684** 09/10/13   SS95855     ADD NEW READ ITEM STATUS FOR OFFCYCLE           
A04684**                        UNATTENDED SCHEDULER READS.                     
ACT015** 06/16/14   SS95855     A04880 USE WQ COPYBOOK CPD00077.                
      **                                                                        
A04880** 10/20/14   RF10596     DO NOT DO ZERO USE WQ WHEN                      
A04880**                        AT-REV-MTH-LST-NRML = 0, CSR AND SEB            
A04880**                        NEW DELINQUENCY VALUE 'WQ-ZERO-USE'             
A04880**                        1 = YES , 2 = NO                                
      **                                                                        
A04880** 11/24/14   RF10596     SEB ONLY - GET SEASONAL MONTHS FROM             
A04880**                        JOB_PARM                                        
      **                                                                        
ACT256** 12/18/15   VIJAY       POST METER READINGS OF HI/LO READS              
ACT256** A05136                 WITH WARNING WQ MESSAGE.KEEP ACCOUNT            
      **                                                                        
ACT256** 02/04/16   VIJAY       BACKOUT ACT256 CHANGES.                         
ACT256** A05136                                                                 
      **                                                                        
ACT256** 02/08/16   VIJAY       POST METER READINGS OF HI/LO READS              
ACT256** A05136                 WITH WARNING WQ MESSAGE.KEEP ACCOUNT            
ACT068** 02/23/16   VIJAY       prefix 'USG' in WQ FREEFORM DATA ONLY           
ACT068** A05460                 FOR WQ CATEGORIES 581,582.                      
ACT110** 03/31/16   VIJAY       INITIALIZE HILO-WARNING FLAG AT METER           
ACT110** A05460                 LEVEL.                                          
P00899** 04/25/16   HEMA        APPEND WQ DATA AFTER 'USG' IN WQ FREE           
P00899**                        FORM DATA FOR WQ CATEGORIES 581 & 582.          
PRJ914** 04/25/16   NC94746     Itron OpenWay changes                           
ACT151** 05/05/16   VIJAY       CREATE WARNING WQS FOR NON TOU METERS.          
ACT151** A05460                                                                 
ACT301** 05/20/16   NC94746     CREATE ZERO USE WQ WHEN # OF USAGE DAYS         
      **                        MORE THAN 17.                                   
A05744** 02/10/17   NC94746     CORRECT REASON CODE ON UN-AUTH USE WQ'S         
A05744**                        WHEN UN-AUTH USAGE RECORDED ON GEN-MTRS.        
      *****************************************************************         
           REMARKS.                                                     
                              PCSBW143 NARRATIVE                        
           THIS PROGRAM IS TO POST METER READINGS FROM DIFFERENT SYSTEMS
           LIKE ITRON, AMR, AGL OR ANY OTHER METER READ SYSTEMS. PROGRAM
           EXPECTS READINGS IN FIOBW06 FORMAT, WHICH CAN HOLD ONE READ  
           FOR EACH RECORD. SO, MULTI-REGISTER METERS WILL HAVE MULTIPLE
           RECORDS FOR ONE METER. PROGRAM VALIDATES ALL INDIVIDUAL READS
           IN THE FIRST STEP, THENS GOES FOR CROSS-VALIDATION OF THE    
           READINGS. ALL EXCEPTIONS ARE REPORTED THROUGH WQS TO CONCERN 
           -ED TEAM. ONCE THE READINGS ARE IDENTIFIED AS VALID READINGS,
           CIS TABLES ARE UPDATED APPROPRIATELY. IF THE READ IS BILLING 
           READ, A CONSUMPTION ROW IS CREATED FOR BILLING. IF THE READS 
           ARE INFORMATIONAL OR MID-MONTH READS, READINGS ARE POSTED TO 
           ROUTE REPORT TABLE ALONE.                                    
      *                                                                         
       ENVIRONMENT DIVISION.                                            
       CONFIGURATION SECTION.                                           
       SOURCE-COMPUTER.    IBM-370.                                     
       OBJECT-COMPUTER.    IBM-370.                                     
      *                                                                         
       INPUT-OUTPUT SECTION.                                            
       FILE-CONTROL.                                                    
       COPY CSSBW06.                                                            
       COPY CSSCM16.                                                            
      *                                                                         
       DATA DIVISION.                                                   
       FILE SECTION.                                                    
       COPY CFDBW06.                                                            
       COPY FIOBW06.                                                            
      *                                                                         
       COPY CFDCM16.                                                            
       COPY FIOCM16.                                                            
      *                                                                         
       WORKING-STORAGE SECTION.                                         

MSQ008  01 MSQ008-CWS72-HI-LO-CSR  PIC S9(9) COMP-5.
MSQ017 01 MFA-PROGRAM-ID PIC X(8) VALUE 'PCSBW143'.
MSQ017     COPY MFASQLM.
       01  WS-START                        PIC X(40)                    
           VALUE 'WORKING STORAGE FOR PCSBW143 STARTS HERE'.            
      *                                                                         
       01  WS-SWICHES.                                                  
           05  WS-FBW06-STATUS             PIC X(02)  VALUE '00'.       
               88  FBW06-SUCCESSFUL                   VALUE '00'.       
           05  WS-END-OF-FBW06-FILE        PIC X(01)  VALUE 'N'.        
               88  END-OF-FBW06                       VALUE 'Y'.        
           05  WS-CNTRL-REC-REACHED        PIC X(01)  VALUE 'N'.        
               88  CNTRL-REC-REACHED                  VALUE 'Y'.        
           05  WS-FIRST-METER              PIC X(01)  VALUE 'Y'.        
               88  FIRST-METER                        VALUE 'Y'.        
           05  WS-WARNING-IND              PIC X(01)  VALUE 'N'.        
               88  WS-METER-WARNING                   VALUE 'Y'.        
           05  WS-SEASON-CHG-FL            PIC X(01)  VALUE '0'.        
               88  SEASON-CHANGE                      VALUE '1'.        
               88  NO-SEASON-CHANGE                   VALUE '0'.        
           05  WS-MONTH-END-CX-FL          PIC X(01)  VALUE 'N'.        
               88  MONTH-END-CX                       VALUE 'Y'.        
           05  WS-ACCOUNT-SKIP-FL          PIC X(01)  VALUE 'N'.        
               88  ACCOUNT-SKIP                       VALUE 'Y'.        
           05  WS-METER-SKIP-FL            PIC X(01)  VALUE 'N'.        
               88  METER-SKIP                         VALUE 'Y'.        
           05  WS-READ-SKIP-FL             PIC X(01)  VALUE 'N'.        
               88  READ-SKIP                          VALUE 'Y'.        
           05  WS-GET-HILO-FL              PIC X(01)  VALUE 'N'.        
               88  GET-HILO                           VALUE 'Y'.        
           05  WS-INACT-MTR-0-USE-FL       PIC X(01)  VALUE 'N'.        
               88  INACT-MTR-0-USE                    VALUE 'Y'.        
           05  WS-WQ-GENERATED-FL          PIC X(01)  VALUE 'N'.        
               88  WQ-GENERATED                       VALUE 'Y'.        
               88  WQ-NOT-GENERATED                   VALUE 'N'.        
           05  WS-REGISTER-FOUND-FL        PIC X(01)  VALUE 'N'.        
               88  REGISTER-FOUND                     VALUE 'Y'.        
               88  REGISTER-NOT-FOUND                 VALUE 'N'.        
           05  WS-TOU-WQ-FL                PIC X(01)  VALUE 'N'.        
               88  TOU-WQ                             VALUE 'Y'.        
           05  WS-GT-14-READS-FL           PIC X(01)  VALUE 'N'.        
               88  GT-14-READS                        VALUE 'Y'.        
           05  WS-TYPE-PROCESS             PIC X(01)  VALUE SPACE.      
               88  WS-MN-PROCESS                      VALUE 'M'.        
               88  WS-RG-PROCESS                      VALUE 'R'.        
C29853     05  WS-DATABASE-FL              PIC 9(01)  VALUE 0.          
C29853         88  CSR-DATABASE                       VALUE 1.          
C29853         88  SEB-DATABASE                       VALUE 2.          
           05  WS-HILO-FAIL-IND            PIC X(01)  VALUE 'N'.        
               88  HILO-FAIL                          VALUE 'Y'.        
ACT256     05  WS-HILO-WANRING-IND         PIC X(01)  VALUE 'N'.        
ACT256         88  HILO-WARNING                       VALUE 'Y'.        
           05  WS-EMPTY-FILE-IND           PIC X(01)  VALUE 'N'.        
               88  EMPTY-FILE                         VALUE 'Y'.        
           05  WS-MTR-ALREADY-READ-IND     PIC X(01)  VALUE 'N'.        
               88  MTR-ALREADY-READ                   VALUE 'Y'.        
           05  WS-METER-NOT-READ-FL        PIC X(01)  VALUE 'Y'.        
               88  METER-NOT-READ                     VALUE 'N'.        
           05  WS-DO-NOT-COMPARE-FL        PIC X(01)  VALUE 'N'.        
               88  DO-NOT-COMPARE                     VALUE 'Y'.        
           05  WS-DO-NOT-CALC-LF-FL        PIC X(01)  VALUE 'N'.        
               88  DO-NOT-CALC-LF                     VALUE 'Y'.        
           05  WS-DO-NOT-CALL-CPD140-FL    PIC X(01)  VALUE 'N'.        
               88  DO-NOT-CALL-CPD140                 VALUE 'Y'.        
           05  WS-VERIFY-BILL-HOOK-FL      PIC X(01)  VALUE 'N'.        
               88  VERIFY-BILL-HOOK                   VALUE 'Y'.        
           05  WS-PEND-OFF-WQ-CREATED-FL   PIC X(01)  VALUE 'N'.        
               88  PEND-OFF-WQ-CREATED                VALUE 'Y'.        
           05  WS-READ-MISSING-WQ-CRT-FL   PIC X(01)  VALUE 'N'.        
               88  READ-MISSING-WQ-CRT                VALUE 'Y'.        
           05  WS-TOTAL-KWH-FOUND-FL       PIC X(01)  VALUE 'N'.        
               88  TOTAL-KWH-FOUND                    VALUE 'Y'.        
               88  TOTAL-KWH-NOT-FOUND                VALUE 'N'.        
           05  WS-ON-OFF-KWH-FOUND-FL      PIC X(01)  VALUE 'N'.        
               88  ON-OFF-KWH-FOUND                   VALUE 'Y'.        
               88  ON-OFF-KWH-NOT-FOUND               VALUE 'N'.        
C31697     05  WS-UNC-READ-FOUND-FL        PIC X(01)  VALUE 'N'.        
C31697         88  UNC-READ-FOUND                     VALUE 'Y'.        
C31697         88  UNC-READ-NOT-FOUND                 VALUE 'N'.        
P00251     05  WS-CO-GEN-REG-FOUND-FL      PIC X(01)  VALUE 'N'.        
P00251         88  CO-GEN-REG-EXISTS                  VALUE 'Y'.        
P00251         88  CO-GEN-REG-NOT-EXISTS              VALUE 'N'.        
      *                                                                         
           05  WS-NULL-IND                 PIC S9(04) COMP VALUE +01.   
               88  IS-NULL                                 VALUE -1.    
               88  IS-NOT-NULL                             VALUE +01.   
      *                                                                         
           05  WS-READ-ITEM-STATUS         PIC X(01)  VALUE ' '.        
               88  BILLING-READ                       VALUE 'B'.        
               88  MIDMONTH-READ                      VALUE 'M'.        
               88  INFO-READ                          VALUE 'I'.        
A04684         88  OFF-CYCLE-READ                     VALUE 'O', 'U'.   
A04684         88  OFF-CYCLE-UNATTENDED-READ          VALUE 'U'.        
C36317         88  MIDMONTH-INFO-READ                 VALUE 'N'.        
C36317         88  MIDMONTH-READ-ALL                  VALUE 'M', 'N'.   
PRJ914     05  WS-OFF-CYCLE-READ-TYPE      PIC X(01)  VALUE ' '.        
PRJ914         88  REGULAR-CYCLE-READ                 VALUE ' '.        
PRJ914         88  MTR-CHNG-OFF-CYC-READ              VALUE 'P'.        
PRJ914         88  CC-CHNG-OFF-CYC-READ               VALUE 'F'.        
      *                                                                         
           05  WS-REMOTE-READ-IND          PIC X(01)  VALUE ' '.        
               88  TOU-ONLY                           VALUE 'T'.        
               88  TOU-IDR                            VALUE 'B'.        
               88  IDR-ONLY                           VALUE 'I'.        
               88  TOU-MANUAL                         VALUE 'M'.        
               88  MANUAL                             VALUE '0'.        
               88  AMR                                VALUE 'A'.        
P00508         88  TOU-ALL                            VALUE 'T', 'B'.   
P00508     05 WS-MTR-RD-SRC-SW             PIC X(01)  VALUE ' '.        
P00508        88 SMART-SYNCH-MTR                      VALUE 'R'.        
PRJ914        88 OPEN-WAY-MTR                         VALUE 'P'.        
P00508     05 WS-MDM-ESTIMATE-SW           PIC X(01)  VALUE ' '.        
P00508        88 NOT-MDM-ESTIMATED-READ               VALUE ' '.        
P00508        88 MDM-ESTIMATED-READ                   VALUE 'Y'.        
P00508     05 WS-MDM-HI-LO-EXCEPT-SW       PIC X(01)  VALUE ' '.        
P00508        88 NO-MDM-HI-LO-EXCEPT                  VALUE ' '.        
P00508        88 MDM-HI-LO-EXCEPT                     VALUE 'Y'.        
P00508     05 WS-CIS-HI-LO-EXCEPT-SW       PIC X(01)  VALUE ' '.        
P00508        88 NO-CIS-HI-LO-EXCEPT                  VALUE ' '.        
P00508        88 CIS-HI-LO-EXCEPT                     VALUE 'Y'.        
P00508*                                                                         
C35066     05  WS-FIELD-HI-LO-EXCEPT-SW    PIC X(01)  VALUE ' '.        
C35066         88  WS-FIELD-HI-LO-EXCEPT              VALUE 'Y'.        
C35066*                                                                         
C35066     05  WS-SUPERVISOR-EST-SW        PIC X(01)  VALUE ' '.        
C35066         88  WS-SUPERVISOR-EST-READ             VALUE 'Y'.        
C35066*                                                                         
C35066     05  WS-ROUTE-REPT-LOADED-SW    PIC X(01)  VALUE ' '.         
C35066         88  WS-ROUTE-REPT-LOADED              VALUE 'Y'.         
C35066         88  WS-ROUTE-REPT-NOT-LOADED          VALUE ' '.         
C36317*                                                                         
C36317     05  WS-VALID-READ-DATE-SW      PIC X(01)  VALUE 'Y'.         
C36317         88  WS-INVALID-READ-DATE              VALUE 'N'.         
C36317         88  WS-VALID-READ-DATE                VALUE 'Y'.         
      *                                                                         
A03494     05 WS-IGNORE-SEB-READ-SW        PIC X(01)  VALUE ' '.        
A03494        88 DO-NOT-IGNORE-SEB-READ               VALUE 'N'.        
A03494        88 IGNORE-SEB-READ                      VALUE 'Y'.        
      *                                                                         
A00914     05  WS-DEMAND-WQ-SW            PIC X(01)  VALUE ' '.         
A00914         88  DEMAND-WQ-REQ                     VALUE ' '.         
A00914         88  DEMAND-WQ-NOT-REQ                 VALUE 'Y'.         
A00914*                                                                         
       01  WS-FIOBW06-TABLE.                                            
           05  WS-FBW06-READ-DATA      OCCURS 25 TIMES.                 
               10  WS-FBW06-READ-REC           PIC X(280).              
               10  WS-FBW06-NO-READ-CD         PIC X(01).               
      *RD-VALID-FL CAN BE Y OR N OR SPACES. SPACE MEANS IGNORE THE READ         
               10  WS-FBW06-RD-VALID-FL        PIC X(01).               
               10  WS-FBW06-MN-RG-CD           PIC X(01).               
               10  WS-FBW06-MN-RG-READ-CD      PIC X(01).               
               10  WS-FBW06-CRNT-USE           PIC 9(12)V9(3).          
               10  WS-FBW06-PREV-READING       PIC 9(12)V9(3).          
               10  WS-FBW06-NO-READ-DAYS       PIC S9(4) COMP.          
COB305         10 WS-FBW06-NO-UNITS        PIC S9(9) COMP-3 VALUE 0.        
               10  WS-FBW06-CODE-USAGE-SOURCE  PIC X(01).               
               10  WS-FBW06-CODE-USAGE-ID      PIC X(01).               
               10  WS-FBW06-REG-ID-NO          PIC S9(4) COMP.          
               10  WS-FBW06-REG-STATUS         PIC X(01).               
COB305         10 WS-FBW06-CONSTANT        PIC S9(6)V9(3) COMP-3 
COB305           VALUE 0.   
               10  WS-FBW06-RD-DIALS           PIC S9(4) COMP.          
               10  WS-FBW06-CALL-CPD140-FL     PIC X(01).               
COB305         10 WS-FBW06-PCOMP-FCT        PIC S9(2)V9(5) COMP-3 
COB305           VALUE 0.   
      *                                                                         
           05  WS-SAVE-FBW06-REC               PIC X(280).              
           05  WS-FBW06-SUB                    PIC S9(4) COMP.          
           05  WS-FBW06-MAX-SUB                PIC S9(4) COMP.          
      *                                                                         
       01  WS-ACCUMULATORS.                                             
           05  WS-COUNTERS.                                             
               10  WS-COUNT-ACCT           PIC 9(07) VALUE 0.           
               10  WS-COUNT-METER          PIC 9(07) VALUE 0.           
               10  WS-COUNT-KWH            PIC 9(07) VALUE 0.           
               10  WS-COUNT-GAS            PIC 9(07) VALUE 0.           
               10  WS-COUNT-UNC            PIC 9(07) VALUE 0.           
               10  WS-COUNT-INT            PIC 9(07) VALUE 0.           
               10  WS-COUNT-KW             PIC 9(07) VALUE 0.           
               10  WS-COUNT-KVA            PIC 9(07) VALUE 0.           
               10  WS-COUNT-SURVEY         PIC 9(07) VALUE 0.           
               10  WS-COUNT-NOT-READ       PIC 9(07) VALUE 0.           
               10  WS-HIGH-LOW-FAIL        PIC 9(07) VALUE 0.           
      *                                                                         
       01  WS-WORK-AREA.                                                
           05  WS-SCEG                     PIC XX VALUE '01'.           
           05  WS-DO-I-CREATE-MID-MONTH-WQ PIC X VALUE SPACES.          
           05  WS-ROW-COUNT                PIC S9(09) COMP VALUE ZERO.  
           05  WS-FBW06-REC-CNTR           PIC S9(09) COMP VALUE ZERO.  
           05  WS-CNTRL-REC-FLAG           PIC X(01)  VALUE 'N'.        
           05  WS-UPDT-REC-FLAG            PIC X(01)  VALUE 'N'.        
           05  WS-TOU-SEASN                PIC X(01)  VALUE ' '.        
           05  WS-SAVE-SEASN               PIC X(01)  VALUE ' '.        
           05  WS-OC-EXISTS                PIC X(01)  VALUE ' '.        
           05  WS-SAVE-TP                  PIC S9(4) COMP VALUE 0.      
           05  WS-SAVE-UTYPE               PIC X(01)  VALUE ' '.        
           05  WS-RUN-DATE                 PIC X(10).                   
           05  WS-SEASN-CHG-DATE           PIC X(10).                   
           05  WS-READ-CYCLE               PIC X(02).                   
           05  WS-BILL-CYCLE               PIC X(02).                   
COB305     05 WS-NO-DEMAND-UNITS        PIC S9(9)V COMP-3 VALUE 0.           
COB305     05 WS-DEMAND-READING        PIC S9(8)V9(3) COMP-3 VALUE 0.       
PRJ914     05  WS-CURRENT-TIMESTMP         PIC X(26).                   
PRJ914     05  WS-CODE-TOU-SEASN           PIC X(01).                   
PRJ914     05  WS-EDIT-DEC-ZERO            PIC ---------9.              
PRJ914     05  WS-EDIT-DEC-THREE           PIC ---------9.999.          
C35066     05  WS-PREV-READ-CYCLE          PIC X(02) VALUE SPACES.      
C35066     05  WS-PREV-BILL-CYCLE          PIC X(02) VALUE SPACES.      
           05  WS-CURR-READ-DATE           PIC X(10).                   
           05  WS-METER-READ-TM            PIC X(06).                   
           05  WS-MTR-RD-TM-NUM            PIC 9(06).                   
C36829     05  WS-NO-READ-DAYS             PIC S9(8)  COMP.             
           05  WS-TOTAL-DAYS               PIC S9(4)  COMP.             
           05  WS-PREV-TIME-PERIOD         PIC S9(4) COMP VALUE 0.      
P00251     05  WS-SAVE-CODE-USAGE-ID       PIC X(01) VALUE ' '.         
P00251     05  WS-PREV-CODE-USAGE-ID       PIC X(01)  VALUE SPACES.     
P00251     05  WS-TEMP-CODE-USAGE-ID       PIC X(01)  VALUE SPACES.     
P00251     05  WS-OA-CODE-USAGE-ID         PIC X(01)  VALUE SPACES.     
P00251     05  WS-TEMP-READ-ITEM-STATUS    PIC X(01)  VALUE SPACES.     
A03494     05  WS-LAST-READ-VALUE          PIC S9(12)V9(3) VALUE ZERO.  
ACT045     05  WS-READING-DIFFERENCE       PIC  9(12)V9(3) VALUE ZERO.  
           05  WS-PREV-READ-DATE           PIC X(10)  VALUE SPACES.     
           05  WS-PREV-READ-NUM REDEFINES WS-PREV-READ-DATE.            
               10  WS-PREV-READ-YYYY       PIC 9(04).                   
               10  WS-PREV-READ-YEAR REDEFINES WS-PREV-READ-YYYY.       
                   15  WS-PREV-READ-CC     PIC 9(02).                   
                   15  WS-PREV-READ-YY     PIC 9(02).                   
               10  FILLER                  PIC X(01).                   
               10  WS-PREV-READ-MM         PIC 9(02).                   
               10  FILLER                  PIC X(01).                   
               10  WS-PREV-READ-DD         PIC 9(02).                   
           05  WS-DATE-READ-MMDD           PIC 9(04)  VALUE ZERO.       
           05  WS-DATE-READ-MMDD-A REDEFINES WS-DATE-READ-MMDD.         
               10  WS-DATE-READ-MM         PIC 9(02).                   
               10  WS-DATE-READ-DD         PIC 9(02).                   
           05  WS-PREV-READ-COMP           PIC S9(4)  USAGE COMP.       
           05  WS-CURR-READ-COMP           PIC S9(4)  USAGE COMP.       
           05  WS-COUNT-UNSUCCESSFUL-ROWS                               
                                           PIC S9(04) COMP-3 VALUE ZERO.
           05  WS-PEND-OFF-DT-MIN-2        PIC X(10)  VALUE SPACES.     
           05  WS-BILL-WINDOW-OPEN-DT      PIC X(10)  VALUE SPACES.     
           05  WS-BILL-WINDOW-CLOSE-DT     PIC X(10)  VALUE SPACES.     
C35066     05  WS-BN-WIN-OPEN-DATE         PIC X(10)  VALUE SPACES.     
C35066     05  WS-BN-WIN-CLOSE-DATE        PIC X(10)  VALUE SPACES.     
           05  WS-ALL-NINES                PIC X(40)  VALUE ALL '9'.    
           05  WS-WQ-READ-INDX             PIC X(08).                   
           05  WS-WQ-READ-INDX-E REDEFINES WS-WQ-READ-INDX              
                                           PIC Z(4)9(4).                
           05  WS-WQ-READ-INDX-D REDEFINES WS-WQ-READ-INDX-E            
                                           PIC Z(3)9.9(3).              
           05  WS-CURR-REV-MONTH           PIC 9(06)  VALUE ZERO.       
           05  WS-REVENUE-MONTH            PIC 9(06)  VALUE ZERO.       
           05  WS-REV-MONTH-RED REDEFINES WS-REVENUE-MONTH.             
               10 WS-REV-MONTH-CC          PIC 9(02).                   
               10 WS-REV-MONTH-YY          PIC 9(02).                   
               10 WS-REV-MONTH-MM          PIC 9(02).                   
           05  WS-PREV-ACCT-NO             PIC 9(13) VALUE ZEROES.      
           05  WS-NEW-ACCT                 PIC 9(13) VALUE 1.           
           05  WS-PREV-METER-NO            PIC X(09) VALUE SPACES.      
A02306     05  WS-PREV-METER-READ-DATE     PIC X(10) VALUE SPACES.      
           05  WS-PREV-UTIL-TYPE           PIC X(01) VALUE SPACES.      
           05  WS-ACCOUNT-NO               PIC 9(13) VALUE ZEROES.      
           05  WS-ACCOUNT-NO-MN            PIC S9(13)V USAGE COMP-3     
                                                     VALUE ZEROES.      
           05  WS-CODE-UTIL-TYPE-MN        PIC X(01) VALUE SPACE.       
           05  WS-CUST-HAS-CARDS           PIC X(01) VALUE 'Y'.         
           05  WS-METER-NO-MN              PIC X(9)  VALUE SPACES.      
           05  WS-IC-NO-MN                 PIC S9(4) COMP VALUE ZERO.   
           05  WS-CODE-ACCT-STAT           PIC X(01) VALUE SPACE.       
           05  WS-SECURED-RATE-FL          PIC X(01) VALUE SPACES.      
           05  WS-DELETE-OFFCYC            PIC X(01) VALUE SPACES.      
           05  WS-DEMAND-INT               PIC 9(09).                   
A04880     05  WS-ZERO-USE-WQ              PIC S9(4)V9(5) COMP-3        
                                                     VALUE ZEROES.      
A04880     05  WS-ONE-WQ                   PIC 9(6)  VALUE 1.           
A04880     05  WS-TWO-WQ                   PIC 9(6)  VALUE 2.           
           05  WS-NO-OF-REJECT             PIC 9(06) VALUE ZERO.        
           05  WS-MIN-INACT-G-USE          PIC S9(05) COMP-3 VALUE ZERO.
           05  WS-MAX-INACT-G-USE          PIC S9(05) COMP-3 VALUE ZERO.
           05  WS-MIN-INACT-E-USE          PIC S9(05) COMP-3 VALUE ZERO.
           05  WS-MAX-INACT-E-USE          PIC S9(05) COMP-3 VALUE 0.   
C29853     05  WS-SEB-PREV-DAYS            PIC S9(4)  COMP.             
COB305     05 WS-LOAD-FACTOR        PIC S9(03)V99 COMP-3 VALUE 0.        
COB305     05 WS-POWER-FACTOR        PIC S9(03)V99 COMP-3 VALUE 0.        
COB305     05 WS-USAGE-PER-DAY        PIC S9(09)V9(4) COMP-3 VALUE 0.      
           05  WS-TOTAL-KWH                PIC S9(12)      VALUE 0.     
           05  WS-TOTAL-ACCUM-KWH          PIC S9(12)      VALUE 0.     
           05  WS-WQ-ALREADY-READ-DIFF     PIC 9(6).                    
           05  WS-WQ-HI-VAL                PIC 9(6).                    
           05  WS-WQ-HI-VAL-D REDEFINES WS-WQ-HI-VAL                    
                                           PIC 9(4)V9(2).               
           05  WS-WQ-LO-VAL                PIC 9(6).                    
           05  WS-WQ-LO-VAL-D REDEFINES WS-WQ-LO-VAL                    
                                           PIC 9(4)V9(2).               
           05  WS-WQ-HI-VALUE              PIC X(6).                    
           05  WS-WQ-HI-VALUE-R REDEFINES WS-WQ-HI-VALUE PIC ZZZZZ9.    
           05  WS-WQ-LO-VALUE              PIC X(6).                    
           05  WS-WQ-LO-VALUE-R REDEFINES WS-WQ-LO-VALUE PIC ZZZZZ9.    
           05  WS-METER-READ-NUM           PIC S9(11) COMP-3 VALUE 0.   
           05  WS-MAX-DIGITS               PIC S9(11) COMP-3 VALUE 0.   
           05  WS-CRNT-USE                PIC S9(9)V9(3) COMP-3 VALUE 0.
P00251     05  WS-CRNT-USE-DISP           PIC 9(9).9(3).                
           05  WS-SAVE-CRNT-KWH            PIC S9(11) COMP-3 VALUE 0.   
           05  WS-KWH-DIFF                 PIC S9(11) COMP-3 VALUE 0.   
C31697     05  WS-READ-COUNT               PIC S9(04) COMP.             
P00246     05  WS-AGLMTCHRG-COUNT          PIC S9(04) COMP.             
C31697     05  WS-UCG-DIFF                 PIC S9(11) COMP-3 VALUE 0.   
C31697     05  WS-UCG-ROLLOVER             PIC S9(11) COMP-3 VALUE 0.   
           05  WS-HI-TOT-KWH               PIC S9(11) COMP-3 VALUE 0.   
           05  WS-HI-TOT-UNC               PIC S9(11) COMP-3 VALUE 0.   
           05  WS-HI-TOT-INT               PIC S9(11) COMP-3 VALUE ZERO.
           05  WS-LO-TOT-KWH               PIC S9(11) COMP-3 VALUE ZERO.
           05  WS-LO-TOT-UNC               PIC S9(11) COMP-3 VALUE ZERO.
           05  WS-LO-TOT-INT               PIC S9(11) COMP-3 VALUE ZERO.
           05  WS-COMMENTS-TEMP            PIC X(223).                  
           05  WS-811                      PIC S9(09) VALUE -811 COMP.  
           05  WS-ROLL-FLAG                PIC X(1) VALUE 'N'.          
           05  WS-UNC-RATIO               PIC S9(9)V9(3) COMP-3 VALUE 0.
           05  WS-INT-RATIO               PIC S9(9)V9(3) COMP-3 VALUE 0.
           05  WS-UNC-SUB                  PIC 9(02)  VALUE ZERO.       
           05  WS-INT-SUB                  PIC 9(02)  VALUE ZERO.       
           05  WS-SAVE-SUB                 PIC 9(02)  VALUE ZERO.       
           05  WS-SRCH-SUB                 PIC 9(02)  VALUE ZERO.       
           05  WS-SUB1                     PIC 9(02)  VALUE ZERO.       
           05  WS-WQ-SUB                   PIC 9(02)  VALUE ZERO.       
           05  WS-SAVE-KWH                 PIC S9(11) COMP-3 VALUE 0.   
           05  WS-SAVE-KW                  PIC S9(11) COMP-3 VALUE 0.   
           05  WS-MAX-KW                   PIC S9(11) COMP-3 VALUE 0.   
           05  WS-SAVE-KVA                 PIC S9(11) COMP-3 VALUE 0.   
           05  WS-SAVE-COR                 PIC S9(11) COMP-3 VALUE 0.   
C31697     05  WS-SAVE-UCG                 PIC S9(11) COMP-3 VALUE 0.   
           05  WS-SAVE-UNC                 PIC S9(11) COMP-3 VALUE 0.   
           05  WS-SAVE-INT                 PIC S9(11) COMP-3 VALUE 0.   
      *****************************************************************         
      *    FIELDS USED FOR BILLING                                              
      *****************************************************************         
           05  WS-UT-COUNT                 PIC 9(03)  COMP-3 VALUE ZERO.
           05  WS-MN-AWAITING-RD-COUNT     PIC S9(04) COMP VALUE ZERO.  
           05  WS-RG-AWAITING-RD-COUNT     PIC S9(04) COMP VALUE ZERO.  
           05  WS-READS-POSTED             PIC 9(03)  COMP-3 VALUE ZERO.
T33376     05  WS-DEFAULT-TIME             PIC X(08)  VALUE '00:01:00'. 
T33376     05  WS-VALID-TIME               PIC X(01)  VALUE 'N'.        
T33376     05  WS-MTR-RD-TIME              PIC X(08).                   
T33376     05  WS-MTR-RD-TIME-R REDEFINES WS-MTR-RD-TIME.               
T33376         10  WS-MTR-RD-TIME-HH       PIC X(02).                   
T33376         10  FILLER                  PIC X(01).                   
T33376         10  WS-MTR-RD-TIME-MM       PIC X(02).                   
T33376         10  FILLER                  PIC X(01).                   
T33376         10  WS-MTR-RD-TIME-SS       PIC X(02).                   
      *                                                                         
           05  WS-DATE-NUM.                                             
               10  WS-DATE-NUM-CC          PIC 9(02)  VALUE ZERO.       
               10  WS-DATE-NUM-YY          PIC 9(02)  VALUE ZERO.       
               10  FILLER                  PIC X(01)  VALUE '-'.        
               10  WS-DATE-NUM-MM          PIC 9(02)  VALUE ZERO.       
               10  FILLER                  PIC X(01)  VALUE '-'.        
               10  WS-DATE-NUM-DD          PIC 9(02)  VALUE ZERO.       
           05  WS-DB2-DATE REDEFINES WS-DATE-NUM                        
                                           PIC X(10).                   
           05  WS-WORK-DATE.                                            
               10  WS-WORK-CC              PIC 9(02).                   
               10  WS-WORK-YY              PIC 9(02).                   
               10  FILLER                  PIC X(01).                   
               10  WS-WORK-MM              PIC 9(02).                   
               10  FILLER                  PIC X(01).                   
               10  WS-WORK-DD              PIC 9(02).                   
           05  WS-USAGE-ID-CODES.                                       
               10  WS-BASIC-SERVICE        PIC X(01)   VALUE 'A'.       
               10  WS-ECONOMY-USAGE        PIC X(01)   VALUE 'B'.       
               10  WS-STAND-BY-USAGE       PIC X(01)   VALUE 'C'.       
           05  WS-USAGE-SOURCE-CODES.                                   
               10  WS-PRIMARY-METER        PIC X(01)   VALUE 'B'.       
               10  WS-ADDTNL-REGISTER      PIC X(01)   VALUE 'C'.       
               10  WS-ADDTNL-METER         PIC X(01)   VALUE 'D'.       
               10  WS-STANDBY-METER        PIC X(01)   VALUE 'S'.       
           05  WS-READ-CODES.                                           
               10  WS-UNPROCESSED          PIC X(01)   VALUE '0'.       
               10  WS-METER-SUCCESS        PIC X(01)   VALUE '1'.       
               10  WS-MANUAL-READ          PIC X(01)   VALUE '3'.       
               10  WS-MRMS-ESTIMATE        PIC X(01)   VALUE '1'.       
               10  WS-SUPERVISOR-ESTIMATE  PIC X(01)   VALUE '2'.       
               10  WS-HANDHELD-READ        PIC X(01)   VALUE '3'.       
               10  WS-MRMS-READ            PIC X(01)   VALUE '4'.       
               10  WS-NORMAL-READ          PIC X(01)   VALUE 'J'.       
               10  WS-SYSTEM-ESTIMATE      PIC X(01)   VALUE 'E'.       
C29853         10  WS-AGL-ESTIMATE         PIC X(01)   VALUE 'E'.       
C29853         10  WS-FIELD-ESTIMATE       PIC X(01)   VALUE 'F'.       
               10  WS-VERIFIED-READ        PIC X(01)   VALUE 'K'.       
               10  WS-REGULAR-READ         PIC X(01)   VALUE 'R'.       
               10  WS-PC-READ              PIC X(01)   VALUE 'I'.       
               10  WS-SRVY-VISITED         PIC X(01)   VALUE 'S'.       
               10  WS-SRVY-NOT-VISITED     PIC X(01)   VALUE 'V'.       
               10  WS-INSTALL-READ         PIC X(01)   VALUE 'A'.       
               10  WS-CARD-READ            PIC X(01)   VALUE 'C'.       
               10  WS-NO-READ              PIC X(01)   VALUE 'N'.       
               10  WS-AWAITING-READ        PIC X(01)   VALUE 'D'.       
               10  WS-METER-OUT            PIC X(01)   VALUE 'A'.       
               10  WS-SKIP-READ            PIC X(01)   VALUE '0'.       
               10  WS-FORCE-COMPLETE       PIC X(01)   VALUE 'X'.       
               10  WS-ERROR-READ           PIC X(01)   VALUE 'Z'.       
               10  WS-SRVC-ORDER-OFF       PIC X(01)   VALUE 'G'.       
               10  WS-CUSTOMER-READ        PIC X(01)   VALUE 'C'.       
               10  WS-TOU-READ             PIC X(01)   VALUE 'P'.       
               10  WS-TOU-MANUAL-READ      PIC X(01)   VALUE 'K'.       
               10  WS-TOU-PROBE-FAIL       PIC X(01)   VALUE 'Q'.       
               10  WS-TOU-CORR-INFO        PIC X(01)   VALUE 'S'.       
               10  WS-TOU-MTR-CHG          PIC X(01)   VALUE 'U'.       
               10  WS-TOU-NO-READ          PIC X(01)   VALUE 'V'.       
C29853         10  WS-AMR-READ             PIC X(01)   VALUE 'A'.       
C29853         10  WS-ERT-TYPE15-RCVD      PIC X(01)   VALUE 'L'.       
      *                                                                         
           05  WS-METER-STATUS-CODES.                                   
               10  WS-ACTIVE               PIC X(01)   VALUE 'A'.       
               10  WS-INACTIVE             PIC X(01)   VALUE 'J'.       
               10  WS-MONITOR-ONLY         PIC X(01)   VALUE 'I'.       
               10  WS-REMOVED              PIC X(01)   VALUE 'K'.       
           05  WS-IDO-CODES.                                            
               10  WS-IDO-ONLY             PIC X(01)   VALUE 'I'.       
               10  WS-IDO-AND-TOU          PIC X(01)   VALUE 'B'.       
               10  WS-CONFIRMED            PIC X(01)   VALUE 'C'.       
               10  WS-DCO-EXISTS           PIC X(01)   VALUE 'A'.       
               10  WS-STANDBY-GEN          PIC X(01)   VALUE 'M'.       
               10  WS-LOAD-SURVEY          PIC X(01)   VALUE 'L'.       
           05  WS-ACCOUNT-BILL-CODES.                                   
               10  WS-READY                PIC X(01)   VALUE 'R'.       
               10  WS-AWAITING-CHECK-READ  PIC X(01)   VALUE 'U'.       
               10  WS-HOLD-NO-READING      PIC X(01)   VALUE 'H'.       
               10  WS-HOLD-READ-POSTED     PIC X(01)   VALUE 'B'.       
               10  WS-ACCT-HAS-BILLED      PIC X(01)   VALUE 'Y'.       
           05  WS-READ-TYPE-CODES.                                      
               10  WS-MTR-CONST-SURVEY     PIC X(01)   VALUE 'I'.       
               10  WS-TOU-OPTICAL-READ     PIC X(01)   VALUE 'T'.       
           05  WS-ITRON-READ               PIC X(01)   VALUE 'I'.       
           05  WS-ITRON-SOURCE             PIC X(01)   VALUE 'B'.       
C29853     05  WS-ITRON-AMR                PIC X(01)   VALUE 'I'.       
           05  WS-UNMETERED                PIC X(01)   VALUE 'U'.       
           05  WS-CURRENT                  PIC X(01)   VALUE 'C'.       
           05  WS-PREVIOUS                 PIC X(01)   VALUE 'P'.       
           05  WS-CREDIT                   PIC X(01)   VALUE 'C'.       
           05  WS-DEBIT                    PIC X(01)   VALUE 'D'.       
           05  WS-ENDV                     PIC X(01)   VALUE 'E'.       
           05  WS-CLOSED                   PIC X(01)   VALUE 'C'.       
           05  WS-SPACE                    PIC X(01)   VALUE ' '.       
           05  WS-FINALED                  PIC X(01)   VALUE 'B'.       
           05  WS-V                        PIC X(01)   VALUE 'V'.       
           05  WS-SONP-READ                PIC X(01)   VALUE '8'.       
           05  WS-TWACS-SOURCE             PIC X(01)   VALUE 'T'.       
P00462     05  WS-SMART-SYNCH-SOURCE       PIC X(01)   VALUE 'H'.       
PRJ914     05  WS-OPEN-WAY-SOURCE          PIC X(01)   VALUE 'N'.       
C29853     05  WS-METRETEK                 PIC X(01)   VALUE 'E'.       
           05  WS-DO-NOT-ESTIMATE          PIC X(01)   VALUE 'C'.       
C35066*                                                                         
C35066     05  WS-LAST-REG-READ-DT         PIC X(10) VALUE SPACES.      
C35066     05  WS-LAST-REG-READ-TM         PIC X(08) VALUE SPACES.      
C35066     05  WS-REG-MEASURE-CD           PIC X(03) VALUE ' '.         
C35066     05  WS-TYPE-OF-RD-IND           PIC X(01) VALUE ' '.         
C35066     05  WS-UPD-TYPE-OF-RD-IND       PIC X(01) VALUE ' '.         
C35066     05  WS-READING-COND-CD          PIC X(01) VALUE ' '.         
C36533     05  WS-READING-CODE             PIC X(01) VALUE ' '.         
C35066     05  WS-HILO-SYMBOL-SUB          PIC 9(02) VALUE ZEROS.       
C35066     05  WS-MIDMONTH-REV-MONTH       PIC S9(6)V USAGE COMP-3      
C35066                                                VALUE ZEROS.      
C35066     05  WS-MIDMONTH-WIN-OPEN-DT     PIC X(10)  VALUE SPACES.     
C35066     05  WS-MIDMONTH-WIN-CLOSE-DT    PIC X(10)  VALUE SPACES.     
P00246     05  WS-HOLD-CX-DAYS             PIC S9(4) USAGE COMP.        
P00246     05  WS-XMT-CODES.                                            
P00246         10 WS-CODE-DISC-OK          PIC X(01) VALUE SPACE.       
P00246         10 WS-NOTICE-EXEMPT-CD      PIC X(01) VALUE SPACE.       
P00246         10 WS-CODE-LPC-XMT          PIC X(01) VALUE SPACE.       
P00246         10 WS-IVR-EXEMPT-CD         PIC X(01) VALUE SPACE.       
P00246     05  WS-XMT-SWITCHES.                                         
P00246         10 DISC-OK-CHANGED          PIC X(01) VALUE SPACE.       
P00246         10 EXEMPT-CD-CHANGED        PIC X(01) VALUE SPACE.       
P00246         10 LPC-XMT-CHANGED          PIC X(01) VALUE SPACE.       
P00246         10 IVR-EXEMPT-CHANGED       PIC X(01) VALUE SPACE.       
P00246     05  WS-MSG-LITERAL.                                          
P00246         10 FILLER                   PIC X(16) VALUE              
P00246                                              'CURRENT MONTH + '. 
P00246         10 WS-MSG-MONTHS            PIC X(01) VALUE SPACE.       
P00246         10 FILLER                   PIC X(07) VALUE              
P00246                                              ' MONTHS'.          
P00246     05  WS-TRAN-APPL-NO             PIC 9(03) VALUE ZERO.        
      *                                                                         
       01  WS-NULL-INDICATORS.                                          
           05  WS-NULL-1                   PIC S9(04) COMP.             
           05  WS-NULL-2                   PIC S9(04) COMP.             
           05  WS-NULL-3                   PIC S9(04) COMP.             
           05  WS-NULL-4                   PIC S9(04) COMP.             
           05  WS-NULL-5                   PIC S9(04) COMP.             
           05  WS-NULL-6                   PIC S9(04) COMP.             
           05  WS-NULL-7                   PIC S9(04) COMP.             
           05  WS-NULL-8                   PIC S9(04) COMP.             
C35066     05  WS-NULL-9                   PIC S9(04) COMP VALUE 0.     
C35066     05  WS-NULL-10                  PIC S9(04) COMP VALUE 0.     
C35597     05  WS-NULL-11                  PIC S9(04) COMP VALUE 0.     
C35597     05  WS-NULL-12                  PIC S9(04) COMP VALUE 0.     
P00246     05  WS-NULL-13                  PIC S9(04) COMP VALUE 0.     
           05  IND-DATE-BILLED             PIC S9(04) COMP VALUE 1.     
           05  IND-DATE-ORIG-BILL          PIC S9(04) COMP VALUE 1.     
           05  WS-CX-DATE-READ-NULL        PIC S9(04) COMP VALUE 0.     
      *                                                                         
       01  WS-LITERALS.                                                 
           05  WS-PGRMNAME                 PIC X(08)  VALUE 'PCSBW143'. 
           05  WS-PCSBW141                 PIC X(08)  VALUE 'PCSBW141'. 
           05  PROGRAM-NAME                PIC X(08)  VALUE 'PCSBW143'. 
           05  WS-SUMMER                   PIC X(01)  VALUE 'S'.        
           05  WS-NONSUMMER                PIC X(01)  VALUE 'N'.        
           05  WS-NEG-ONE                  PIC S9(04) COMP-3 VALUE -1.  
           05  WS-ONE                      PIC X(02)  VALUE '01'.       
           05  WS-PSNC                     PIC X(02)  VALUE '26'.       
           05  WS-NO                       PIC X(01)  VALUE 'N'.        
           05  WS-N                        PIC X(01)  VALUE 'N'.        
           05  WS-E                        PIC X(01)  VALUE 'E'.        
           05  WS-G                        PIC X(01)  VALUE 'G'.        
           05  WS-YES                      PIC X(01)  VALUE 'Y'.        
           05  WS-Y                        PIC X(01)  VALUE 'Y'.        
           05  WS-I                        PIC X(01)  VALUE 'I'.        
           05  WS-U                        PIC X(01)  VALUE 'U'.        
           05  WS-90                       PIC X(02)  VALUE '90'.       
           05  WS-COMMON                   PIC X(06)  VALUE 'COMMON'.   
           05  WS-VALUE                    PIC X(01)  VALUE 'V'.        
           05  WS-INDEX                    PIC X(01)  VALUE 'I'.        
           05  WS-USAGE-TYPE-CODES.                                     
               10  WS-CCF                  PIC X(01)  VALUE 'C'.        
               10  WS-KWH                  PIC X(01)  VALUE 'B'.        
               10  WS-KVA                  PIC X(01)  VALUE 'E'.        
               10  WS-KW                   PIC X(01)  VALUE 'J'.        
               10  WS-GAS                  PIC X(01)  VALUE 'G'.        
               10  WS-UNC                  PIC X(01)  VALUE 'U'.        
               10  WS-INT                  PIC X(01)  VALUE 'I'.        
               10  WS-PRE                  PIC X(01)  VALUE 'P'.        
               10  WS-TMP                  PIC X(01)  VALUE 'T'.        
               10  WS-VLT                  PIC X(01)  VALUE 'V'.        
C31697         10  WS-UCG                  PIC X(01)  VALUE 'G'.        
           05  WS-CONSTANT-SURVEY          PIC X(03)  VALUE 'CON'.      
           05  WS-TAMPER                   PIC X(01)  VALUE 'E'.        
P00251     05  WS-CO-GEN-COMP-ID           PIC X(02)  VALUE '60'.       
P00251     05  WS-CO-GENERATION            PIC X(01)  VALUE 'F'.        
ACT015     05  SCSCB077                    PIC X(08)  VALUE 'SCSCB077'. 
      *                                                                         
       01  WS-WORK-QUEUE-DATA.                                          
           05  WS-WQ-METER-NO              PIC X(09).                   
           05  WS-WQ-DATE-READ             PIC X(10).                   
           05  WS-WQ-UTIL-TYPE             PIC X(01).                   
           05  WS-WQ-TOU-FL                PIC X(01).                   
ACT256     05  WS-WQ-READER-ID             PIC 9(05).                   
           05  WS-WQ-READINGS OCCURS 14 TIMES.                          
               10  WS-WQ-READ              PIC 9(09).                   
               10  WS-WQ-NO-READ-CD        PIC X(01).                   
               10  WS-WQ-USAGE-TYPE        PIC X(01).                   
               10  WS-WQ-USAGE-ID          PIC X(01).                   
               10  WS-WQ-USAGE-SOURCE      PIC X(01).                   
               10  WS-WQ-SESN-CD           PIC X(01).                   
               10  WS-WQ-TIME-PERIOD       PIC 9(01).                   
           05  WS-WQ-BTU-FACTOR            PIC 9(02)V9(5).              
           05  WS-WQ-CYCLE-IND             PIC X(01).                   
           05  WS-WQ-FF-FORMAT-CD          PIC X(01).                   
C29853     05  WS-WQ-READ-CODE             PIC X(01).                   
P00251     05  WS-WQ-READ-PROCESS-CD       PIC X(01).                   
P00251     05  WS-WQ-READ-STATUS-CD        PIC X(01).                   
P00251     05  WS-WQ-FILLER                PIC X(07).                   
      *                                                                         
       01  WS-RESTART-DATA.                                             
           05  WS-RESTART-PROCESS-TYPE     PIC 9(01).                   
           05  WS-RESTART-JOB-COMPLETE     REDEFINES                    
               WS-RESTART-PROCESS-TYPE     PIC X(01).                   
           05  WS-RESTART-JOB-STATUS       PIC X(01).                   
               88  WS-RUN-COMPLETED-NO-PROBLEMS VALUE 'A'.              
               88  WS-RERUN-COMPLETED           VALUE 'B'.              
               88  WS-RERUN-PENDING             VALUE 'C'.              
           05  WS-RESTART-INPUT-DATE       PIC X(10).                   
           05  WS-RESTART-CHKP-SEQ-NO      PIC 9(05) VALUE ZERO.        
           05  WS-RESTART-RECORD-NO        PIC 9(07).                   
           05  WS-RESTART-REC-KEY          PIC X(40) VALUE SPACE.       
           05  WS-RESTART-FIRST-METER      PIC X(01) VALUE 'Y'.         
           05  WS-RESTART-NO-OF-REJECT     PIC 9(06) VALUE ZERO.        
           05  WS-RESTART-COUNT-ACCT       PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-METER      PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-KWH        PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-GAS        PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-UNC        PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-INT        PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-KW         PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-KVA        PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-SURVEY     PIC 9(07) VALUE 0.           
           05  WS-RESTART-COUNT-NOT-READ   PIC 9(07) VALUE 0.           
           05  WS-RESTART-HIGH-LOW-FAIL    PIC 9(07) VALUE 0.           
      *                                                                         
       01  WS-RESTART-MISC.                                             
           05  WS-RESTART-DATA-LENGTH      PIC S9(04) COMP VALUE +214.  
           05  WS-IS-THIS-A-RESTART        PIC X(01) VALUE 'N'.         
               88  WS-THIS-IS-A-RESTART            VALUE 'Y'.           
           05  WS-NEXT-RECORD-READ-FLAG    PIC X(01) VALUE 'N'.         
               88  WS-NEXT-RECORD-READ             VALUE 'Y'.           
               88  WS-NEXT-RECORD-NOT-READ         VALUE 'N'.           
           05  WS-RESTART-REQ              PIC X(01).                   
           05  WS-PRINT-COUNTERS           PIC X(01) VALUE 'A'.         
           05  WS-DEFAULT-RESTART-REQ      PIC X(01) VALUE 'N'.         
           05  WS-REPOSITION-NEEDED        PIC X(01) VALUE 'Y'.         
           05  WS-FLAG-TO-TURN-OFF-COMMITS PIC 9(04) VALUE 9999.        
           05  WS-DEFAULT-CHKP-LUW-LIMIT   PIC 9(04) VALUE 4.           
           05  WS-CHKP-LUW-LIMIT           PIC 9(04).                   
           05  WS-CHKP-LUW-COUNTER         PIC 9(04) COMP-3 VALUE ZERO. 
           05  WS-DEFAULT-CHKP-UPD-LIMIT   PIC 9(04) VALUE 20.          
           05  WS-CHKP-UPD-LIMIT           PIC 9(04).                   
           05  WS-CHKP-UPD-COUNTER         PIC S9(04) COMP-3 VALUE ZERO.
           05  WS-CHKP-ID.                                              
               10  WS-CHKP-PGM-ID          PIC X(02) VALUE 'B4'.        
               10  WS-CHKP-PART-NO         PIC 9(01) VALUE 1.           
               10  WS-CHKP-SEQ-NO          PIC 9(05) VALUE ZERO.        
      *****************************************************************         
      *    THE FOLLOWING FIELD WILL ALLOW PROGRAMMER TO FORCE ABEND BY          
      *    SPECIFYING AN ACCOUNT NO                                             
      *****************************************************************         
           05  WS-STOP-ACCOUNT-NO          PIC 9(13).                   
      *                                                                         
       01  WS-STOP-PARM-BREAKDOWN.                                      
           05  WS-STOP-PARM-ACCOUNT-NO     PIC 9(10).                   
           05  FILLER                      PIC X(38).                   
      *                                                                         
       01  WS-WORK-QUEUE-DIRECTION.                                     
           05  WS-CATEGORY-ID              PIC S9(04)  COMP VALUE 33.   
           05  WS-CATEGORY-ID-141          PIC S9(04)  COMP VALUE 141.  
           05  WS-CATEGORY-ID-142          PIC S9(04)  COMP VALUE 142.  
A03352     05  WS-CATEGORY-ID-528          pic S9(04)  COMP VALUE 528.  
A03352     05  WS-CATEGORY-ID-529          pic S9(04)  COMP VALUE 529.  
ACT256     05  WS-CATEGORY-ID-581          pic S9(04)  COMP VALUE 581.  
ACT256     05  WS-CATEGORY-ID-582          pic S9(04)  COMP VALUE 582.  
ACT301     05  WS-CATEGORY-ID-583          PIC S9(04)  COMP VALUE 583.  
ACT301     05  WS-CATEGORY-ID-584          PIC S9(04)  COMP VALUE 584.  
           05  WS-CATEGORY-ID-167          PIC S9(04)  COMP VALUE 167.  
           05  WS-CATEGORY-ID-173          PIC S9(04)  COMP VALUE 173.  
           05  WS-CATEGORY-ID-253          PIC S9(04)  COMP VALUE 253.  
           05  WS-CATEGORY-ID-282          PIC S9(04)  COMP VALUE 282.  
           05  WS-CATEGORY-ID-283          PIC S9(04)  COMP VALUE 283.  
           05  WS-CATEGORY-ID-284          PIC S9(04)  COMP VALUE 284.  
           05  WS-CATEGORY-ID-232          PIC S9(04)  COMP VALUE 232.  
C35066     05  WS-CATEGORY-ID-15           PIC S9(04)  COMP VALUE 15.   
C35597**** CATEGORY-ID 17  / CATEGORY-NAME = 'BILL EXCEPTION-EDP'               
C35597     05  WS-CATEGORY-ID-17           PIC S9(04)  COMP VALUE 17.   
           05  WS-ROUTING-CATEGORY         PIC X       VALUE '1'.       
           05  WS-NORMAL-PRIORITY          PIC X       VALUE 'N'.       
      *                                                                         
       01  WS-WQ-COMMENTS.                                              
           05  WS-WQ-COMMENTS-TEXT         PIC X(250) VALUE SPACES.     
           05  WS-WQ-ISSUE-DESC            PIC X(175) VALUE SPACES.     
      *                                                                         
C35597     05  WS-AGL-WQ-TXT.                                           
C35597         10 WS-AGL-WQ-TXT-STR        PIC X(51) VALUE              
C35597         'AGL MTR READ Charge has more than one factor'.          
                                                                        
           05  WS-WQ-MESSAGE               PIC X(85) VALUE SPACES.      
C33889     05  WS-COMMENTS-TEXT            PIC X(250) VALUE SPACES.     
C35418     05  WS-AMR-WQ-PFIX              PIC X(11) VALUE              
C35418         'AMR READ - '.                                           
P00462     05  WS-AMI-SS-WQ-PFIX           PIC X(18) VALUE              
P00462         'SMARTSYNCH READ - '.                                    
PRJ914     05  WS-AMI-OPEN-WAY-PFIX        PIC X(16) VALUE              
PRJ914         'OPEN WAY READ - '.                                      
      *                                                                         
           05  WS-WQ-ERROR-TEXT.                                        
               10 FILLER                   PIC X(40) VALUE              
                 'ERROR: METER WAS NOT PROCESSED. METER = '.            
               10 WS-WQ-ERROR-METER-NO     PIC X(09) VALUE SPACE.       
               10 FILLER                   PIC X(01) VALUE SPACE.       
               10 FILLER                   PIC X(10) VALUE              
                  'REGISTER: '.                                         
               10 WS-WQ-E-USAGE-TYPE-DESC  PIC X(03) VALUE SPACES.      
               10 FILLER                   PIC X(01) VALUE SPACE.       
           05  WS-WQ-WARNING-TEXT.                                      
               10 FILLER                   PIC X(50) VALUE              
                 'WARNING: METER WAS PROCESSED WITH MESSAGE. METER= '.  
               10 WS-WQ-WARN-METER-NO      PIC X(9)  VALUE ' '.         
               10 FILLER                   PIC X(01) VALUE SPACE.       
               10 FILLER                   PIC X(10) VALUE              
                  'REGISTER: '.                                         
               10 WS-WQ-W-USAGE-TYPE-DESC  PIC X(03) VALUE SPACES.      
               10 FILLER                   PIC X(01) VALUE SPACE.       
           05  WS-WQ-READ-DET.                                          
               10 FILLER                   PIC X(06) VALUE              
                  'PEAK: '.                                             
               10 WS-WQ-PEAK-DESC          PIC X(08) VALUE SPACES.      
               10 FILLER                   PIC X(10) VALUE              
                  ' SEASON: '.                                          
               10 WS-WQ-SEASN-DESC         PIC X(08) VALUE SPACES.      
               10 FILLER                   PIC X(12) VALUE              
                  ' READ DATE: '.                                       
               10 WS-WQ-READ-DT            PIC X(10) VALUE SPACES.      
               10 FILLER                   PIC X(08) VALUE              
                  ' INDEX: '.                                           
               10 WS-WQ-READ-INDEX         PIC X(08) VALUE SPACES.      
               10 FILLER                   PIC X(08) VALUE              
                  ' USAGE: '.                                           
               10 WS-WQ-USAGE              PIC Z(9)9 VALUE ZEROS.       
               10 FILLER                   PIC X(13) VALUE              
                  ' USAGE DAYS: '.                                      
               10 WS-WQ-USAGE-DAYS         PIC Z(3)9 VALUE ZEROS.       
               10 FILLER                   PIC X(01) VALUE SPACE.       
           05  WS-WQ-HI-LO-DET.                                         
               10 FILLER                   PIC X(05) VALUE              
                  'HIGH='.                                              
               10 WS-WQ-DISP-HI-VAL        PIC Z(9)9 VALUE ZEROS.       
               10 FILLER                   PIC X(05) VALUE              
                  ' LOW='.                                              
               10 WS-WQ-DISP-LO-VAL        PIC Z(9)9 VALUE ZEROS.       
               10 FILLER                   PIC X(01) VALUE SPACE.       
      *                                                                         
       01  WS-ERROR-MESSAGES.                                           
C37129     05  MSG-PENDING-OFF             PIC X(39)   VALUE            
C37129         'PENDING OFF ORDER EXISTS IN THE SYSTEM.'.               
           05  MSG-NO-MTRD-ENV             PIC X(40)   VALUE            
               'ACCOUNT/METER COMBINATION IS NOT VALID. '.              
C29853     05  MSG-SEB-SYSTEM-EST          PIC X(36)   VALUE            
C29853         'METER WAS ALREADY SYSTEM ESTIMATED. '.                  
C30662     05  MSG-DEMAND-RESET-ERROR      PIC X(39)   VALUE            
C30662         'DEMAND READ IS SAME AS LAST MONTH READ.'.               
C31697     05  MSG-UCG-ERROR.                                           
C31697         10  FILLER                  PIC X(52)   VALUE            
C31697         'MECHANICAL/UNC REGISTERS ARE OUT OF SYNC. UNC READ= '.  
C31697         10  WS-WQ-UNC               PIC Z(8)9.                   
C31697     05  MSG-DUPLICATE-READ          PIC X(42)   VALUE            
C31697         'SAME READING POSTED TWICE. PLEASE CORRECT.'.            
C35066     05  MSG-MORE-THAN-ONE-READ      PIC X(53)   VALUE            
C35066         'READS RECEIVED MORE THAN ONCE.PLEASE CHECK PANEL 035.'. 
           05  MSG-DUP-MTRD-ENV            PIC X(28)   VALUE            
               'DUPLICATE MTRD ENV. FOUND. '.                           
PRJ914     05  MSG-MTR-CHNG-DEMAND-CORR    PIC X(41)   VALUE            
PRJ914         'MTR XCHANGE DEMAND READS NEED CORRECTION.'.             
PRJ914     05  MSG-CC-CHNG-DEMAND-CORR    PIC X(40)   VALUE             
PRJ914         'FINAL BILL DEMAND READS NEED CORRECTION.'.              
           05  MSG-NO-MTR-CAP              PIC X(25)   VALUE            
               'NO METER CAPABILITY.'.                                  
C36317     05  MSG-NO-MTR-READ             PIC X(37)   VALUE            
C36317         'SECURED ACCT MTR DOES NOT HAVE READS.'.                 
           05  MSG-NO-MN-RG-ERR            PIC X(43)   VALUE            
               'REGISTER IS NOT SET UP FOR THE USAGE TYPE.'.            
           05  MSG-BILL-CYCLE-CLOSED       PIC X(25)   VALUE            
               'BILL CYCLE IS CLOSED.'.                                 
           05  MSG-BL-WINDOW-NOT-FOUND     PIC X(25)   VALUE            
               'BILL WINDOW NOT FOUND.'.                                
           05  MSG-RD-WINDOW-NOT-FOUND     PIC X(25)   VALUE            
               'READ WINDOW NOT FOUND'.                                 
           05  MSG-MTR-CONST-SURVEY        PIC X(25)   VALUE            
               'MTR CONSTANT CHANGED.'.                                 
           05  MSG-NO-MTR-RD-FMT-ENTRY     PIC X(49)   VALUE            
               'MTR-RD-FORMAT ENTRY DOES NOT EXIST FOR THIS READ.'.     
           05  MSG-NO-CALC-POW-FCTR        PIC X(25)   VALUE            
               'CANNOT FIGURE POWER FCTR'.                              
           05  WS-ERR-MSG-ROTARY-INDX-TST  PIC X(30) VALUE              
               'FAILED ROTARY INDEX DRIVE TEST'.                        
           05  WS-ERR-MSG-HI-LO            PIC X(23) VALUE              
               'FAILED HIGH\LOW CHECK'.                                 
A01738     05  WS-ERR-MSG-VERIFIED-HI      PIC X(35) VALUE              
P00251         'FAILED HIGH CHECK,VERIFIED IN FIELD'.                   
A01738     05  WS-ERR-MSG-VERIFIED-LO      PIC X(34) VALUE              
P00251         'FAILED LOW CHECK,VERIFIED IN FIELD'.                    
           05  WS-ERR-MSG-KWH              PIC X(60) VALUE              
            'TIME PERIODS TOTAL KWH DIFFER FROM TOTAL KWH BY > 1 UNIT'. 
           05  MSG-ACCOUNT-NO-NOT-FOUND.                                
               10 FILLER                   PIC X(12)   VALUE            
                                                       'ACCOUNT NO. '.  
               10 MSG-ACCOUNT-NO           PIC X(13).                   
               10 FILLER                   PIC X(12) VALUE              
                  ' NOT FOUND.'.                                        
           05  MSG-NEW-METER-FOUND.                                     
               10 FILLER                   PIC X(35)   VALUE            
                  'NEW METER FOUND ON ROUTE OF READER '.                
               10 MSG-NEW-MTR-READER       PIC X(05).                   
               10 FILLER                   PIC X(05) VALUE              
                  ' AT: '.                                              
               10 MSG-NEW-MTR-LOCATION     PIC X(40).                   
           05  MSG-INACT-METER-HAS-USE     PIC X(34)   VALUE            
               'INACTIVE ACCOUNT/METER HAS USAGE.'.                     
           05  MSG-REMV-METER-HAS-READ     PIC X(30)   VALUE            
               'REMOVED METER HAS READING.'.                            
           05  MSG-CARD-READ-LIMIT         PIC X(25)   VALUE            
               'CARD READ LIMIT-WARNING.'.                              
           05  MSG-FAILED-LO-UNC-RATIO     PIC X(30)   VALUE            
               'FAILED LOW UNCORRECTED RATIO.'.                         
           05  MSG-FAILED-HI-UNC-RATIO     PIC X(30)   VALUE            
               'FAILED HIGH UNCORRECTED RATIO.'.                        
           05  MSG-FAILED-LO-INT-RATIO     PIC X(28)   VALUE            
               'FAILED LOW INTERNAL RATIO.'.                            
           05  MSG-FAILED-HI-INT-RATIO     PIC X(28)   VALUE            
               'FAILED HIGH INTERNAL RATIO.'.                           
           05  MSG-LOW-CHECK-2-FAIL        PIC X(25)   VALUE            
               'FAILED LOW CHECK 2.'.                                   
           05  MSG-HIGH-CHECK-1-FAIL       PIC X(25)   VALUE            
               'FAILED HIGH CHECK 1.'.                                  
           05  MSG-HIGH-CHECK-2-FAIL       PIC X(25)   VALUE            
               'FAILED HIGH CHECK 2'.                                   
           05  MSG-LOW-2-FAIL-WITH-X       PIC X(25)   VALUE            
               'FAILED LOW CHECK NO MTR'.                               
           05  MSG-HIGH-2-FAIL-WITH-X      PIC X(25)   VALUE            
               'FAILED HIGH CHECK NO MTR'.                              
           05  MSG-LOAD-LOW-CHECK-FAIL     PIC X(29)   VALUE            
               'FAILED LOAD FACTOR LOW CHECK '.                         
           05  MSG-POWER-LOW-CHECK-FAIL    PIC X(30)   VALUE            
               'FAILED POWER FACTOR LOW CHECK '.                        
           05  MSG-LOAD-HIGH-CHECK-FAIL    PIC X(30)   VALUE            
               'FAILED LOAD FACTOR HIGH CHECK '.                        
           05  MSG-POWER-HIGH-CHECK-FAIL   PIC X(31)   VALUE            
               'FAILED POWER FACTOR HIGH CHECK '.                       
           05  MSG-IMPOSSIBLE-USE          PIC X(31)   VALUE            
               'METER RECORDED IMPOSSIBLE USE. '.                       
           05  MSG-NON-MATCH-KWH.                                       
               10 FILLER                   PIC X(54)   VALUE            
               'TIME PERIODS TOTAL USAGE NOT = USAGE FROM MECH READING'.
           05  MSG-FULL-SCALE-LIMIT        PIC X(54)   VALUE            
               'DEMAND READING IS GREATER THAN OR EQUAL TO FULL SCALE.'.
           05  MSG-FAIL-HILO-ZERO-USE.                                  
               10 FILLER                   PIC X(32)  VALUE             
               'ZERO USE FAILED HIGH LOW CHECK. '.                      
               10 FILLER                   PIC X(45)  VALUE             
               'CHECK FOR ZERO USE INVESTIGATION WORK QUEUE.'.          
           05  MSG-FAILED-HIGH.                                         
               10 FILLER                   PIC X(20)  VALUE             
               'FAILED HIGH CHECK.'.                                    
           05  MSG-FAILED-LOW.                                          
               10 FILLER                   PIC X(19)  VALUE             
               'FAILED LOW CHECK.'.                                     
           05  MSG-METER-EXCEED-LIMIT      PIC X(37)  VALUE             
               'NUMBER OF UNITS EXCEEDS ONE MILLION. '.                 
           05  MSG-METER-HAS-NEG-USE       PIC X(19)  VALUE             
               'USAGE IS NEGATIVE. '.                                   
           05  MSG-TOU-READ-FAILED         PIC X(51)  VALUE             
               'ONE OR MORE TOU REGISTERS FAILED READ VALIDATIONS. '.   
P00508     05 MSG-TOU-MDM-ESTIMATE         PIC X(44)  VALUE             
P00508         'ONE OR MORE TOU REGISTERS ESTIMATED IN MDM. '.          
P00508     05 MSG-TOU-HILO-CIS.                                         
P00508        10 FILLER                    PIC X(51)  VALUE             
P00508         'ONE OR MORE TOU REGISTERS FAILED HI/LO VALIDATIONS '.   
P00508        10 FILLER                    PIC X(08)  VALUE             
P00508                                                    'IN CIS. '.   
P00508     05 MSG-TOU-HILO-MDM.                                         
P00508        10 FILLER                    PIC X(51)  VALUE             
P00508         'ONE OR MORE TOU REGISTERS FAILED HI/LO VALIDATIONS '.   
P00508        10 FILLER                    PIC X(08)  VALUE             
P00508                                                    'IN MDM. '.   
P00508     05 MSG-TOU-HILO-CIS-MDM.                                     
P00508        10 FILLER                    PIC X(51)  VALUE             
P00508         'ONE OR MORE TOU REGISTERS FAILED HI/LO VALIDATIONS '.   
P00508        10 FILLER                    PIC X(14)  VALUE             
P00508                                              'IN CIS & MDM. '.   
P00508     05  MSG-SS-HILO-CIS             PIC X(34) VALUE              
P00508         'FAILED HIGH/LOW VALIDATIONS IN CIS'.                    
P00508     05  MSG-SS-HILO-MDM             PIC X(34) VALUE              
P00508         'FAILED HIGH/LOW VALIDATIONS IN MDM'.                    
P00508     05  MSG-SS-HILO-CIS-MDM         PIC X(40) VALUE              
P00508         'FAILED HIGH/LOW VALIDATIONS IN CIS & MDM'.              
30989      05  MSG-GAS-METER-CONSTANT      PIC X(39)  VALUE             
30989          'GAS METER HAS CONSTANT GREATER THAN 1. '.               
P00447     05  MSG-ELECTRIC-METER-CONSTANT PIC X(33)  VALUE             
P00447         'ELECTRIC METER CONSTANT IS ZERO. '.                     
C37526     05  MSG-INVALID-READ-DATE       PIC X(29)  VALUE             
C37526         'METER READ DATE IS IN FUTURE.'.                         
C36829     05  MSG-INVALID-DATE-DIFF       PIC X(50)  VALUE             
C36829         'DATE DIFF BTWN CURRENT AND LAST READ DATE IS > 90.'.    
P00246     05  MSG-NEW-BG-CREATED          PIC X(50)   VALUE            
P00246         'CX Days > 45. New BG Created. Account put on Hold.'.    
A05744     05  MSG-UNAUTHORIZED-GEN-MTR.                                
A05744         10 FILLER                   PIC X(48)   VALUE            
A05744            'UNAUTHORIZED USE ON RENEWABLES GENERATION METER.'.   
A03494     05  MSG-SEB-AFTER-ITRON-READ-DATE PIC X(46)  VALUE           
A03494         'METER ALREADY READ ON OR AFTER ITRON READ DATE'.        
      *                                                                         
A04880 01  WS-SEASONAL-MONTH-PARM-DATA.                                 
A04880     05  WS-SEASONAL-PARM-TEXT       PIC X(16).                   
A04880     05  WS-SEASONAL-MONTH           PIC XX.                      
A04880     05  FILLER                      PIC X(62).                   
      *                                                                         
       01  WS-HILO-DATA.                                                
           05  FILLER                      PIC X(14).                   
           05  WS-HILO-ON-PARM             PIC X(01).                   
               88  HILO-ON-PARM                       VALUE 'Y'.        
           05  FILLER                      PIC X(65).                   
      *                                                                         
C35066 01  WS-FIELD-HILO-SYMBOLS.                                       
C35066     05  FILLER                      PIC X(29).                   
C35066     05  WS-HILO-SYMBOL-LIST         PIC X(10).                   
C35066     05  WS-HILO-SYMBOL-RED REDEFINES WS-HILO-SYMBOL-LIST.        
C35066         10  WS-HILO-SYMBOL-TAB  OCCURS 10 TIMES.                 
C35066             15 WS-HILO-SYMBOL       PIC X.                       
C35066     05  FILLER                      PIC X(41).                   
C35066*                                                                         
C33023 01  WS-AGL-VARIABLES.                                            
C33023     05  WS-AGL-LAST-REV-MONTH       PIC 9(6) VALUE ZERO.         
C33023     05  WS-AGL-LAST-REV-CCYY        PIC 9(4) VALUE ZERO.         
C33023     05  WS-AGL-LAST-REV-MM          PIC 9(2) VALUE ZERO.         
C33023     05  WS-AGL-CUR-REV-MONTH        PIC 9(06)  VALUE ZERO.       
C33023     05  WS-AGL-ACCOUNT-NO           PIC 9(13) VALUE ZEROES.      
C33023     05  WS-AGL-FACTOR-FL            PIC X(01) VALUE ' '.         
C33023         88 WS-AGL-FACTOR-EXISTS               VALUE 'Y'.         
C33023         88 WS-AGL-FACTOR-NOT-EXISTS           VALUE ' '.         
C33023     05  WS-AGL-NRML-REV-MONTH       PIC 9(6) VALUE ZERO.         
C33023     05  WS-AGL-BN-REV-MONTH         PIC S9(6)V COMP-3            
C33023                                               VALUE ZERO.        
                                                                        
C33023 01  WS-AGL-CONSTANTS.                                            
C33023     05  WS-AGL-FF-FACTOR            PIC S9(9)V9(4) COMP-3        
C33023                                     VALUE 0.                     
C33023     05  WS-AGL-FF-FACTOR-ID         PIC X(9)                     
C33023                                     VALUE 'AGLMTCHRG'.           
C33023*                                                                         
ACT015*                                                                         
ACT015 01  WS-FRMT-WQ-TS.                                               
ACT015     05 WS-FRMT-WQ-DT               PIC X(10).                    
ACT015     05 WS-FRMT-WQ-TIME             PIC X(16)                     
ACT015                                    VALUE '-00.00.00.000000'.     
ACT015*                                                                         
       01  RS-RPC-RETURN-CODE.                                          
           05  RS-RETURN-CODE              PIC S9(9) VALUE +000 COMP.   
           05  RS-RETURN-CODE-DISP         PIC S9(9) VALUE +000 COMP.   
P00246 01  S-RETURN-CODE                   PIC S9(9) VALUE 0.           
      *                                                                         
       COPY FIOJC01.                                                            
       COPY CWS00038.                                                           
HPCCDM*EJECT                                                                    
      *                                                                         
      *** PARTITION HANDLING WORK VARIABLES ***                                 
           EXEC SQL                                                             
               INCLUDE CWS00042                                                 
           END-EXEC.                                                            
HPCCDM*EJECT                                                                    
      *                                                                         
      *** ERROR HANDLING WORK VARIABLES ***                                     
       COPY CWS00010.                                                           
       COPY CWS09900.                                                           
       COPY CWS00303.                                                           
      *                                                                         
ACT015/***** FOR WQ INSERT - WORKING STORAGE COPYBOOK FOR SCSCB077              
ACT015     EXEC SQL                                                             
ACT015          INCLUDE CWS00077                                                
ACT015     END-EXEC.                                                            
ACT015                                                                  
      *** THRESHOLDS VALUES ***                                                 
       COPY CWS00314.                                                           
      *                                                                         
      *****************************************************************         
      *    DB2 TABLE DCLGENS USING IN THIS PROGRAM                    *         
      *****************************************************************         
      *****************************************************************         
      *    DCLGEN FOR CSS_ACCOUNT                                     *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBACCT                                                   
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_BILL_WINDOW                                 *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBBILWDW                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_BILLING_DET                                 *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBBLLDET                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_BILLING_HDR                                 *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBBLLHDR                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_CNSMPTN_HIST                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBCNSMP                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_EQUIPMENT                                   *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBEQUIP                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_IRRGLR_MTR_RD                               *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBIRMTRD                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_JOB_PARM                                    *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBJBPARM                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
ACT015*    DCLGEN FOR CSS_WQ_ITEMS                                    *         
      *****************************************************************         
           EXEC SQL                                                             
ACT015         INCLUDE TBWQITS                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_MTR_CAP                                     *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBMTRCAP                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_MTRD_ENVRNMT                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBMTRENV                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_PREMISE                                     *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBPREM                                                   
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_READ_WINDOW                                 *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRDWNDW                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RESTART                                     *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRESTRT                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_BATCH_PARTITION                             *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBBTHPRT                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_REGISTER_READ                               *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRGREAD                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_ROUTE_REPORT                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRTERPT                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RATE_HIGH_LOW                               *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRTHGLW                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_UTIL_ENVRNMT                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBUTLENV                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_XREF_ACCOUNT                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBXREF                                                   
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RATE_USE_SEASN                              *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRTUSES                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RATE_CREATOR                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRTCRTR                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_DELINQUENCY                                 *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBDELQ                                                   
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RATE_PLAN_DESC                              *         
      *****************************************************************         
           EXEC SQL                                                             
              INCLUDE TBRTDESC                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_HOLIDAY                                     *         
      *****************************************************************         
           EXEC SQL                                                             
              INCLUDE TBHLDAY                                                   
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_OFF_CYCL_ACCT                               *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBOFFCYL                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_RATE_VRSN_DEF                               *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRTVRSN                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_MTR_RD_FMT                                  *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBRDFMT                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_SEASONAL_USE                                *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBSNLUSE                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    DCLGEN FOR CSS_CUST_PREM_HIST                              *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE TBCSTPRM                                                 
           END-EXEC.                                                            
      *                                                                         
C29853*****************************************************************         
C29853*    DCLGEN FOR CSS_MTR_RD_SOURCE                               *         
C29853*****************************************************************         
C29853     EXEC SQL                                                             
C29853         INCLUDE TBRDSRCE                                                 
C29853     END-EXEC.                                                            
C29853*                                                                         
C33023*****************************************************************         
C33023*    DCLGEN FOR CSS_FIXED_FCTR                                  *         
C33023*****************************************************************         
C33023     EXEC SQL                                                             
C33023         INCLUDE TBFXDFCT                                                 
C33023     END-EXEC.                                                            
C33023*                                                                         
C35597*****************************************************************         
C35597*    DCLGEN FOR CSS_SPCL_FCTR                                   *         
C35597*****************************************************************         
C35597     EXEC SQL                                                             
C35597         INCLUDE TBSPLFTR                                                 
C35597     END-EXEC.                                                            
C35597*                                                                         
P00246*****************************************************************         
P00246*    DCLGEN FOR CSS_MNT_TRANS_HIST                              *         
P00246*****************************************************************         
P00246     EXEC SQL                                                             
P00246         INCLUDE TBMNHIST                                                 
P00246     END-EXEC.                                                            
P00246*                                                                         
P00246*****************************************************************         
P00246*    DCLGEN FOR CSS_MT_TRN_HST_DET                              *         
P00246*****************************************************************         
P00246     EXEC SQL                                                             
P00246         INCLUDE TBMNHDT                                                  
P00246     END-EXEC.                                                            
P00246*                                                                         
P00251*****************************************************************         
P00251*    DCLGEN FOR CSS_RATE_COMP_DEF                               *         
P00251*****************************************************************         
P00251     EXEC SQL                                                             
P00251         INCLUDE TBRTCDEF                                                 
P00251     END-EXEC.                                                            
P00251*                                                                         
PRJ914*****************************************************************         
PRJ914*    DCLGEN FOR CSS_SO_DATA                                     *         
PRJ914*****************************************************************         
PRJ914     EXEC SQL                                                             
PRJ914         INCLUDE TBSODAT                                                  
PRJ914     END-EXEC.                                                            
PRJ914*                                                                         
PRJ914*****************************************************************         
PRJ914*    DCLGEN FOR CSS_SO_FINAL_BILL                               *         
PRJ914*****************************************************************         
PRJ914     EXEC SQL                                                             
PRJ914         INCLUDE TBSOFIN                                                  
PRJ914     END-EXEC.                                                            
PRJ914*                                                                         
      *****************************************************************         
      *    DECLARATION FOR SQL COMMAN AREA                            *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE SQLCA                                                    
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    WORKING STORAGE  COPY BOOK FOR HILO-ROUTINE                *         
      *****************************************************************         
A00795     EXEC SQL                                                             
A00795         INCLUDE CWSCA072                                                 
A00795     END-EXEC.                                                            
A00795*                                                                         
      *****************************************************************         
      *    WORKING STORAGE COPY BOOK FOR CPD00099                     *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE CWS00099                                                 
           END-EXEC.                                                            
      *                                                                         
      * FCA00 MISC INPUT *                                                      
           EXEC SQL                                                             
              INCLUDE CWS00039                                                  
           END-EXEC.                                                            
           COPY FIOCA00.                                                        
      *                                                                         
           EXEC SQL                                                             
               INCLUDE CWS00111                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE CWS00140                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE CWS00315                                                 
           END-EXEC.                                                            
      *                                                                         
      ***********************************************************               
      *          CURSOR DECLARATION FOR CSS_UTIL_ENVRNMT        *               
      ***********************************************************               
           EXEC SQL                                                     
               DECLARE UTIL_ENVRNMT CURSOR FOR                          
                SELECT ACCOUNT_NO                                       
                      ,CODE_UTIL_TYPE                                   
                      ,IC_NO                                            
                      ,READ_CYCLE                                       
                      ,READ_ROUTE                                       
                  FROM CSS_UTIL_ENVRNMT WITH(READUNCOMMITTED)                   
                 WHERE ACCOUNT_NO      = :UT-ACCOUNT-NO                 
                   AND CODE_UTIL_TYPE IN ('E', 'G')                     
              ORDER BY ACCOUNT_NO, CODE_UTIL_TYPE, IC_NO                
C35066        FOR READ ONLY                                     
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ004
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DECLARE UTIL_ENVRNMT CURSOR FOR                                  
MFA-TR*         SELECT ACCOUNT_NO                                               
MFA-TR*               ,CODE_UTIL_TYPE                                           
MFA-TR*               ,IC_NO                                                    
MFA-TR*               ,READ_CYCLE                                               
MFA-TR*               ,READ_ROUTE                                               
MFA-TR*           FROM CSS_UTIL_ENVRNMT                                         
MFA-TR*          WHERE ACCOUNT_NO      = :UT-ACCOUNT-NO                         
MFA-TR*            AND CODE_UTIL_TYPE IN ('E', 'G')                             
MFA-TR*       ORDER BY ACCOUNT_NO, CODE_UTIL_TYPE, IC_NO                        
MFA-TR*       FOR FETCH ONLY WITH UR                                            
MFA-TR*       QUERYNO 7500                                                      
MFA-TR*    END-EXEC.                                                            
C35066*                                                                         
C35066***********************************************************               
C35066*          CURSOR DECLARATION FOR CSS_ROUTE_REPORT        *               
C35066***********************************************************               
C35066     EXEC SQL                                                     
C35066         DECLARE ROUTE_REPORT CURSOR FOR                          
C35066         SELECT REG_MEASURE_CD                                    
C35066               ,LAST_REG_READ_DT                                  
C35066               ,REPLACE(CONVERT(CHAR(8), LAST_REG_READ_TM, 108), 
           ':', '.') LAST_REG_READ_TM                                  
C35066               ,TYPE_OF_RD_IND                                    
C35066               ,READING_COND_CD                                   
C36533               ,READING_CODE                                      
C35066         FROM  CSS_ROUTE_REPORT WITH(READUNCOMMITTED)                     
C35066         WHERE ACCOUNT_NO        = :PW-ACCOUNT-NO                 
C35066           AND REVENUE_MONTH     = :PW-REVENUE-MONTH              
C35066           AND CODE_UTIL_TYPE    = :PW-CODE-UTIL-TYPE             
C35066           AND IC_NO             = :PW-IC-NO                      
C35066           AND METER_NO          = :PW-METER-NO                   
C35066           AND REG_MEASURE_CD   IN (:PW-REG-MEASURE-CD, 'TOU')    
C35066           AND CODE_TIME_PERIOD  = :PW-CODE-TIME-PERIOD           
C35066           AND CODE_TOU_SEASN    = :PW-CODE-TOU-SEASN             
C35066           AND READ_CYCLE        = :PW-READ-CYCLE                 
P00251           AND CODE_USAGE_ID     = :PW-CODE-USAGE-ID              
C35066         FOR READ ONLY                                    
A03352                                                      
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ004
MFA-TR* MSQ022
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DECLARE ROUTE_REPORT CURSOR FOR                                  
MFA-TR*        SELECT REG_MEASURE_CD                                            
MFA-TR*              ,LAST_REG_READ_DT                                          
MFA-TR*              ,LAST_REG_READ_TM                                          
MFA-TR*              ,TYPE_OF_RD_IND                                            
MFA-TR*              ,READING_COND_CD                                           
MFA-TR*              ,READING_CODE                                              
MFA-TR*        FROM  CSS_ROUTE_REPORT                                           
MFA-TR*        WHERE ACCOUNT_NO        = :PW-ACCOUNT-NO                         
MFA-TR*          AND REVENUE_MONTH     = :PW-REVENUE-MONTH                      
MFA-TR*          AND CODE_UTIL_TYPE    = :PW-CODE-UTIL-TYPE                     
MFA-TR*          AND IC_NO             = :PW-IC-NO                              
MFA-TR*          AND METER_NO          = :PW-METER-NO                           
MFA-TR*          AND REG_MEASURE_CD   IN (:PW-REG-MEASURE-CD, 'TOU')            
MFA-TR*          AND CODE_TIME_PERIOD  = :PW-CODE-TIME-PERIOD                   
MFA-TR*          AND CODE_TOU_SEASN    = :PW-CODE-TOU-SEASN                     
MFA-TR*          AND READ_CYCLE        = :PW-READ-CYCLE                         
MFA-TR*          AND CODE_USAGE_ID     = :PW-CODE-USAGE-ID                      
MFA-TR*        FOR FETCH ONLY WITH UR                                           
MFA-TR*        QUERYNO 7250                                                     
MFA-TR*    END-EXEC.                                                            
      *                                                                         
       PROCEDURE DIVISION.                                              
      ******************************************************************        
      *        CONTROLS THE MAIN PROCESS OF PROGRAM                    *        
      ******************************************************************        
       0000-MAINLINE.                                                   
      *                                                                         
           PERFORM 0100-INITIALIZATION         THRU 0100-EXIT.          
           PERFORM 1000-PROCESS-MAIN THRU 1000-EXIT                     
                 UNTIL END-OF-FBW06 OR CNTRL-REC-REACHED.               
           PERFORM 1050-PROCESS-END-OF-FILE THRU 1050-EXIT.             
      *                                                                         
      ******************************************************************        
      * THE FOLLOWING STATEMENTS UPGRADE THE JOB-COMPLETE FIELD TO     *        
      * INDICATE A SUCCESSFUL COMPLETION:                              *        
      ******************************************************************        
           MOVE SPACES                     TO WS-RESTART-JOB-COMPLETE.  
           IF  WS-THIS-IS-A-RESTART                                     
               SET WS-RERUN-COMPLETED      TO TRUE                      
           ELSE                                                         
               SET WS-RUN-COMPLETED-NO-PROBLEMS                         
                                           TO TRUE                      
           END-IF.                                                      
           IF  WS-CHKP-LUW-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS      
                 AND WS-CHKP-UPD-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS
               NEXT SENTENCE                                            
           ELSE                                                         
               PERFORM 8898-ISSUE-CHKP           THRU 8898-EXIT         
           END-IF.                                                      
      *                                                                         
           IF  WS-RESTART-REQ EQUAL WS-YES                              
               PERFORM 8893-RESET-RESTART-REQ-PARM  THRU 8893-EXIT      
           END-IF.                                                      
      *                                                                         
           PERFORM 8940-DISPLAY-COUNTERS       THRU 8940-EXIT.          
           PERFORM 9000-TERMINATE              THRU 9000-EXIT.          
           STOP RUN.                                                    
      *                                                                         
       0000-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *        COMMON INITIALIZATION ROUTINE.                          *        
      *        RETRIEVE JOB PARMS.                                     *        
      ******************************************************************        
       0100-INITIALIZATION.                                             
      *                                                                         
           OPEN INPUT FCSBW06-FILE.                                     
      *                                                                         
      *    GET COMMON DATE                                                      
           PERFORM 6251-GET-FJC01-DATE         THRU 6251-EXIT.          
           IF  COMMON-DATE-NEEDED                                       
               PERFORM 6240-GET-FCA00-COMMON-DATE THRU 6240-EXIT        
               DISPLAY 'COMMON DATE ==> ' WS-FCA00-COMMON-DATE          
               MOVE WS-FCA00-COMMON-DATE   TO WS-INPUT-DATE             
                                              WS-NEW-BUSINESS-DAY       
               PERFORM 6500-GET-NEXT-BUSINESS-DAY THRU                  
                      6500-NEXT-BUSINESS-DAY-EXIT                       
                      UNTIL NEXT-BUSINESS-DAY-FOUND                     
               MOVE WS-NEW-BUSINESS-DAY    TO WS-INPUT-DATE             
           END-IF.                                                      
           MOVE WS-INPUT-DATE              TO WS-RUN-DATE               
                                              WS-WORK-DATE.             
      *                                                                         
27793      MOVE  WS-PGRMNAME TO WS-PROGRAM                              
27793                           ABEND-PROGRAM.                          
27793      MOVE  WS-PARM     TO WS-COMMAND.                             
27793      MOVE  ZEROS       TO WS-SEQUENCE.                            
27793      MOVE  SPACES      TO WS-SYSIPT.                              
27793      MOVE  WS-KEY-AREA TO E-FJC01-KEY.                            
27793      PERFORM 7600-START-FCSJC01 THRU  7600-EXIT.                  
      *                                                                         
27793      PERFORM 7610-READ-FCSJC01 THRU  7610-EXIT                    
27793          UNTIL (WS-INPUT-DATA-BREAKDOWN(1:31) =                   
27793                'CREATE WQS ON MID-MONTH READS=Y'                  
27793                     AND INPUT-ACTIVE)                             
27793             OR END-OF-SYSIPT.                                     
      *                                                                         
27793      IF  END-OF-SYSIPT                                            
27793          DISPLAY ' '                                              
27793          DISPLAY '** ' WS-PGRMNAME ' INFORMATIONAL MSG **'        
27793          DISPLAY '**  MID-MONTH WQ PARM NOT ACTIVE OR  **'        
27793          DISPLAY '**  SET TO NO - PROCESSING CONTINUES **'        
27793          DISPLAY ' '                                              
27793          MOVE WS-N TO WS-DO-I-CREATE-MID-MONTH-WQ                 
27793      ELSE                                                         
27793          DISPLAY ' '                                              
27793          DISPLAY '** ' WS-PGRMNAME ' INFORMATIONAL MSG **'        
27793          DISPLAY '**  MID-MONTH WQ PARM IS ACTIVE AND  **'        
27793          DISPLAY '**  SET TO YES - PROCESSING CONTINUES**'        
27793          DISPLAY ' '                                              
27793          MOVE WS-Y TO WS-DO-I-CREATE-MID-MONTH-WQ                 
27793          PERFORM 7611-CLOSE THRU 7611-EXIT                        
27793      END-IF.                                                      
      *                                                                         
           MOVE WS-PGRMNAME                TO WS-PROGRAM.               
           MOVE SPACES                     TO WS-SYSIPT.                
           MOVE ZEROS                      TO WS-SEQUENCE.              
           MOVE WS-DATE                    TO WS-COMMAND.               
      *                                                                         
           PERFORM 7600-START-FCSJC01 THRU 7600-EXIT.                   
           PERFORM 7610-READ-FCSJC01 THRU 7610-EXIT                     
                    UNTIL (REVENUE-MONTH AND INPUT-ACTIVE)              
                       OR END-OF-SYSIPT.                                
           IF  END-OF-SYSIPT                                            
               MOVE SPACES                 TO WS-SYSIPT                 
               MOVE 'COMMON'               TO WS-PROGRAM                
               MOVE ZERO                   TO WS-SEQUENCE               
               PERFORM 7600-START-FCSJC01 THRU 7600-EXIT                
               PERFORM 7610-READ-FCSJC01 THRU 7610-EXIT                 
                        UNTIL (REVENUE-MONTH AND INPUT-ACTIVE)          
                           OR END-OF-SYSIPT                             
               IF  END-OF-SYSIPT                                        
                   MOVE ZEROS              TO WS-CURR-REV-MONTH         
               ELSE                                                     
                   MOVE WS-REVENUE-MONTH-PARM                           
                                           TO WS-CURR-REV-MONTH         
                   PERFORM 7611-CLOSE THRU 7611-EXIT                    
               END-IF                                                   
           ELSE                                                         
               MOVE WS-REVENUE-MONTH-PARM  TO WS-CURR-REV-MONTH         
               PERFORM 7611-CLOSE THRU 7611-EXIT                        
           END-IF.                                                      
           MOVE WS-CURR-REV-MONTH          TO RW-REVENUE-MONTH.         
      *                                                                         
           PERFORM 0101-GET-PARTITION-DATA     THRU 0101-EXIT.          
      *                                                                         
           MOVE '01'                       TO C8-COMPANY-NO.            
           PERFORM 6500-LOAD-EXCP-LIMITS       THRU                     
                             6500-LOAD-EXCP-LIMITS-EXIT.                
           PERFORM 6253-GET-FJC01-CHKP-LIMIT   THRU 6253-EXIT.          
           IF  WS-CHKP-LUW-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS      
                 AND WS-CHKP-UPD-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS
               DISPLAY ' '                                              
               DISPLAY '**   ' WS-PGRMNAME ' INFORMATIONAL MSG    **'   
               DISPLAY '**   CHKP-LUW AND CHKP-UPD PARMS   **'          
               DISPLAY '** BOTH SET TO ' WS-FLAG-TO-TURN-OFF-COMMITS    
                       ', INTERPRETED TO**'                             
               DISPLAY '**  INDICATE THAT INTERIM COMMIT   **'          
               DISPLAY '**   POINTS SHOULD NOT BE TAKEN.   **'          
               DISPLAY '** COMPLETE RERUN WILL BE REQUIRED **'          
               DISPLAY '**  UPON UNSUCCESSFUL COMPLETION.  **'          
               DISPLAY '**      PROCESSING CONTINUING      **'          
           END-IF.                                                      
      *                                                                         
           PERFORM 6254-GET-FJC01-STOP-KEY     THRU 6254-EXIT.          
           MOVE WS-STOP-KEY                TO WS-STOP-PARM-BREAKDOWN.   
           IF  WS-STOP-PARM-ACCOUNT-NO NUMERIC                          
               MOVE WS-STOP-PARM-ACCOUNT-NO                             
                                           TO WS-STOP-ACCOUNT-NO        
           ELSE                                                         
               MOVE 9999999999999          TO WS-STOP-ACCOUNT-NO        
           END-IF.                                                      
      *                                                                         
           PERFORM 6235-GET-FJC01-RESTART-REQ  THRU 6235-EXIT.          
C35066*                                                                         
C35066* GET FIELD HI-LO EXCEPTION SYMBOLS (EX:#@,,,)                            
C35066     MOVE  WS-PGRMNAME               TO WS-PROGRAM                
C35066                                        ABEND-PROGRAM.            
C35066     MOVE  WS-PARM                   TO WS-COMMAND.               
C35066     MOVE  ZEROS                     TO WS-SEQUENCE.              
C35066     MOVE  SPACES                    TO WS-SYSIPT.                
C35066     MOVE  WS-KEY-AREA               TO E-FJC01-KEY.              
C35066     PERFORM 7600-START-FCSJC01          THRU  7600-EXIT.         
C35066     PERFORM 7610-READ-FCSJC01           THRU  7610-EXIT          
C35066         UNTIL (WS-INPUT-DATA-BREAKDOWN(1:29) =                   
C35066     'FIELD-HILO-EXCEPTION-SYMBOLS=' AND INPUT-ACTIVE)            
C35066            OR  END-OF-SYSIPT.                                    
C35066*                                                                         
C35066     INITIALIZE WS-FIELD-HILO-SYMBOLS.                            
C35066     IF  END-OF-SYSIPT                                            
C35066         DISPLAY ' '                                              
C35066         DISPLAY '** ' WS-PGRMNAME ' INFORMATIONAL MSG        **' 
C35066         DISPLAY '** NO FIELD HILO EXCEPTION SYMBOLS PROVIDED **' 
C35066         DISPLAY '** DEFAULT SYMBOLS #@ USED                  **' 
C35066         DISPLAY '**  PROCESSING CONTINUING        **'            
C35066         MOVE '#@'                TO WS-HILO-SYMBOL-LIST          
C35066     ELSE                                                         
C35066         MOVE G6-PARM-DATA        TO WS-FIELD-HILO-SYMBOLS        
C35066         DISPLAY ' '                                              
C35066         DISPLAY '** ' WS-PGRMNAME ' INFORMATIONAL MSG        **' 
C35066         DISPLAY '** BELOW FIELD HILO EXCE SYBOLS USED        **' 
C35066         DISPLAY '** ' WS-HILO-SYMBOL-LIST                   '**' 
C35066         PERFORM 7611-CLOSE            THRU 7611-EXIT             
C35066     END-IF.                                                      
      *                                                                         
           MOVE  WS-PGRMNAME               TO WS-PROGRAM                
                                              ABEND-PROGRAM.            
           MOVE  WS-PARM                   TO WS-COMMAND.               
           MOVE  ZEROS                     TO WS-SEQUENCE.              
           MOVE  SPACES                    TO WS-SYSIPT.                
           MOVE  WS-KEY-AREA               TO E-FJC01-KEY.              
           PERFORM 7600-START-FCSJC01          THRU  7600-EXIT.         
           PERFORM 7610-READ-FCSJC01           THRU  7610-EXIT          
               UNTIL (WS-INPUT-DATA-BREAKDOWN(1:14) =                   
                         'HILO-CHECK-ON=' AND INPUT-ACTIVE)             
                  OR  END-OF-SYSIPT.                                    
           MOVE G6-PARM-DATA               TO WS-HILO-DATA.             
           IF  END-OF-SYSIPT                                            
               DISPLAY ' '                                              
               DISPLAY '** ' WS-PGRMNAME ' INFORMATIONAL MSG   **'      
               DISPLAY '**  HILO-CHECK PARM NOT ACTIVE  **'             
               DISPLAY '**  PROCESSING CONTINUING        **'            
               MOVE WS-N                   TO WS-HILO-ON-PARM           
           ELSE                                                         
               IF  WS-HILO-ON-PARM NOT EQUAL WS-Y                       
                     AND WS-HILO-ON-PARM NOT EQUAL WS-N                 
                   DISPLAY '**  PCSBW143 PROCESSING ERROR    **'        
                   DISPLAY '**  HIGH/LOW CHECK PARM NOT VALID**'        
                   DISPLAY '**    KEY = ' E-FJC01-KEY                   
                   DISPLAY '**     PROCESSING TERMINATED     **'        
                   PERFORM 9900-ABEND            THRU 9900-EXIT         
               ELSE                                                     
                   PERFORM 7611-CLOSE            THRU 7611-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           MOVE SPACES                     TO WS-WORK-QUEUE-DATA.       
      *                                                                         
           PERFORM 0600-PREPARE-FOR-RESTART    THRU 0600-EXIT.          
           PERFORM 0605-VALIDATE-RESTART-REQ   THRU 0605-EXIT.          
           IF  WS-THIS-IS-A-RESTART                                     
               MOVE WS-YES                 TO WS-REPOSITION-NEEDED      
C37037         PERFORM 0608-REPOSITION-BW06     THRU 0608-EXIT          
           ELSE                                                         
               PERFORM 0610-INITIALIZE-RESTART  THRU 0610-EXIT          
               MOVE 0                      TO WS-RESTART-PROCESS-TYPE   
               MOVE WS-RUN-DATE            TO WS-RESTART-INPUT-DATE     
               MOVE WS-NO                  TO WS-REPOSITION-NEEDED      
               PERFORM 7000-READ-FBW06-FILE     THRU 7000-EXIT          
           END-IF.                                                      
      *                                                                         
C29853     MOVE ZEROS                      TO WS-MIN-INACT-G-USE        
C29853                                        WS-MAX-INACT-G-USE        
C29853                                        WS-MIN-INACT-E-USE        
C29853                                        WS-MAX-INACT-E-USE.       
C29853     SET CSR-DATABASE                TO TRUE.                     
C29853     MOVE '01'                       TO C8-COMPANY-NO.            
C29853     MOVE 'INACT-MIN-GAS-USE'        TO C8-DELINQ-CD.             
C29853     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
C29853     IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
C29853         MOVE C8-DELINQ-VALUE        TO WS-MIN-INACT-G-USE        
C29853     END-IF.                                                      
C29853     MOVE 'INACT-MAX-GAS-USE'        TO C8-DELINQ-CD.             
C29853     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
C29853     IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
C29853         MOVE C8-DELINQ-VALUE        TO WS-MAX-INACT-G-USE        
C29853     END-IF.                                                      
C29853     MOVE 'INACT-MIN-ELEC-USE'       TO C8-DELINQ-CD.             
C29853     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
C29853     IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
C29853         MOVE C8-DELINQ-VALUE        TO WS-MIN-INACT-E-USE        
C29853     END-IF.                                                      
      *                                                                         
C29853     MOVE 'INACT-MAX-ELEC-USE'       TO C8-DELINQ-CD.             
C29853     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
C29853     IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
C29853         MOVE C8-DELINQ-VALUE        TO WS-MAX-INACT-E-USE        
C29853     END-IF.                                                      
      *                                                                         
A04880     MOVE 'WQ-ZERO-USE' TO C8-DELINQ-CD.                          
A04880     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
A04880     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A04880        MOVE C8-DELINQ-VALUE TO WS-ZERO-USE-WQ                    
A04880     END-IF.                                                      
A04880     DISPLAY 'DELINQ-VALUE WS-ZERO-USE-WQ = ' WS-ZERO-USE-WQ.     
      *                                                                         
C29853     MOVE 'DATABASE'                 TO C8-DELINQ-CD.             
C29853     PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT.                
C29853     IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
C29853         MOVE C8-DELINQ-VALUE        TO  WS-DATABASE-FL           
C29853     END-IF.                                                      
      *                                                                         
C29853     MOVE ZEROS                      TO WS-SEB-PREV-DAYS.         
C29853     IF  SEB-DATABASE                                             
C29853         MOVE 'DAY-FOR-READPOST'     TO C8-DELINQ-CD              
C29853         PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT             
C29853         IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
C29853             MOVE C8-DELINQ-VALUE    TO  WS-SEB-PREV-DAYS         
C29853         END-IF                                                   
C33023         MOVE 'AGL-METER-CHARGE'     TO C8-DELINQ-CD              
C33023         PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT             
C33023         IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
C33023             MOVE C8-DELINQ-VALUE    TO  WS-AGL-FF-FACTOR         
C33023         END-IF                                                   
ACT045         MOVE 'ALREADY-READ-DIFF '       TO C8-DELINQ-CD          
ACT045         PERFORM 7010-GET-DELINQ-VALUE THRU 7010-EXIT             
ACT045         IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
ACT045            MOVE C8-DELINQ-VALUE        TO WS-WQ-ALREADY-READ-DIFF
ACT045         END-IF                                                   
      *                                                                         
C35597******** Get the default duration from the CSS_SPCL_FCTR Table            
C35597         MOVE WS-AGL-FF-FACTOR-ID          TO SF-FACTOR-ID        
C35597         PERFORM 7680-GET-DEFLT-DURATION   THRU 7680-EXIT         
C35597                                                                  
C35597******** Get the minimum Rev Mth for the WS-RUN-DATE                      
C35597         MOVE WS-RUN-DATE                  TO BN-DATE-EXTRACT     
C35597         PERFORM 7650-SELECT-AGL-REV-MONTH THRU 7650-EXIT         
C35597                                                                  
C29853     END-IF.                                                      
      *                                                                         
      *   FOR SEB ONLY                                                          
      *   GET BEGINNING SEASONAL MONTH (MONTH1) FROM CSS_JOB_PARM               
      *                                                                         
A04880     IF SEB-DATABASE                                              
A04880        MOVE WS-PGRMNAME TO WS-PROGRAM                            
A04880                            ABEND-PROGRAM                         
A04880        MOVE WS-PARM     TO WS-COMMAND                            
A04880        MOVE ZEROS       TO WS-SEQUENCE                           
A04880        MOVE SPACES      TO WS-SYSIPT                             
A04880        MOVE WS-KEY-AREA TO E-FJC01-KEY                           
A04880        PERFORM 7600-START-FCSJC01 THRU 7600-EXIT                 
A04880        PERFORM 7610-READ-FCSJC01  THRU 7610-EXIT                 
A04880            UNTIL (WS-INPUT-DATA-BREAKDOWN(1:16) =                
A04880                      'SEASONAL-MONTH1=' AND INPUT-ACTIVE)        
A04880               OR END-OF-SYSIPT                                   
A04880        IF END-OF-SYSIPT                                          
A04880           DISPLAY ' '                                            
A04880           DISPLAY '**  PCSBW143 PROCESSING ERROR          **'    
A04880           DISPLAY '**  CSS_JOB_PARM ERROR                 **'    
A04880           DISPLAY '**  BEGINNING SEASONAL MONTH INACTIVE  **'    
A04880           DISPLAY '**    KEY = ' E-FJC01-KEY                     
A04880           DISPLAY '**     PROCESSING TERMINATED           **'    
A04880           PERFORM 9900-ABEND THRU 9900-EXIT                      
A04880        ELSE                                                      
A04880           MOVE G6-PARM-DATA TO WS-SEASONAL-MONTH-PARM-DATA       
A04880           MOVE WS-SEASONAL-MONTH TO WS-140-BEG-SEB-SEASONAL      
A04880           PERFORM 7611-CLOSE THRU 7611-EXIT                      
A04880        END-IF                                                    
      *                                                                         
      *   FOR SEB ONLY                                                          
      *   GET ENDING SEASONAL MONTH (MONTH2) FROM CSS_JOB_PARM                  
      *                                                                         
A04880        MOVE WS-PGRMNAME TO WS-PROGRAM                            
A04880                            ABEND-PROGRAM                         
A04880        MOVE WS-PARM     TO WS-COMMAND                            
A04880        MOVE ZEROS       TO WS-SEQUENCE                           
A04880        MOVE SPACES      TO WS-SYSIPT                             
A04880        MOVE WS-KEY-AREA TO E-FJC01-KEY                           
A04880        PERFORM 7600-START-FCSJC01 THRU 7600-EXIT                 
A04880        PERFORM 7610-READ-FCSJC01  THRU 7610-EXIT                 
A04880            UNTIL (WS-INPUT-DATA-BREAKDOWN(1:16) =                
A04880                      'SEASONAL-MONTH2=' AND INPUT-ACTIVE)        
A04880               OR END-OF-SYSIPT                                   
A04880        IF END-OF-SYSIPT                                          
A04880           DISPLAY ' '                                            
A04880           DISPLAY '**  PCSBW143 PROCESSING ERROR      **'        
A04880           DISPLAY '**  CSS_JOB_PARM ERROR             **'        
A04880           DISPLAY '**  ENDING SEASONAL MONTH INACTIVE  **'       
A04880           DISPLAY '**    KEY = ' E-FJC01-KEY                     
A04880           DISPLAY '**     PROCESSING TERMINATED       **'        
A04880           PERFORM 9900-ABEND THRU 9900-EXIT                      
A04880        ELSE                                                      
A04880           MOVE G6-PARM-DATA TO WS-SEASONAL-MONTH-PARM-DATA       
A04880           MOVE WS-SEASONAL-MONTH TO WS-140-END-SEB-SEASONAL      
A04880           PERFORM 7611-CLOSE THRU 7611-EXIT                      
A04880        END-IF                                                    
A04880     END-IF.                                                      
      *                                                                         
A04880     IF SEB-DATABASE                                              
A04880        DISPLAY 'BEGIN SEASONAL MONTH FOR SEB = '                 
A04880                  WS-140-BEG-SEB-SEASONAL                         
A04880        DISPLAY 'ENDING SEASONAL MONTH FOR SEB = '                
A04880                  WS-140-END-SEB-SEASONAL                         
A04880     END-IF.                                                      
      *                                                                         
       0100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      *    0101-GET-PARTITION-DATA                                    *         
      *    0102-GET-PART-RANGE                                        *         
      *****************************************************************         
           EXEC SQL                                                             
              INCLUDE CPD00048                                                  
           END-EXEC.                                                            
      *****************************************************************         
      *    6351-CPD72-HI-LO-MAIN                                      *         
      *****************************************************************         
A00795     EXEC SQL                                                             
A00795        INCLUDE CPDCA072                                                  
A00795     END-EXEC.                                                            
A00795*                                                                         
      *****************************************************************         
      *    0600-PREPARE-FOR-RESTART                                   *         
      *****************************************************************         
       0600-PREPARE-FOR-RESTART.                                        
           MOVE PROGRAM-NAME               TO RF-NAME-PROGRAM.          
           MOVE WS-PART-NO                 TO RF-PARTITION-NO           
                                              WS-CHKP-PART-NO.          
           MOVE 1                          TO RF-DUP-CNTRL-NO.          
           PERFORM 7550-SELECT-RESTART-DATA    THRU 7550-EXIT.          
           IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
               MOVE RF-RESTART-DATA-TEXT   TO WS-RESTART-DATA           
               IF  WS-RESTART-PROCESS-TYPE NUMERIC                      
                   MOVE WS-YES             TO WS-IS-THIS-A-RESTART      
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       0600-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      *    0605-VALIDATE-RESTART                                      *         
      *****************************************************************         
       COPY CPD00030.                                                           
      *****************************************************************         
      *                                                                         
C37037*****************************************************************         
C37037*    REPOSITION INPUT FILE                                      *         
C37037*****************************************************************         
C37037 0608-REPOSITION-BW06.                                            
C37037*                                                                         
C37037     MOVE ZERO                       TO WS-FBW06-REC-CNTR.        
C37037     PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT                  
C37037         UNTIL WS-FBW06-REC-CNTR = WS-RESTART-RECORD-NO           
C37037               OR END-OF-FBW06.                                   
C37037*                                                                         
C37037     IF WS-RESTART-REC-KEY NOT = E-FBW06-RECORD-KEY               
C37037        DISPLAY '*******************************************'     
C37037        DISPLAY '** RESTART ERROR: FILE REPOSITIONING FAILED'     
C37037        DISPLAY '** INPUT RECORD NOT MATCHING RESTART RECORD'     
C37037        DISPLAY '** FILE REC: ' E-FBW06-RECORD-KEY                
C37037        DISPLAY '** RSTT REC: ' WS-RESTART-REC-KEY                
C37037        DISPLAY '*******************************************'     
C37037        PERFORM 9900-ABEND THRU 9900-EXIT                         
C37037     END-IF.                                                      
C37037*                                                                         
C37037     DISPLAY '*******************************************'.       
C37037     DISPLAY '*****  THIS IS A RESTART OF PCSBW143  *****'.       
C37037     DISPLAY '*******************************************'.       
C37037     MOVE WS-RESTART-RECORD-NO       TO WS-FBW06-REC-CNTR.        
C37037     MOVE WS-RESTART-CHKP-SEQ-NO     TO WS-CHKP-SEQ-NO.           
C37037     MOVE WS-RESTART-FIRST-METER     TO WS-FIRST-METER.           
C37037     MOVE WS-RESTART-NO-OF-REJECT    TO WS-NO-OF-REJECT.          
C37037     MOVE WS-RESTART-COUNT-ACCT      TO WS-COUNT-ACCT.            
C37037     MOVE WS-RESTART-COUNT-METER     TO WS-COUNT-METER.           
C37037     MOVE WS-RESTART-COUNT-KWH       TO WS-COUNT-KWH.             
C37037     MOVE WS-RESTART-COUNT-GAS       TO WS-COUNT-GAS.             
C37037     MOVE WS-RESTART-COUNT-UNC       TO WS-COUNT-UNC.             
C37037     MOVE WS-RESTART-COUNT-INT       TO WS-COUNT-INT.             
C37037     MOVE WS-RESTART-COUNT-KW        TO WS-COUNT-KW.              
C37037     MOVE WS-RESTART-COUNT-KVA       TO WS-COUNT-KVA.             
C37037     MOVE WS-RESTART-COUNT-SURVEY    TO WS-COUNT-SURVEY.          
C37037     MOVE WS-RESTART-COUNT-NOT-READ  TO WS-COUNT-NOT-READ.        
C37037     MOVE WS-RESTART-HIGH-LOW-FAIL   TO WS-HIGH-LOW-FAIL.         
C3703 *                                                                         
C3703 *****************************************************************         
C3703 *    THE FOLLOWING CODE COMPARES RUN DATE STORED IN             *         
C3703 *    RESTART DATA TO RUN DATE FROM JOB CONTROL FILE:            *         
C3703 *****************************************************************         
C3703      IF  WS-RESTART-INPUT-DATE  EQUAL WS-RUN-DATE                 
C3703            OR WS-RESTART-INPUT-DATE EQUAL SPACES                  
C3703          NEXT SENTENCE                                            
C3703      ELSE                                                         
C3703          DISPLAY '*******************************************'    
C3703          DISPLAY '** RUN DATE WAS CHANGED PRIOR TO RESTART **'    
C3703          DISPLAY '** OLD RUN DATE = ' WS-RESTART-INPUT-DATE       
C3703          DISPLAY '** NEW RUN DATE = ' WS-RUN-DATE                 
C3703          DISPLAY '*******************************************'    
C3703          PERFORM 9900-ABEND THRU 9900-EXIT                        
C3703      END-IF.                                                      
C3703 *                                                                         
C3703  0608-EXIT.                                                       
C3703      EXIT.                                                        
C3703 *                                                                         
      *****************************************************************         
      *    0610-INITIALIZE-RESTART                                    *         
      *****************************************************************         
       0610-INITIALIZE-RESTART.                                         
           MOVE SPACES                     TO WS-RESTART-INPUT-DATE     
           MOVE ZERO                       TO WS-RESTART-CHKP-SEQ-NO    
           MOVE SPACES                     TO WS-RESTART-REC-KEY.       
           MOVE WS-YES                     TO WS-RESTART-FIRST-METER    
           MOVE ZEROES                     TO WS-RESTART-NO-OF-REJECT   
                                             WS-RESTART-COUNT-ACCT      
                                             WS-RESTART-COUNT-METER     
                                             WS-RESTART-COUNT-KWH       
                                             WS-RESTART-COUNT-GAS       
                                             WS-RESTART-COUNT-UNC       
                                             WS-RESTART-COUNT-INT       
                                             WS-RESTART-COUNT-KW        
                                             WS-RESTART-COUNT-KVA       
                                             WS-RESTART-COUNT-SURVEY    
                                             WS-RESTART-COUNT-NOT-READ  
                                             WS-RESTART-HIGH-LOW-FAIL   
           SET WS-RERUN-PENDING            TO TRUE.                     
      *                                                                         
       0610-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * MODULE TO PROCESS EACH INPUT RECORD                           *         
      *****************************************************************         
       1000-PROCESS-MAIN.                                               
           IF  FIRST-METER                                              
               MOVE 'N'                    TO WS-FIRST-METER            
               MOVE 0                      TO WS-PREV-ACCT-NO           
               MOVE SPACES                 TO WS-PREV-METER-NO          
A02306         MOVE SPACES                 TO WS-PREV-METER-READ-DATE   
           END-IF.                                                      
      *                                                                         
           MOVE SPACES                     TO WS-ACCOUNT-SKIP-FL        
                                              WS-METER-SKIP-FL          
                                              WS-WQ-GENERATED-FL        
                                              WS-TOU-WQ-FL              
                                              WS-HILO-FAIL-IND          
                                              WS-GT-14-READS-FL.        
           MOVE ZEROS                      TO WS-WQ-SUB                 
                                              WS-CRNT-USE               
                                              WS-NO-READ-DAYS.          
P00251     IF SEB-DATABASE                                              
P00251        MOVE 'A'                  TO E-FBW06-CODE-USAGE-ID        
P00251        MOVE 'B'                  TO E-FBW06-CODE-USAGE-SOURCE    
P00251     END-IF.                                                      
           SET GET-HILO                    TO TRUE.                     
           INITIALIZE WS-FIOBW06-TABLE.                                 
      *                                                                         
           IF  WS-PREV-ACCT-NO NOT EQUAL E-FBW06-ACCOUNT-NO             
                  OR E-FBW06-ACCOUNT-NO EQUAL WS-NEW-ACCT               
               PERFORM 1100-PROCESS-ACCOUNT-CHANGE THRU 1100-EXIT       
               MOVE E-FBW06-ACCOUNT-NO     TO WS-PREV-ACCT-NO           
               MOVE E-FBW06-METER-NO       TO WS-PREV-METER-NO          
               MOVE E-FBW06-CODE-UTIL-TYPE TO WS-PREV-UTIL-TYPE         
A02306         MOVE E-FBW06-DATE-READ      TO WS-PREV-METER-READ-DATE   
           ELSE                                                         
              IF  WS-PREV-METER-NO NOT EQUAL E-FBW06-METER-NO           
A02306            OR E-FBW06-CODE-UTIL-TYPE NOT = WS-PREV-UTIL-TYPE     
A02306            OR E-FBW06-DATE-READ    NOT = WS-PREV-METER-READ-DATE 
                  PERFORM 1200-PROCESS-METER-CHANGE THRU 1200-EXIT      
                  MOVE E-FBW06-METER-NO    TO WS-PREV-METER-NO          
A02306            MOVE E-FBW06-DATE-READ   TO WS-PREV-METER-READ-DATE   
                  MOVE E-FBW06-CODE-UTIL-TYPE                           
                                           TO WS-PREV-UTIL-TYPE         
              END-IF                                                    
           END-IF.                                                      
      *                                                                         
           IF  ACCOUNT-SKIP                                             
               PERFORM UNTIL                                            
                          E-FBW06-ACCOUNT-NO NOT EQUAL WS-PREV-ACCT-NO  
                          OR CNTRL-REC-REACHED OR END-OF-FBW06          
                   PERFORM 2000-PROCESS-ROUTE-RPT  THRU 2000-EXIT       
                   PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT          
               END-PERFORM                                              
               GO TO 1000-EXIT                                          
           END-IF.                                                      
      *                                                                         
           IF  METER-SKIP                                               
               PERFORM UNTIL                                            
                       E-FBW06-ACCOUNT-NO NOT EQUAL WS-PREV-ACCT-NO     
                       OR E-FBW06-METER-NO NOT EQUAL WS-PREV-METER-NO   
                       OR E-FBW06-CODE-UTIL-TYPE NOT = WS-PREV-UTIL-TYPE
                       OR CNTRL-REC-REACHED OR END-OF-FBW06             
                   PERFORM 2000-PROCESS-ROUTE-RPT  THRU 2000-EXIT       
                   PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT          
               END-PERFORM                                              
               GO TO 1000-EXIT                                          
           END-IF.                                                      
      *                                                                         
PRJ914     IF  MTR-CHNG-OFF-CYC-READ OR CC-CHNG-OFF-CYC-READ            
PRJ914         PERFORM UNTIL                                            
PRJ914                 E-FBW06-ACCOUNT-NO NOT EQUAL WS-PREV-ACCT-NO     
PRJ914                 OR E-FBW06-METER-NO NOT EQUAL WS-PREV-METER-NO   
PRJ914                 OR E-FBW06-CODE-UTIL-TYPE NOT = WS-PREV-UTIL-TYPE
PRJ914                 OR CNTRL-REC-REACHED OR END-OF-FBW06             
PRJ914            IF E-FBW06-INDEX-VALUE-CD = WS-VALUE                  
PRJ914               PERFORM 3000-PROCESS-OFF-CYC-READS THRU 3000-EXIT  
PRJ914            END-IF                                                
PRJ914            PERFORM 2000-PROCESS-ROUTE-RPT  THRU 2000-EXIT        
PRJ914            PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT           
PRJ914         END-PERFORM                                              
PRJ914         IF CC-CHNG-OFF-CYC-READ                                  
PRJ914            MOVE CX-ACCOUNT-NO    TO OC-ACCOUNT-NO                
PRJ914            MOVE AT-CUSTOMER-NO   TO OC-CUSTOMER-NO               
PRJ914            MOVE 'B'              TO OC-CODE-BILL-OFF-CYCL        
PRJ914            MOVE SPACES           TO OC-CREDIT-LETTER-IND         
PRJ914                                     XD-CREDIT-LETTER-IND         
PRJ914            PERFORM 7700-GET-CRED-LETTER-IND THRU 7700-EXIT       
PRJ914            MOVE XD-CREDIT-LETTER-IND TO OC-CREDIT-LETTER-IND     
PRJ914            PERFORM 8635-INSERT-OFF-CYCL-ACCT THRU 8635-EXIT      
PRJ914         END-IF                                                   
PRJ914         GO TO 1000-EXIT                                          
PRJ914     END-IF.                                                      
PRJ914*                                                                         
           MOVE '0'                        TO WS-SEASON-CHG-FL.         
           MOVE MN-REMOTE-READ-IND         TO WS-REMOTE-READ-IND.       
P00508     IF TOU-ALL                                                   
               PERFORM 1400-CHECK-FOR-SEASON-CHG THRU 1400-EXIT         
           END-IF.                                                      
      *                                                                         
      *****************************************************************         
      *        LOAD INPUT RECORD TO WORKING STORAGE TABLE             *         
      *        LOAD PREVIOUS SEASON DATA, ONLY IF THERE IS SEASON CHG *         
      *****************************************************************         
           MOVE ZEROS                      TO WS-FBW06-SUB.             
           PERFORM UNTIL E-FBW06-ACCOUNT-NO NOT EQUAL WS-PREV-ACCT-NO   
               OR E-FBW06-METER-NO NOT EQUAL WS-PREV-METER-NO           
               OR E-FBW06-CODE-UTIL-TYPE NOT = WS-PREV-UTIL-TYPE        
A02306         OR E-FBW06-DATE-READ      NOT = WS-PREV-METER-READ-DATE  
                       OR CNTRL-REC-REACHED OR END-OF-FBW06             
               IF  SEASON-CHANGE                                        
                   ADD 1                   TO WS-FBW06-SUB              
                   MOVE FIOBW06            TO                           
                                       WS-FBW06-READ-REC (WS-FBW06-SUB) 
                   MOVE '0'                TO                           
                                      WS-FBW06-NO-READ-CD (WS-FBW06-SUB)
                   MOVE 'Y'                TO                           
                                  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB)   
               ELSE                                                     
                   IF  E-FBW06-CODE-TOU-SEASN = WS-PREVIOUS             
                       CONTINUE                                         
                   ELSE                                                 
                       ADD 1               TO WS-FBW06-SUB              
                       MOVE FIOBW06        TO                           
                                       WS-FBW06-READ-REC (WS-FBW06-SUB) 
                       MOVE '0'            TO                           
                                      WS-FBW06-NO-READ-CD (WS-FBW06-SUB)
                       MOVE 'Y'            TO                           
                                  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB)   
                   END-IF                                               
               END-IF                                                   
               PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT              
           END-PERFORM.                                                 
           MOVE WS-FBW06-SUB               TO WS-FBW06-MAX-SUB.         
           MOVE FIOBW06                    TO WS-SAVE-FBW06-REC.        
      *                                                                         
      *PROCESS INDIVIDUAL METER READ VALIDATIONS                                
A03494     SET DO-NOT-IGNORE-SEB-READ  TO TRUE                          
P00508     SET NOT-MDM-ESTIMATED-READ  TO TRUE                          
P00508     SET NO-MDM-HI-LO-EXCEPT     TO TRUE                          
P00508     SET NO-CIS-HI-LO-EXCEPT     TO TRUE                          
C35066     MOVE SPACES    TO WS-FIELD-HI-LO-EXCEPT-SW                   
C35066     MOVE SPACES    TO WS-SUPERVISOR-EST-SW                       
C35066     MOVE WS-BN-WIN-OPEN-DATE  TO WS-BILL-WINDOW-OPEN-DT          
C35066     MOVE WS-BN-WIN-CLOSE-DATE TO WS-BILL-WINDOW-CLOSE-DT         
C35066*                                                                         
C35066     IF NOT SEB-DATABASE                                          
C35066        PERFORM 1500-VALIDATE-READ-EXCEPTIONS THRU 1500-EXIT      
C35066           VARYING WS-FBW06-SUB FROM 1 BY 1                       
C35066             UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
C35066     END-IF.                                                      
C35066*                                                                         
           MOVE 1                          TO WS-FBW06-SUB.             
           PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
              MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                      
                                           TO FIOBW06                   
              PERFORM 1600-VALIDATE-METER-READ-DATA THRU 1600-EXIT      
              COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
           END-PERFORM.                                                 
      *                                                                         
      *EXECUTE METER READ VALIDATIONS INVOLVING MORE THAN ONE READING           
           IF  MN-CODE-UTIL-TYPE EQUAL WS-E                             
               PERFORM 1800-CHK-ELEC-COMBO-EDITS THRU 1800-EXIT         
           END-IF.                                                      
      *                                                                         
           IF  MN-CODE-UTIL-TYPE EQUAL WS-G                             
               PERFORM 1900-CHK-GAS-COMBO-EDITS THRU 1900-EXIT          
C31697         PERFORM 1950-NON-HI-LO-GAS-VLDT THRU 1950-EXIT           
           END-IF.                                                      
      *                                                                         
           SET VERIFY-BILL-HOOK            TO TRUE.                     
           MOVE 1                          TO WS-FBW06-SUB.             
           MOVE ZEROS                      TO WS-WQ-SUB.                
           PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
              MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                      
                                           TO FIOBW06                   
              MOVE E-FBW06-READ-ITEM-STATUS                             
                                           TO WS-READ-ITEM-STATUS       
              PERFORM 2000-PROCESS-ROUTE-RPT  THRU 2000-EXIT            
              IF  BILLING-READ                                          
                  SET MONTH-END-CX         TO TRUE                      
P00508            IF TOU-ALL AND WQ-GENERATED                           
                      PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT      
                  ELSE                                                  
                      IF  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) EQUAL 'N' 
                            AND E-FBW06-CODE-TOU-SEASN = WS-CURRENT     
                           PERFORM 2150-UPDATE-READ-CODE                
                                                  THRU 2150-EXIT        
                      END-IF                                            
                      IF  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) EQUAL 'Y' 
                          PERFORM 2200-PROCESS-UPDATES THRU 2200-EXIT   
                      END-IF                                            
                  END-IF                                                
              END-IF                                                    
              COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
           END-PERFORM.                                                 
      *                                                                         
      *CREATE A WQ WITH ALL TOU READ EXCEPTIONS                                 
           IF  WQ-GENERATED                                             
P00508         EVALUATE TRUE                                            
P00508            WHEN MDM-ESTIMATED-READ AND SMART-SYNCH-MTR           
P00508               MOVE MSG-TOU-MDM-ESTIMATE TO WS-WQ-MESSAGE         
P00508            WHEN CIS-HI-LO-EXCEPT AND SMART-SYNCH-MTR             
P00508                 AND MDM-HI-LO-EXCEPT                             
P00508               MOVE MSG-TOU-HILO-CIS-MDM TO WS-WQ-MESSAGE         
P00508            WHEN CIS-HI-LO-EXCEPT AND SMART-SYNCH-MTR             
P00508               MOVE MSG-TOU-HILO-CIS     TO WS-WQ-MESSAGE         
P00508            WHEN MDM-HI-LO-EXCEPT AND SMART-SYNCH-MTR             
P00508               MOVE MSG-TOU-HILO-MDM     TO WS-WQ-MESSAGE         
P00508            WHEN OTHER                                            
P00508               MOVE MSG-TOU-READ-FAILED TO WS-WQ-MESSAGE          
P00508         END-EVALUATE                                             
               SET TOU-WQ                  TO TRUE                      
ACT301         MOVE WS-CATEGORY-ID-583     TO WS-CATEGORY-ID            
               MOVE '4'                    TO WS-ROUTING-CATEGORY       
               PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
           END-IF.                                                      
      *                                                                         
           MOVE WS-SAVE-FBW06-REC          TO FIOBW06.                  
      *                                                                         
      *ONCE ALL METER READS OF AN ACCOUNT ARE PROCESSED, CHECK WHETHER          
      *THERE ARE ANY MISSSING READS. IF NOT, SET THE ACCOUNT READY TO           
      *BILL                                                                     
           IF  MONTH-END-CX                                             
                AND (E-FBW06-ACCOUNT-NO NOT EQUAL WS-PREV-ACCT-NO       
                       OR CNTRL-REC-REACHED OR END-OF-FBW06)            
A03494       IF IGNORE-SEB-READ                                         
A03494          CONTINUE                                                
A03494       ELSE                                                       
ACT256         IF HILO-WARNING AND                                      
ACT256           AT-CODE-ACCT-BILLED NOT = WS-HOLD-NO-READING           
ACT256            MOVE WS-HOLD-NO-READING     TO AT-CODE-ACCT-BILLED    
ACT256            PERFORM 8560-UPDATE-ACCOUNT THRU 8560-EXIT            
ACT256         ELSE                                                     
                  PERFORM 2600-CHECK-FOR-NO-READS THRU 2600-EXIT        
ACT256         END-IF                                                   
A03494       END-IF                                                     
           END-IF.                                                      
      *                                                                         
           IF  WS-NO-OF-REJECT > WS-RR-WQ-MTR-POST                      
               DISPLAY 'METERS REJECTS EXCEEDS THRESHOLD'               
               DISPLAY 'METERS REJECTED : ' WS-NO-OF-REJECT             
               DISPLAY 'REJECT THRESHOLD: ' WS-RR-WQ-MTR-POST           
               PERFORM 9900-ABEND            THRU 9900-EXIT             
           END-IF.                                                      
      *                                                                         
           ADD 1                           TO WS-CHKP-LUW-COUNTER.      
           IF  (WS-CHKP-LUW-COUNTER >= WS-CHKP-LUW-LIMIT)               
                  OR (WS-CHKP-UPD-COUNTER  >= WS-CHKP-UPD-LIMIT)        
               PERFORM 8898-ISSUE-CHKP          THRU 8898-EXIT          
           END-IF.                                                      
      *                                                                         
       1000-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * END OF FILE PROCESSING                                        *         
      *****************************************************************         
       1050-PROCESS-END-OF-FILE.                                        
      *                                                                         
           IF  CNTRL-REC-REACHED                                        
               CONTINUE                                                 
           ELSE                                                         
               DISPLAY ' '                                              
               DISPLAY '*** PCSBW143 PROCESSING ERROR      ***'         
               DISPLAY '*** NO END RECORD FOUND IN FCSBW06 ***'         
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
A00914**** FCS PROJECT: DON'T ABEND THE PROGRAM FOR MULTIPLE                    
A00914**** CONTROL RECORDS BEFORE END OF FILE CONTROL RECORD                    
A00914     PERFORM UNTIL END-OF-FBW06                                   
A00914        MOVE WS-NO                   TO WS-CNTRL-REC-REACHED      
A00914        MOVE WS-NO                   TO WS-END-OF-FBW06-FILE      
A00914        PERFORM 7000-READ-FBW06-FILE THRU 7000-EXIT               
A00914        IF CNTRL-REC-REACHED OR END-OF-FBW06                      
A00914           CONTINUE                                               
A00914        ELSE                                                      
A00914           DISPLAY ' '                                            
A00914           DISPLAY '*** PCSBW143 PROCESSING ERROR      ***'       
A00914           DISPLAY '*** NO END RECORD FOUND IN FCSBW06 ***'       
A00914           PERFORM 9900-ABEND THRU 9900-EXIT                      
A00914        END-IF                                                    
A00914     END-PERFORM.                                                 
A00914*                                                                         
           IF  END-OF-FBW06                                             
               CONTINUE                                                 
           ELSE                                                         
               DISPLAY ' '                                              
               DISPLAY '**       PCSBW143 PROCESSING ERROR       **'    
               DISPLAY '** ADDITIONAL RECORD AFTER END CNTRL REC **'    
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
           IF  FIRST-METER                                              
               DISPLAY ' '                                              
               DISPLAY '**  PCSBW143 PROCESSING MESSAGE **'             
               DISPLAY '**  NO METERS WERE PROCESSED.   **'             
               DISPLAY ' '                                              
           END-IF.                                                      
      *                                                                         
       1050-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * ACCOUNT VALIDATIONS                                           *         
      *****************************************************************         
       1100-PROCESS-ACCOUNT-CHANGE.                                     
           MOVE SPACES                     TO WS-MONTH-END-CX-FL.       
ACT256     MOVE 'N'                        TO WS-HILO-WANRING-IND.      
           ADD 1                           TO WS-COUNT-ACCT.            
           MOVE E-FBW06-ACCOUNT-NO         TO AT-ACCOUNT-NO             
                                              WS-ACCOUNT-NO.            
A03494     SET DO-NOT-IGNORE-SEB-READ      TO TRUE                      
P00508     SET NOT-MDM-ESTIMATED-READ      TO TRUE                      
P00508     SET NO-MDM-HI-LO-EXCEPT         TO TRUE                      
P00508     SET NO-CIS-HI-LO-EXCEPT         TO TRUE                      
P00508     MOVE SPACES                     TO WS-MTR-RD-SRC-SW          
C35066     MOVE SPACES                     TO WS-FIELD-HI-LO-EXCEPT-SW  
C35066     MOVE SPACES                     TO WS-SUPERVISOR-EST-SW      
C36317     MOVE 'N'                        TO WS-SECURED-RATE-FL        
C36317     SET WS-VALID-READ-DATE          TO TRUE                      
PRJ914     SET REGULAR-CYCLE-READ          TO TRUE.                     
      *                                                                         
      ***CREATE A WQ, IF IT IS A NEW METER & SET METER-SKIP TO TRUE             
      ***BECAUSE ALL NEW METERS WILL HAVE THE SAME ACCOUNT-NO OF 1              
      *                                                                         
           IF  E-FBW06-ACCOUNT-NO EQUAL WS-NEW-ACCT                     
               SET METER-SKIP              TO TRUE                      
27793 *        MOVE E-FBW06-EMPLOYEE-NO    TO WS-EMPLOYEE-NO                    
27793 *        MOVE WS-EMP-NO              TO MSG-NEW-MTR-READER                
27793 *        MOVE E-FBW06-MTR-COMMENT-TX TO MSG-NEW-MTR-LOCATION              
27793 *        MOVE MSG-NEW-METER-FOUND    TO WS-WQ-MESSAGE                     
27793 *        MOVE ZERO                   TO AT-PREMISE-NO                     
27793 *                                       AT-CUSTOMER-NO                    
27793 *                                       AT-LOCAL-OFFICE                   
27793 *                                       AT-ACCOUNT-NO                     
27793 *        MOVE '01'                   TO AT-COMPANY-NO                     
27793 *        MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID                    
27793 *        MOVE '4'                    TO WS-ROUTING-CATEGORY               
27793 *        PERFORM 2500-CREATE-WQ THRU 2500-EXIT                            
               MOVE WS-ACCOUNT-NO          TO AT-ACCOUNT-NO             
               GO TO 1100-EXIT                                          
           END-IF.                                                      
      *                                                                         
      ***VERIFY ACCOUNT                                                         
           PERFORM 7100-SELECT-ACCOUNT      THRU 7100-EXIT              
           IF  WS-ACTIVE-RETURN-CODE = NOT-FOUND                        
               MOVE AT-ACCOUNT-NO          TO XR-OLD-ACCOUNT-NO         
               PERFORM 7110-GET-XREF-ACCOUNT THRU 7110-EXIT             
               IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
                   MOVE XR-NEW-ACCOUNT-NO  TO AT-ACCOUNT-NO             
                   PERFORM 7100-SELECT-ACCOUNT THRU 7100-EXIT           
                   IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL          
                       MOVE AT-ACCOUNT-NO  TO MN-ACCOUNT-NO             
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE = NOT-FOUND                        
               SET ACCOUNT-SKIP            TO TRUE                      
               MOVE E-FBW06-ACCOUNT-NO     TO MSG-ACCOUNT-NO            
               MOVE MSG-ACCOUNT-NO-NOT-FOUND                            
                                           TO WS-WQ-MESSAGE             
               MOVE ZERO                   TO AT-PREMISE-NO             
                                              AT-CUSTOMER-NO            
                                              AT-LOCAL-OFFICE           
                                              AT-ACCOUNT-NO             
               MOVE '01'                   TO AT-COMPANY-NO             
C35066         MOVE SPACES                 TO AT-BILL-CYCLE             
               MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
               MOVE '4'                    TO WS-ROUTING-CATEGORY       
               PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
               MOVE WS-ACCOUNT-NO          TO AT-ACCOUNT-NO             
               GO TO 1100-EXIT                                          
           END-IF.                                                      
C36317*                                                                         
C36317     MOVE AT-ACCOUNT-NO         TO UT-ACCOUNT-NO                  
C36317     PERFORM 7205-SELECT-UTIL-SECU-RATE THRU 7205-EXIT            
C35066*                                                                         
C35066     PERFORM 1200-PROCESS-METER-CHANGE THRU 1200-EXIT.            
C35066*                                                                         
C35066     IF NOT ACCOUNT-SKIP                                          
               MOVE AT-ACCOUNT-NO          TO MN-ACCOUNT-NO             
               MOVE AT-PREMISE-NO          TO PR-PREMISE-NO             
               MOVE SPACES                 TO WS-PEND-OFF-DT-MIN-2      
               PERFORM 7120-SELECT-PREMISE   THRU 7120-EXIT             
               MOVE SPACES                 TO WS-PEND-OFF-WQ-CREATED-FL 
           END-IF.                                                      
      *                                                                         
       1100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * METER VALIDATIONS                                             *         
      *****************************************************************         
       1200-PROCESS-METER-CHANGE.                                       
           DISPLAY 'PROCESSING METER-NO: ', E-FBW06-CODE-UTIL-TYPE,     
                                       ' ', E-FBW06-METER-NO,           
                              ' ACCT-NO: ', E-FBW06-ACCOUNT-NO.         
      *                                                                         
ACT110     MOVE 'N'                        TO WS-HILO-WANRING-IND       
P00251     MOVE SPACES                     TO WS-PREV-CODE-USAGE-ID     
A03494     SET DO-NOT-IGNORE-SEB-READ      TO TRUE                      
P00508     SET NOT-MDM-ESTIMATED-READ      TO TRUE                      
P00508     SET NO-MDM-HI-LO-EXCEPT         TO TRUE                      
P00508     SET NO-CIS-HI-LO-EXCEPT         TO TRUE                      
P00508     MOVE SPACES                     TO WS-MTR-RD-SRC-SW          
C35066     MOVE SPACES                     TO WS-FIELD-HI-LO-EXCEPT-SW  
C35066     MOVE SPACES                     TO WS-SUPERVISOR-EST-SW      
C36317     SET WS-VALID-READ-DATE          TO TRUE                      
           ADD 1                           TO WS-COUNT-METER.           
           MOVE AT-ACCOUNT-NO              TO MN-ACCOUNT-NO.            
           MOVE E-FBW06-METER-NO           TO MN-METER-NO.              
           MOVE E-FBW06-CODE-UTIL-TYPE     TO MN-CODE-UTIL-TYPE.        
PRJ914     MOVE AT-BILL-CYCLE              TO UT-READ-CYCLE.            
PRJ914     SET REGULAR-CYCLE-READ          TO TRUE.                     
PRJ914                                                                  
PRJ914     EVALUATE TRUE                                                
PRJ914        WHEN E-FBW06-OFF-CYCLE-READ-CD = (LOW-VALUES OR SPACES)   
PRJ914             PERFORM 1220-CHECK-MTRD-ENV   THRU 1220-EXIT         
PRJ914        WHEN E-FBW06-OFF-CYCLE-READ-CD = 'P'                      
PRJ914             PERFORM 1230-CHECK-CNS-HIST   THRU 1230-EXIT         
PRJ914        WHEN E-FBW06-OFF-CYCLE-READ-CD = 'F'                      
PRJ914             PERFORM 1240-CHECK-MTR-CNS    THRU 1240-EXIT         
PRJ914        WHEN OTHER                                                
PRJ914             PERFORM 1220-CHECK-MTRD-ENV   THRU 1220-EXIT         
PRJ914     END-EVALUATE.                                                
PRJ914                                                                  
      *                                                                         
C35066     IF NOT METER-SKIP                                            
P00508        MOVE MN-MTR-READ-SOURCE-CD TO WS-MTR-RD-SRC-SW            
C35066        MOVE MN-ACCOUNT-NO         TO UT-ACCOUNT-NO               
C35066        MOVE MN-CODE-UTIL-TYPE     TO UT-CODE-UTIL-TYPE           
C35066        MOVE MN-IC-NO              TO UT-IC-NO                    
C35066        PERFORM 7200-SELECT-UTIL-ENVRNMT THRU 7200-EXIT           
C35066        MOVE SPACES                TO WS-READ-MISSING-WQ-CRT-FL   
C35066     END-IF.                                                      
C35066*                                                                         
C35066***VERIFY WHETHER CYCLE IS CLOSED FOR THE MONTH                           
C35066     MOVE E-FBW06-READ-ITEM-STATUS   TO WS-READ-ITEM-STATUS       
C36317     IF  MIDMONTH-READ-ALL                                        
C35066         MOVE AT-BILL-CYCLE          TO BN-BILL-CYCLE             
C35066         MOVE '90'                   TO RW-READ-CYCLE             
C35066     ELSE                                                         
C35066         MOVE AT-BILL-CYCLE          TO BN-BILL-CYCLE             
C35066         MOVE UT-READ-CYCLE          TO RW-READ-CYCLE             
C35066     END-IF.                                                      
C35066*                                                                         
C35066*    GET REV MONTH & ITS CYCLE DATES ONLY WHEN CYCLE CHNG                 
C35066     IF WS-PREV-READ-CYCLE     = RW-READ-CYCLE                    
C35066        AND WS-PREV-BILL-CYCLE = BN-BILL-CYCLE                    
C35066        CONTINUE                                                  
C35066     ELSE                                                         
C35066        MOVE RW-READ-CYCLE       TO WS-PREV-READ-CYCLE            
C35066        MOVE BN-BILL-CYCLE       TO WS-PREV-BILL-CYCLE            
C35066        PERFORM 1210-CHECK-BILL-CYCLE THRU 1210-EXIT              
C35066     END-IF.                                                      
C35066*                                                                         
C35066*    GET MID-MONTH OPEN & CLOSE DATES ONLY WHEN REV MONTH CHANGE          
C36317     IF MIDMONTH-READ-ALL                                         
C35066        AND WS-MIDMONTH-REV-MONTH NOT = RW-REVENUE-MONTH          
C35066        MOVE RW-REVENUE-MONTH TO WS-MIDMONTH-REV-MONTH            
C35066        PERFORM 7170-SELECT-MIDMONTH-WIN  THRU 7170-EXIT          
C35066     END-IF.                                                      
C35066*                                                                         
       1200-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*****************************************************************         
C35066*   IF READ DATE IS NOT IN READ WINDOW THEN INSERT A WORK QUEUE.*         
C35066*   IF THE BILL CYCLE HAS CLOSED THEN INSERT A WORK QUEUE.      *         
C35066*****************************************************************         
C35066 1210-CHECK-BILL-CYCLE.                                           
C35066*                                                                         
C35066     PERFORM 7130-SELECT-READ-WINDOW     THRU 7130-EXIT.          
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                    
C35066         SET ACCOUNT-SKIP            TO TRUE                      
C35066         MOVE MSG-RD-WINDOW-NOT-FOUND                             
C35066                                     TO WS-WQ-MESSAGE             
C35066         MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
C35066         MOVE '4'                    TO WS-ROUTING-CATEGORY       
C35066         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
C35066         GO TO 1210-EXIT                                          
C35066     END-IF.                                                      
C35066*                                                                         
C35066     MOVE RW-REVENUE-MONTH           TO WS-REVENUE-MONTH          
C35066                                        BN-REVENUE-MONTH.         
C35066     PERFORM 7140-SELECT-BILL-WINDOW     THRU 7140-EXIT.          
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                    
C35066         SET ACCOUNT-SKIP            TO TRUE                      
C35066         MOVE MSG-BL-WINDOW-NOT-FOUND                             
C35066                                     TO WS-WQ-MESSAGE             
C35066         MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
C35066         MOVE '4'                    TO WS-ROUTING-CATEGORY       
C35066         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
C35066         GO TO 1210-EXIT                                          
C35066     END-IF.                                                      
C35066*                                                                         
C35066 1210-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
PRJ914*===============================================================*         
PRJ914 1220-CHECK-MTRD-ENV.                                             
PRJ914*===============================================================*         
PRJ914*                                                                         
PRJ914     SET REGULAR-CYCLE-READ        TO TRUE.                       
PRJ914     PERFORM 7150-SELECT-MTRD-ENVRNMT THRU 7150-EXIT.             
PRJ914     IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND OR WS-811          
PRJ914         SET METER-SKIP              TO TRUE                      
PRJ914         IF  WS-ACTIVE-RETURN-CODE = WS-811                       
PRJ914             MOVE MSG-DUP-MTRD-ENV   TO WS-WQ-MESSAGE             
PRJ914         ELSE                                                     
PRJ914             MOVE MSG-NO-MTRD-ENV    TO WS-WQ-MESSAGE             
PRJ914         END-IF                                                   
PRJ914         MOVE WS-CATEGORY-ID-141     TO  WS-CATEGORY-ID           
PRJ914         MOVE '4'                    TO  WS-ROUTING-CATEGORY      
PRJ914         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914 1220-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
PRJ914*===============================================================*         
PRJ914 1230-CHECK-CNS-HIST.                                             
PRJ914*===============================================================*         
PRJ914*                                                                         
PRJ914     MOVE MN-ACCOUNT-NO              TO CX-ACCOUNT-NO             
PRJ914     MOVE MN-CODE-UTIL-TYPE          TO CX-CODE-UTIL-TYPE         
PRJ914     MOVE E-FBW06-DATE-READ          TO CX-DATE-READ              
PRJ914     MOVE E-FBW06-METER-NO           TO CX-METER-NO               
PRJ914*                                                                         
PRJ914     PERFORM 7416-VERIFY-EXISTING-CX  THRU 7416-EXIT.             
PRJ914     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
PRJ914         SET MTR-CHNG-OFF-CYC-READ   TO TRUE                      
PRJ914         MOVE CX-IC-NO               TO MN-IC-NO                  
PRJ914     ELSE                                                         
PRJ914         SET METER-SKIP              TO TRUE                      
PRJ914         MOVE MSG-MTR-CHNG-DEMAND-CORR TO WS-WQ-MESSAGE           
PRJ914         MOVE WS-CATEGORY-ID-141     TO  WS-CATEGORY-ID           
PRJ914         MOVE '4'                    TO  WS-ROUTING-CATEGORY      
PRJ914         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914 1230-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
PRJ914*===============================================================*         
PRJ914 1240-CHECK-MTR-CNS.                                              
PRJ914*===============================================================*         
PRJ914*                                                                         
PRJ914     MOVE MN-ACCOUNT-NO              TO CX-ACCOUNT-NO             
PRJ914     MOVE MN-CODE-UTIL-TYPE          TO CX-CODE-UTIL-TYPE         
PRJ914     MOVE E-FBW06-DATE-READ          TO CX-DATE-READ              
PRJ914     MOVE E-FBW06-METER-NO           TO CX-METER-NO               
PRJ914*                                                                         
PRJ914     PERFORM 7416-VERIFY-EXISTING-CX  THRU 7416-EXIT.             
PRJ914     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
PRJ914        SET CC-CHNG-OFF-CYC-READ     TO TRUE                      
PRJ914**      MTRD ENV MAY EXISTS AS CC NOT COMPLETED YET.                      
PRJ914        MOVE CX-IC-NO                TO MN-IC-NO                  
PRJ914        PERFORM 7150-SELECT-MTRD-ENVRNMT THRU 7150-EXIT           
PRJ914     ELSE                                                         
PRJ914         SET METER-SKIP              TO TRUE                      
PRJ914         MOVE MSG-MTR-CHNG-DEMAND-CORR TO WS-WQ-MESSAGE           
PRJ914         MOVE WS-CATEGORY-ID-141     TO  WS-CATEGORY-ID           
PRJ914         MOVE '4'                    TO  WS-ROUTING-CATEGORY      
PRJ914         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914 1240-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
      *****************************************************************         
      * SEASON CHANGE CHECK                                           *         
      *****************************************************************         
       1400-CHECK-FOR-SEASON-CHG.                                       
      *** CHECK FOR SEASON CHANGE.                                              
           MOVE MN-LAST-REG-READ-DATE      TO WS-PREV-READ-DATE.        
           MOVE WS-PREV-READ-MM            TO WS-DATE-READ-MM.          
           MOVE WS-PREV-READ-DD            TO WS-DATE-READ-DD.          
           MOVE WS-DATE-READ-MMDD          TO WS-PREV-READ-COMP.        
           MOVE E-FBW06-DATE-READ          TO WS-DATE-NUM               
                                              RT-FROM-EFFECTIVE-DT.     
           MOVE WS-DATE-NUM-MM             TO WS-DATE-READ-MM.          
           MOVE WS-DATE-NUM-DD             TO WS-DATE-READ-DD.          
           MOVE WS-DATE-READ-MMDD          TO WS-CURR-READ-COMP.        
           MOVE UT-CODE-UTIL-TYPE          TO RT-CODE-UTIL-TYPE         
                                              RS-CODE-UTIL-TYPE         
                                              J4-CODE-UTIL-TYPE.        
           MOVE UT-RATE-PLAN-NO            TO RT-RATE-PLAN-NO           
                                              RS-RATE-PLAN-NO           
                                              J4-RATE-PLAN-NO.          
           PERFORM 7210-SELECT-RATE-VERSION THRU 7210-EXIT.             
           MOVE RT-VERSION-NO-CNTRL        TO RS-VERSION-NO-CNTRL       
                                              J4-VERSION-NO-CNTRL.      
           MOVE SPACES                     TO J4-SEAS-PRORATE-CD        
                                              WS-SEASN-CHG-DATE.        
           PERFORM 7220-SELECT-SEASONS      THRU 7220-EXIT              
           PERFORM 7230-GET-SEASN-PRT-TYPE THRU 7230-EXIT.              
      *                                                                         
      ***CHECK FOR SEASON CHANGE USING THE PREV AND CURR READ DATES             
      ***SET SEASON CHANGE TO TRUE, ONLY WHEN SEASONAL PRORATE IS BY            
      ***USAGE DAYS.                                                            
           MOVE WS-WORK-CC                 TO WS-DATE-NUM-CC.           
           MOVE WS-WORK-YY                 TO WS-DATE-NUM-YY.           
           IF  J4-SEAS-PRORATE-CD = WS-U                                
               IF  WS-PREV-READ-COMP < RS-DATE-FROM                     
                    AND WS-CURR-READ-COMP >= RS-DATE-FROM               
                   SET SEASON-CHANGE       TO TRUE                      
                   MOVE RS-DATE-FROM       TO WS-DATE-READ-MMDD         
                   MOVE WS-DATE-READ-MM    TO WS-DATE-NUM-MM            
                   MOVE WS-DATE-READ-DD    TO WS-DATE-NUM-DD            
               ELSE                                                     
                   IF  WS-PREV-READ-COMP <= RS-DATE-TO                  
                        AND WS-CURR-READ-COMP > RS-DATE-TO              
                       SET SEASON-CHANGE   TO TRUE                      
                       MOVE RS-DATE-TO     TO WS-DATE-READ-MMDD         
                       MOVE WS-DATE-READ-MM TO WS-DATE-NUM-MM           
                       MOVE WS-DATE-READ-DD TO WS-DATE-NUM-DD           
                       PERFORM 7350-ADD-ONE-DAY THRU 7350-EXIT          
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
      *SET START DATE OR (END-DATE + 1 DAY) AS THE SEASON CHANGE DATE           
           MOVE WS-DATE-NUM                TO WS-SEASN-CHG-DATE.        
      *                                                                         
       1400-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*===============================================================*         
C35066 1500-VALIDATE-READ-EXCEPTIONS.                                   
C35066*===============================================================*         
C35066* IDENTIFY FIELD HILO FAILS AND SUPERVISOR ESTIMATES IN ORDER   *         
C35066* TO POST ONLY TO ROUTE REPORT AND RE-PROCESS ONCE CYCLE OPEN   *         
C35066*---------------------------------------------------------------*         
C35066     MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                         
C35066                                     TO FIOBW06                   
C35066     MOVE E-FBW06-READ-ITEM-STATUS   TO WS-READ-ITEM-STATUS.      
C35066*                                                                         
C35066     IF BILLING-READ OR MIDMONTH-READ                             
C35066        IF MIDMONTH-READ                                          
C35066           MOVE WS-MIDMONTH-WIN-OPEN-DT  TO                       
C35066                          WS-BILL-WINDOW-OPEN-DT                  
C35066           MOVE WS-MIDMONTH-WIN-CLOSE-DT TO                       
C35066                          WS-BILL-WINDOW-CLOSE-DT                 
C35066        END-IF                                                    
P00508*                                                                         
P00508        IF E-FBW06-CODE-METER-NO-READ = '!'                       
P00508           SET MDM-ESTIMATED-READ   TO TRUE                       
P00508        END-IF                                                    
P00508*                                                                         
P00508        IF (E-FBW06-CODE-METER-NO-READ = '>'                      
P00508           OR E-FBW06-CODE-METER-NO-READ = '<')                   
P00508           SET MDM-HI-LO-EXCEPT     TO TRUE                       
P00508        END-IF                                                    
P00508*                                                                         
C35066        IF WS-BILL-WINDOW-OPEN-DT  >  WS-RUN-DATE                 
C35066           AND (E-FBW06-READ-PROCESS-CD = WS-UNPROCESSED          
C35066            OR E-FBW06-READ-PROCESS-CD = WS-SUPERVISOR-ESTIMATE)  
P00508           AND NOT SMART-SYNCH-MTR                                
C35066           SET WS-SUPERVISOR-EST-READ TO TRUE                     
C35066           GO TO 1500-EXIT                                        
C35066        END-IF                                                    
C35066*                                                                         
C35066        IF WS-BILL-WINDOW-OPEN-DT  >  WS-RUN-DATE                 
C35066           AND E-FBW06-CODE-METER-NO-READ > SPACES                
C35066           PERFORM VARYING WS-HILO-SYMBOL-SUB FROM 1 BY 1         
C35066              UNTIL WS-HILO-SYMBOL-SUB > 10                       
C35066               OR WS-FIELD-HI-LO-EXCEPT                           
C35066               OR WS-HILO-SYMBOL (WS-HILO-SYMBOL-SUB) = SPACES    
C35066               IF E-FBW06-CODE-METER-NO-READ =                    
C35066                      WS-HILO-SYMBOL (WS-HILO-SYMBOL-SUB)         
C35066                  SET WS-FIELD-HI-LO-EXCEPT TO TRUE               
C35066               END-IF                                             
C35066           END-PERFORM                                            
C35066        END-IF                                                    
C35066     END-IF.                                                      
C35066*                                                                         
C35066 1500-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
      *****************************************************************         
      * EDITS TO VALIDATE EACH REGISTER READ                          *         
      *****************************************************************         
      *                                                                         
       1600-VALIDATE-METER-READ-DATA.                                   
      *                                                                         
           MOVE SPACES                     TO WS-HILO-FAIL-IND.         
           MOVE ZEROS                      TO WS-CRNT-USE               
                                              WS-NO-READ-DAYS.          
           MOVE E-FBW06-READ-ITEM-STATUS   TO WS-READ-ITEM-STATUS.      
      *                                                                         
      *PROCESS IRREGULAR METER READ CODES AND COMMENTS                          
           IF  E-FBW06-MTR-COMMENT-TX > SPACES                          
                OR E-FBW06-MTR-COND-CD1 > SPACES                        
                OR E-FBW06-MTR-COND-CD2 > SPACES                        
               PERFORM 2100-PROCESS-MTR-RDR-COMMENTS THRU 2100-EXIT     
           END-IF.                                                      
C35066*                                                                         
C35066     IF WS-FIELD-HI-LO-EXCEPT                                     
C35066        OR WS-SUPERVISOR-EST-READ                                 
C35066        MOVE SPACES TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)         
C35066        MOVE ZEROS  TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)           
C35066        GO TO 1600-EXIT                                           
C35066     END-IF.                                                      
C35066*                                                                         
      *DO NOT POST BILLING READ, IF A PENDING-OFF ORDER EXISTS                  
32072 *EXCEPT FOR SEB ACCOUNTS.                                                 
C37129*ALL READS ON ACCOUNTS HAVING PENDING-OFF ORDER ARE STORED IN             
C37129*ROUTE REPORT TABLE UNTIL BILL CYCLE CLOSING DATE. AND ON CYCLE           
C37129*CLOSING DAY PGM TRY TO POST ALL THESE READS.                             
      *                                                                         
32072      IF SEB-DATABASE                                              
32072         CONTINUE                                                  
32072      ELSE                                                         
              IF BILLING-READ                                           
A03291           AND AT-CODE-ACCT-STAT        = WS-ACTIVE               
A03291           AND MN-CODE-METER-STATUS NOT = WS-REMOVED              
A03291           AND MN-CODE-METER-STATUS NOT = WS-INACTIVE             
C37129           AND WS-PEND-OFF-DT-MIN-2  > SPACES                     
A02367           AND WS-PEND-OFF-DT-MIN-2 <= WS-BILL-WINDOW-CLOSE-DT    
                 AND WS-BILL-WINDOW-CLOSE-DT NOT = WS-RUN-DATE          
                 IF  NOT PEND-OFF-WQ-CREATED                            
C37129              MOVE WS-CATEGORY-ID-167  TO WS-CATEGORY-ID          
C37129              MOVE '3'                 TO WS-ROUTING-CATEGORY     
C37129              MOVE MSG-PENDING-OFF     TO WS-WQ-MESSAGE           
                    PERFORM 2500-CREATE-WQ THRU 2500-EXIT               
                    SET PEND-OFF-WQ-CREATED TO TRUE                     
                 END-IF                                                 
                 MOVE SPACES TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                 MOVE ZEROS  TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)        
                 GO TO 1600-EXIT                                        
              END-IF                                                    
32072      END-IF.                                                      
      *                                                                         
      *PROCESS PSNC REMOVED METER SURVEY DATA                                   
      *                                                                         
           IF AT-COMPANY-NO = WS-PSNC                                   
                AND MN-CODE-METER-STATUS = WS-REMOVED                   
              IF E-FBW06-CODE-METER-NO-READ = WS-SRVY-VISITED           
                                           OR WS-SRVY-NOT-VISITED       
                CONTINUE                                                
              ELSE                                                      
                MOVE WS-SRVY-NOT-VISITED TO E-FBW06-CODE-METER-NO-READ  
              END-IF                                                    
              MOVE E-FBW06-CODE-METER-NO-READ                           
                            TO WS-FBW06-NO-READ-CD(WS-FBW06-SUB)        
              SET WS-MN-PROCESS TO TRUE                                 
              MOVE WS-TYPE-PROCESS TO WS-FBW06-MN-RG-CD (WS-FBW06-SUB)  
              MOVE WS-NORMAL-READ                                       
                           TO WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)      
              MOVE SPACES  TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)        
              MOVE ZEROS   TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)          
              MOVE FIOBW06 TO WS-FBW06-READ-REC (WS-FBW06-SUB)          
              GO TO 1600-EXIT                                           
           END-IF.                                                      
      *                                                                         
           MOVE AT-ACCOUNT-NO              TO MN-ACCOUNT-NO             
                                              RG-ACCOUNT-NO.            
           MOVE AT-COMPANY-NO              TO MC-COMPANY-NO.            
           MOVE E-FBW06-METER-NO           TO MN-METER-NO               
                                              RG-METER-NO               
                                              MC-METER-NO.              
           MOVE E-FBW06-CODE-UTIL-TYPE     TO MN-CODE-UTIL-TYPE         
                                              RG-CODE-UTIL-TYPE         
                                              MC-CODE-UTIL-TYPE.        
           MOVE MN-IC-NO                   TO RG-IC-NO                  
           MOVE MN-MTR-REF-NO              TO RG-MTR-REF-NO             
           MOVE E-FBW06-CODE-USAGE-TYPE    TO MN-CODE-USAGE-TYPE        
                                              RG-CODE-USAGE-TYPE        
                                              WS-SAVE-UTYPE.            
           MOVE E-FBW06-CODE-TIME-PERIOD   TO MN-CODE-TIME-PERIOD       
                                              RG-CODE-TIME-PERIOD       
                                              WS-SAVE-TP.               
P00251     MOVE E-FBW06-CODE-USAGE-ID      TO MN-CODE-USAGE-ID          
P00251                                        RG-CODE-USAGE-ID          
P00251                                        WS-SAVE-CODE-USAGE-ID.    
      *                                                                         
C29853     IF  E-FBW06-CNSMPTN-READ-FL EQUAL 'N' OR INFO-READ           
C36317         OR OFF-CYCLE-READ OR MIDMONTH-INFO-READ                  
C29853         MOVE SPACES                 TO                           
C29853                               WS-FBW06-RD-VALID-FL(WS-FBW06-SUB) 
C29853         MOVE ZEROS                  TO                           
C29853                               WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
C29853         PERFORM 1610-PROCESS-NON-CNSMPTN-RD THRU 1610-EXIT       
C29853         GO TO 1600-EXIT                                          
C29853     END-IF.                                                      
      *                                                                         
C29853*SEB: IF THE READ IS ESTIMATED, CHECK CONSEC-ESTIMATE COUNTER             
C29853*DO NOT POST READ IF IT IS > 2 (INCLUDING THE CURRENT ESTIMATE)           
      *                                                                         
C29853     IF  E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE          
C29853            AND SEB-DATABASE AND MN-NO-CONSEC-ESTIMATE > 1        
C29853         DISPLAY 'SKIP: METER ESTIMATED FOR MORE THAN 2 MONTHS'   
C29853         MOVE SPACES                 TO                           
C29853                            WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
C29853         MOVE ZEROS                  TO                           
C29853                               WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
C29853         GO TO 1600-EXIT                                          
C29853     END-IF.                                                      
      *                                                                         
           MOVE 'N'                        TO WS-READ-SKIP-FL.          
A00914     SET DEMAND-WQ-REQ               TO TRUE.                     
           IF  SEASON-CHANGE                                            
               IF  E-FBW06-CODE-TOU-SEASN = WS-PREVIOUS                 
                   PERFORM 1620-CHECK-FOR-REGISTER THRU 1620-EXIT       
               ELSE                                                     
                   PERFORM 1625-SEARCH-FOR-REGISTER THRU 1625-EXIT      
               END-IF                                                   
           ELSE                                                         
               PERFORM 1620-CHECK-FOR-REGISTER THRU 1620-EXIT           
           END-IF.                                                      
      *                                                                         
           IF  READ-SKIP                                                
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
      *SKIP VALIDATING, IF THE READ RECORD IS UNPROCESSED                       
      *NO-READ-CODE: Z - SUPERVISOR ESTIMATE                                    
      *                                                                         
           IF  E-FBW06-READ-PROCESS-CD = WS-UNPROCESSED                 
                  OR E-FBW06-READ-PROCESS-CD = WS-SUPERVISOR-ESTIMATE   
                  OR (E-FBW06-CODE-METER-NO-READ >= 'A'                 
                 AND  E-FBW06-CODE-METER-NO-READ <= 'Z')                
               ADD 1 TO WS-COUNT-NOT-READ                               
               MOVE 'Z' TO WS-FBW06-NO-READ-CD(WS-FBW06-SUB)            
               IF E-FBW06-CODE-METER-NO-READ > SPACES                   
                  MOVE E-FBW06-CODE-METER-NO-READ                       
                              TO WS-FBW06-NO-READ-CD(WS-FBW06-SUB)      
               END-IF                                                   
               IF E-FBW06-CODE-METER-READ = WS-REGULAR-READ             
                  MOVE WS-SKIP-READ TO E-FBW06-CODE-METER-READ          
               END-IF                                                   
               MOVE WS-NO TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)         
               MOVE ZEROS TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)           
               MOVE WS-NO-READ TO WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
C31977*                                                                         
C31977*FOLLOWING CODE IS COMMENTED AS PER DORIS DENT'S REQUEST                  
27793 *        IF E-FBW06-CODE-METER-NO-READ = WS-CUST-HAS-CARDS                
27793 *           ADD 1 TO MN-NO-CONSEC-CRD-READ                                
27793 *           MOVE ZERO TO MN-NO-CONSEC-ESTIMATE                            
27793 *           IF MN-NO-CONSEC-CRD-READ > 11                                 
27793 *              MOVE MSG-CARD-READ-LIMIT TO WS-WQ-MESSAGE                  
27793 *              MOVE WS-CATEGORY-ID-141 TO WS-CATEGORY-ID                  
27793 *              MOVE '4' TO WS-ROUTING-CATEGORY                            
27793 *              PERFORM 2500-CREATE-WQ THRU 2500-EXIT                      
27793 *           END-IF                                                        
27793 *        END-IF                                                           
      *                                                                         
      *PER JEFFREY, CREATE A WQ ON 'DO NOT ESTIMATE' METERS                     
      *                                                                         
C36317***      NO READ SECURE RATE METERS WILL GET WQ IRRESPECTIVE OF           
C36317***      ESTIMATE OK FLAG ON UTIL ENVIRONMENT                             
C36317         IF WS-SECURED-RATE-FL = 'Y'                              
                  AND (NOT READ-MISSING-WQ-CRT)                         
A02711            AND ((MN-CODE-METER-STATUS NOT = WS-INACTIVE          
A02711                  AND MN-CODE-METER-STATUS NOT = WS-REMOVED)      
A02711                  AND AT-CODE-ACCT-STAT = WS-ACTIVE)              
                  SET READ-MISSING-WQ-CRT TO TRUE                       
                  MOVE MSG-NO-MTR-READ    TO WS-WQ-MESSAGE              
                  MOVE WS-CATEGORY-ID-141 TO WS-CATEGORY-ID             
                  MOVE '4'                TO WS-ROUTING-CATEGORY        
                  PERFORM 2500-CREATE-WQ THRU 2500-EXIT                 
               END-IF                                                   
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE WS-FBW06-REG-ID-NO(WS-FBW06-SUB)                        
                                           TO MC-REG-ID-NO.             
           MOVE ZEROS                      TO MC-FULL-SCALE.            
           PERFORM 7320-SELECT-MTR-CAP      THRU 7320-EXIT.             
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                    
               MOVE MSG-NO-MTR-CAP         TO WS-WQ-MESSAGE             
               IF  MC-CODE-UTIL-TYPE EQUAL WS-GAS                       
                   MOVE WS-CATEGORY-ID-141 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
               ELSE                                                     
A03352             MOVE WS-CATEGORY-ID-528 TO WS-CATEGORY-ID            
A03352             MOVE '4'                TO WS-ROUTING-CATEGORY       
               END-IF                                                   
               MOVE 'N'                    TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE WS-VERIFIED-READ       TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
               MOVE ZEROS                  TO                           
                                     WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
               PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
               GO TO 1600-EXIT                                          
30989      ELSE                                                         
30989          IF CSR-DATABASE                                          
30989            IF MC-COMPANY-NO = WS-SCEG                             
P00447              IF MC-CODE-UTIL-TYPE = WS-E AND MC-CONSTANT = 0     
P00447                 SET WS-METER-WARNING    TO TRUE                  
A03352                 MOVE WS-CATEGORY-ID-528 TO WS-CATEGORY-ID        
A03352                 MOVE '4'                TO WS-ROUTING-CATEGORY   
P00447                 MOVE MSG-ELECTRIC-METER-CONSTANT                 
P00447                                         TO WS-WQ-MESSAGE         
P00447                 PERFORM 2500-CREATE-WQ THRU 2500-EXIT            
P00447              ELSE                                                
30989                  IF MC-CODE-UTIL-TYPE = WS-GAS AND MC-CONSTANT > 1
30989                     SET WS-METER-WARNING    TO TRUE               
30989                     MOVE WS-CATEGORY-ID-232 TO WS-CATEGORY-ID     
30989                     MOVE '4'                TO WS-ROUTING-CATEGORY
30989                     MOVE MSG-GAS-METER-CONSTANT TO WS-WQ-MESSAGE  
30989                     PERFORM 2500-CREATE-WQ THRU 2500-EXIT         
30989                  END-IF                                           
P00447              END-IF                                              
30989            END-IF                                                 
30989          END-IF                                                   
           END-IF.                                                      
      *                                                                         
           MOVE MC-CONSTANT                TO                           
                                   WS-FBW06-CONSTANT (WS-FBW06-SUB).    
           MOVE MC-NO-READ-DIALS           TO                           
                                   WS-FBW06-RD-DIALS (WS-FBW06-SUB).    
      *                                                                         
           IF  WS-MN-PROCESS                                            
                AND E-FBW06-DATE-READ <= MN-LAST-REG-READ-DATE          
               DISPLAY 'METER ALREADY READ ON OR AFTER ITRON READ DATE',
A03494               ' ', E-FBW06-ACCOUNT-NO                            
C36317         SET WS-INVALID-READ-DATE    TO TRUE                      
               MOVE SPACES                 TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE ZEROS                  TO                           
                                     WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
A03494         IF SEB-DATABASE                                          
A03494            SET IGNORE-SEB-READ TO TRUE                           
A03494            MOVE    MN-LAST-READ-VALUE TO WS-LAST-READ-VALUE      
A03494            COMPUTE WS-READING-DIFFERENCE =                       
A03494                   E-FBW06-METER-READING - WS-LAST-READ-VALUE     
ACT045            IF WS-READING-DIFFERENCE >= WS-WQ-ALREADY-READ-DIFF   
A03494               SET WS-INVALID-READ-DATE    TO TRUE                
A03494               MOVE MSG-SEB-AFTER-ITRON-READ-DATE                 
A03494                                           TO WS-WQ-MESSAGE       
A03494               MOVE WS-CATEGORY-ID-17  TO WS-CATEGORY-ID          
A03494               MOVE '4'                TO WS-ROUTING-CATEGORY     
A03494               PERFORM 2500-CREATE-WQ THRU 2500-EXIT              
A03494            END-IF                                                
A03494         END-IF                                                   
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
           IF  WS-RG-PROCESS                                            
                AND E-FBW06-DATE-READ <= RG-LAST-REG-READ-DT            
               DISPLAY 'METER ALREADY READ ON OR AFTER ITRON READ DATE',
A03494               ' ', E-FBW06-ACCOUNT-NO                            
C36317         SET WS-INVALID-READ-DATE    TO TRUE                      
               MOVE SPACES                 TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE ZEROS                  TO                           
                                     WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
A03494         IF SEB-DATABASE                                          
A03494            SET IGNORE-SEB-READ TO TRUE                           
A03494            MOVE    RG-LAST-READ-VALUE     TO WS-LAST-READ-VALUE  
A03494            COMPUTE WS-READING-DIFFERENCE =                       
A03494                   E-FBW06-METER-READING - WS-LAST-READ-VALUE     
ACT045            IF WS-READING-DIFFERENCE >= WS-WQ-ALREADY-READ-DIFF   
A03494               MOVE MSG-SEB-AFTER-ITRON-READ-DATE                 
A03494                                          TO WS-WQ-MESSAGE        
A03494               MOVE WS-CATEGORY-ID-17     TO WS-CATEGORY-ID       
A03494               MOVE '4'                   TO WS-ROUTING-CATEGORY  
A03494               PERFORM 2500-CREATE-WQ THRU 2500-EXIT              
A03494            END-IF                                                
A03494         END-IF                                                   
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
C37526******************************************************************        
C37526* FLAG ACCOUNTS WITH FUTURE READ DATE AS INVALID.                *        
C37526******************************************************************        
C37526     IF  ( E-FBW06-DATE-READ > WS-RUN-DATE )                      
C37526         SET WS-INVALID-READ-DATE    TO TRUE                      
C37526         MOVE SPACES                 TO                           
C37526                            WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
C37526         MOVE ZEROS                  TO                           
C37526                               WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
C37526         MOVE WS-CATEGORY-ID-141 TO WS-CATEGORY-ID                
C37526         MOVE '4'                TO WS-ROUTING-CATEGORY           
C37526         MOVE MSG-INVALID-READ-DATE  TO WS-WQ-MESSAGE             
C37526         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
C37526         GO TO 1600-EXIT                                          
C37526     END-IF                                                       
C37526*                                                                         
           IF  E-FBW06-INDEX-VALUE-CD EQUAL WS-INDEX                    
               COMPUTE WS-CRNT-USE ROUNDED = E-FBW06-METER-READING      
                           - WS-FBW06-PREV-READING (WS-FBW06-SUB)       
               IF  E-FBW06-CODE-USAGE-TYPE = WS-KWH                     
                     AND WS-CRNT-USE >= WS-MIN-INACT-E-USE AND < 0      
                   MOVE ZEROES             TO WS-CRNT-USE               
               END-IF                                                   
               IF  E-FBW06-CODE-UTIL-TYPE = WS-G                        
                     AND WS-CRNT-USE >= WS-MIN-INACT-G-USE AND < 0      
                   MOVE ZEROES             TO WS-CRNT-USE               
               END-IF                                                   
               IF  WS-CRNT-USE LESS ZERO                                
                   COMPUTE WS-METER-READ-NUM ROUNDED                    
                     = E-FBW06-METER-READING + 10 ** MC-NO-READ-DIALS   
                     COMPUTE WS-CRNT-USE ROUNDED = WS-METER-READ-NUM    
                               - WS-FBW06-PREV-READING (WS-FBW06-SUB)   
               END-IF                                                   
      *                                                                         
30989          IF E-FBW06-CODE-USAGE-TYPE = WS-CCF                      
30989                 AND MN-METER-PRESSURE > 0                         
30989             COMPUTE WS-FBW06-PCOMP-FCT (WS-FBW06-SUB) ROUNDED =   
30989                       (MN-METER-PRESSURE + 14.7) / 14.73          
30989             COMPUTE WS-CRNT-USE ROUNDED =                         
30989                WS-CRNT-USE * WS-FBW06-PCOMP-FCT (WS-FBW06-SUB)    
30989          ELSE                                                     
30989             MOVE 1.0 TO WS-FBW06-PCOMP-FCT (WS-FBW06-SUB)         
30989          END-IF                                                   
      *                                                                         
           ELSE                                                         
               COMPUTE WS-CRNT-USE ROUNDED = E-FBW06-METER-READING      
           END-IF.                                                      
PRJ914     IF E-FBW06-INDEX-VALUE-CD = WS-VALUE                         
PRJ914        AND OPEN-WAY-MTR                                          
PRJ914**      MOVE WS-CRNT-USE                TO                                
PRJ914**                       WS-FBW06-NO-UNITS (WS-FBW06-SUB)                 
PRJ914        COMPUTE WS-FBW06-NO-UNITS (WS-FBW06-SUB) ROUNDED          
PRJ914               = WS-CRNT-USE * 1                                  
PRJ914        COMPUTE WS-CRNT-USE ROUNDED                               
PRJ914               = WS-CRNT-USE / MC-CONSTANT                        
PRJ914        MOVE WS-CRNT-USE                TO                        
PRJ914                              WS-FBW06-CRNT-USE (WS-FBW06-SUB)    
PRJ914        COMPUTE E-FBW06-METER-READING ROUNDED                     
PRJ914                = E-FBW06-METER-READING / MC-CONSTANT             
PRJ914        MOVE FIOBW06 TO WS-FBW06-READ-REC (WS-FBW06-SUB)          
PRJ914     ELSE                                                         
PRJ914        MOVE WS-CRNT-USE                TO                        
PRJ914                              WS-FBW06-CRNT-USE (WS-FBW06-SUB)    
PRJ914        COMPUTE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                  
PRJ914                         ROUNDED = WS-CRNT-USE * MC-CONSTANT      
PRJ914     END-IF.                                                      
      *                                                                         
      *VALIDATION FOR FULL SCALE LIMIT                                          
           IF  E-FBW06-INDEX-VALUE-CD EQUAL WS-VALUE                    
                  AND (E-FBW06-CODE-USAGE-TYPE = WS-KW OR WS-KVA)       
               IF  MC-FULL-SCALE > 0                                    
                     AND E-FBW06-METER-READING >= MC-FULL-SCALE         
                   MOVE MSG-FULL-SCALE-LIMIT                            
                                           TO WS-WQ-MESSAGE             
A03352             IF AT-COMPANY-NO = '01'                              
A03352                MOVE WS-CATEGORY-ID-528 TO WS-CATEGORY-ID         
A03352                MOVE '4'                TO WS-ROUTING-CATEGORY    
A03352             ELSE                                                 
A03352                MOVE WS-CATEGORY-ID-529 TO WS-CATEGORY-ID         
A03352                MOVE '1'                TO WS-ROUTING-CATEGORY    
A03352             END-IF                                               
                   MOVE '9'                TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                   MOVE 'N'                TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
                   GO TO 1600-EXIT                                      
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
      *CALC WS-NO-OF-DAYS                                                       
           MOVE ZEROS                      TO WS-NO-READ-DAYS.          
           MOVE E-FBW06-DATE-READ          TO WS-CURR-READ-DATE.        
           IF  WS-MN-PROCESS                                            
               MOVE MN-LAST-REG-READ-DATE  TO WS-PREV-READ-DATE         
           ELSE                                                         
               MOVE RG-LAST-REG-READ-DT    TO WS-PREV-READ-DATE         
           END-IF.                                                      
           PERFORM 7330-GET-NO-DAYS THRU 7330-EXIT.                     
           IF  WS-NO-READ-DAYS EQUAL ZEROS                              
               MOVE 1                      TO WS-NO-READ-DAYS           
           END-IF.                                                      
           MOVE WS-NO-READ-DAYS            TO                           
                                  WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB). 
      *                                                                         
C29853*CHECK WHETHER PRIOR READ IS ESTIMATED & CURRENT DAYS <= LIMIT            
C29853     IF  SEB-DATABASE                                             
C29853           AND MN-CODE-LAST-REG-READ EQUAL WS-AGL-ESTIMATE        
C29853           AND WS-NO-READ-DAYS <=  WS-SEB-PREV-DAYS               
C29853         MOVE MSG-SEB-SYSTEM-EST     TO WS-WQ-MESSAGE             
C29853         MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
C29853         MOVE '4'                    TO WS-ROUTING-CATEGORY       
C29853         MOVE 'J'                    TO                           
C29853                            WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
C29853         MOVE 'N'                    TO                           
C29853                            WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
C29853         MOVE ZEROS                  TO                           
C29853                               WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
C29853         MOVE WS-VERIFIED-READ       TO                           
C29853                           WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
C29853         PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT             
C29853         GO TO 1600-EXIT                                          
C29853     END-IF.                                                      
C29853*                                                                         
      *INACTIVE METER HAS USAGE (NO-READ-CODE = 8)                              
           IF  ((MN-CODE-METER-STATUS = WS-REMOVED                      
                 OR AT-CODE-ACCT-STAT NOT = WS-ACTIVE)                  
                 OR (MN-CODE-METER-STATUS = WS-INACTIVE                 
                AND E-FBW06-READ-PROCESS-CD NOT = WS-SONP-READ))        
               IF  WS-CRNT-USE = 0                                      
                     OR (E-FBW06-CODE-UTIL-TYPE = WS-G                  
                    AND (WS-CRNT-USE <= WS-MAX-INACT-G-USE              
                    AND  WS-CRNT-USE >= WS-MIN-INACT-G-USE)             
                    AND  E-FBW06-INDEX-VALUE-CD EQUAL WS-INDEX)         
                     OR (E-FBW06-CODE-UTIL-TYPE = WS-E                  
                    AND (WS-CRNT-USE <= WS-MAX-INACT-E-USE              
                    AND  WS-CRNT-USE >= WS-MIN-INACT-E-USE)             
                    AND  E-FBW06-INDEX-VALUE-CD EQUAL WS-INDEX)         
C37129             DISPLAY 'INACTIVE ACC/MTR: IGNORE ZERO USAGE'        
                   MOVE ZEROS              TO                           
                                    WS-CRNT-USE                         
                                    WS-FBW06-CRNT-USE (WS-FBW06-SUB)    
                   MOVE ' '                TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                   MOVE WS-NORMAL-READ     TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
                   GO TO 1600-EXIT                                      
               ELSE                                                     
      *                                                                         
      *IF THERE IS A CUSTOMER CHANGE, IGNORE THE USE ON THIS ACCOUNT            
                   MOVE AT-PREMISE-NO      TO WS-CPD99-PREMISE-NO       
                   PERFORM 6990-FETCH-CUR-ACCOUNT THRU 6990-EXIT        
                   IF  WS-CPD99-ACCOUNT-NO NOT EQUAL AT-ACCOUNT-NO      
C37129                 DISPLAY 'CUSTOMER CHANGE: IGNORE USAGE'          
                       MOVE ZEROS          TO                           
                                    WS-CRNT-USE                         
                                    WS-FBW06-CRNT-USE (WS-FBW06-SUB)    
                       MOVE ' '            TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                       MOVE WS-NORMAL-READ TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
                       GO TO 1600-EXIT                                  
                   ELSE                                                 
                       MOVE MSG-INACT-METER-HAS-USE                     
                                           TO WS-WQ-MESSAGE             
                       PERFORM 1700-GET-WQ-CAT-INACT THRU 1700-EXIT     
                       MOVE '8'            TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                       MOVE 'N'            TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
                       MOVE WS-VERIFIED-READ TO                         
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                       PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT     
                       GO TO 1600-EXIT                                  
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
C36829*****************************************************************         
C36829* CREATE WQ IF THE DIFFERENCE BETWEEN E-FBW06-DATE-READ AND     *         
C36829* MN-LAST-REG-READ-DATE IS MORE THAN 90 DAYS.                   *         
C36829*****************************************************************         
C36829*                                                                         
C36829     IF WS-NO-READ-DAYS > 90                                      
C36829        SET WS-INVALID-READ-DATE    TO TRUE                       
C36829        MOVE SPACES                 TO                            
C36829                          WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
C36829        MOVE ZEROS                  TO                            
C36829                          WS-FBW06-CRNT-USE (WS-FBW06-SUB)        
C36829        MOVE WS-CATEGORY-ID-141 TO WS-CATEGORY-ID                 
C36829        MOVE '4'                TO WS-ROUTING-CATEGORY            
C36829        MOVE MSG-INVALID-DATE-DIFF  TO WS-WQ-MESSAGE              
C36829        PERFORM 2500-CREATE-WQ THRU 2500-EXIT                     
C36829        GO TO 1600-EXIT                                           
C36829     END-IF                                                       
C36829*                                                                         
      *CHECK FOR IMPOSSIBLE USE (NO-READ-CD = $)                                
           IF  WS-CRNT-USE GREATER THAN                                 
                     (9 * (10 ** (MC-NO-READ-DIALS - 1)))               
               STRING '    METER READER ID =  ',                        
                     E-FBW06-EMPLOYEE-NO                                
                     '  ',                                              
                     MSG-IMPOSSIBLE-USE                                 
               DELIMITED BY SIZE INTO WS-WQ-MESSAGE                     
ACT301         MOVE WS-CATEGORY-ID-583     TO WS-CATEGORY-ID            
               MOVE '4'                    TO WS-ROUTING-CATEGORY       
               MOVE '$'                    TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
               MOVE 'N'                    TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE ZEROS                  TO                           
                                     WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
               MOVE WS-VERIFIED-READ       TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
               PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT             
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
      *CHECK FOR NEGATIVE USE (NO-READ-CODE = J 'OTHER')                        
           IF  WS-CRNT-USE < 0                                          
               MOVE MSG-METER-HAS-NEG-USE  TO WS-WQ-MESSAGE             
ACT301         MOVE WS-CATEGORY-ID-583     TO WS-CATEGORY-ID            
               MOVE '1'                    TO WS-ROUTING-CATEGORY       
               MOVE 'J'                    TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
               MOVE 'N'                    TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE WS-VERIFIED-READ       TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
               PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT             
               GO TO 1600-EXIT                                          
           END-IF.                                                      
P00251                                                                  
P00251***Check for Un-authorized use (for PR1 rate customers)                   
P00251                                                                  
P00251     MOVE UT-CODE-UTIL-TYPE          TO J1-CODE-UTIL-TYPE.        
P00251     MOVE UT-RATE-PLAN-NO            TO J1-RATE-PLAN-NO.          
P00251     MOVE SPACES                     TO J1-CMPNT-ID-CD            
P00251     PERFORM 7690-SELECT-RATE-COMP-ID THRU 7690-EXIT.             
P00251                                                                  
P00251     IF J1-CMPNT-ID-CD = WS-CO-GEN-COMP-ID                        
A03172        AND WS-CRNT-USE > 5                                       
P00251        AND E-FBW06-CODE-USAGE-ID NOT = WS-CO-GENERATION          
A05744        MOVE MSG-UNAUTHORIZED-GEN-MTR TO WS-WQ-MESSAGE            
P00251        PERFORM 1700-GET-WQ-CAT-INACT THRU 1700-EXIT              
A05744        MOVE '='         TO WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
P00251        MOVE 'N'         TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
P00251        MOVE WS-VERIFIED-READ                                     
P00251                         TO WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
P00251        PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT              
P00251        GO TO 1600-EXIT                                           
P00251     END-IF                                                       
P00251*                                                                         
           IF  WS-CRNT-USE > 999999                                     
               MOVE MSG-METER-EXCEED-LIMIT TO WS-WQ-MESSAGE             
               MOVE WS-CATEGORY-ID-173     TO WS-CATEGORY-ID            
               MOVE '1'                    TO WS-ROUTING-CATEGORY       
               MOVE 'J'                    TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
               MOVE 'N'                    TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE WS-VERIFIED-READ       TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
               PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT             
               GO TO 1600-EXIT                                          
           END-IF.                                                      
      *                                                                         
C30662*CREATE A WARNING WQ IF THE DEMAND READ IS SAME AS LAST MONTH'S           
C30662     IF  E-FBW06-INDEX-VALUE-CD EQUAL WS-VALUE                    
C30662            AND (E-FBW06-CODE-USAGE-TYPE = WS-KW OR WS-KVA)       
C30662         IF  E-FBW06-METER-READING EQUAL                          
C30662                     WS-FBW06-PREV-READING (WS-FBW06-SUB)         
A00914             AND DEMAND-WQ-REQ                                    
C30662             SET WS-METER-WARNING    TO TRUE                      
C35066*            AS PER LESTER HOOD WQ CAT CHANGED 15 FROM 143                
C35066             MOVE WS-CATEGORY-ID-15  TO WS-CATEGORY-ID            
C30662             MOVE '1'                TO WS-ROUTING-CATEGORY       
C30662             MOVE MSG-DEMAND-RESET-ERROR                          
C30662                                     TO WS-WQ-MESSAGE             
C30662             MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                
C30662                                     TO WS-CRNT-USE               
C30662             PERFORM 2500-CREATE-WQ THRU 2500-EXIT                
C30662         END-IF                                                   
C30662     END-IF.                                                      
C30662*                                                                         
           IF  HILO-ON-PARM                                             
               PERFORM 1650-EXECUTE-HI-LO-CHK THRU 1650-EXIT            
A04462     ELSE                                                         
A04462         PERFORM 1655-NORMAL-READ THRU 1655-EXIT                  
A04462     END-IF.                                                      
      *                                                                         
       1600-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * VALIDATE NON CONSUMPTION READS LIKE PRE, TMP & VLT, ETC.      *         
      *****************************************************************         
       1610-PROCESS-NON-CNSMPTN-RD.                                     
      *                                                                         
      *SKIP VALIDATING, IF NON-CNSMPTN READ RECORD IS UNPROCESSED               
      *NO-READ-CODE: Z - SUPERVISOR ESTIMATE                                    
           IF  E-FBW06-READ-PROCESS-CD = WS-UNPROCESSED                 
                  OR E-FBW06-READ-PROCESS-CD = WS-SUPERVISOR-ESTIMATE   
                  OR (E-FBW06-CODE-METER-NO-READ >= 'A'                 
                 AND  E-FBW06-CODE-METER-NO-READ <= 'Z')                
               ADD 1                       TO WS-COUNT-NOT-READ         
               MOVE 'Z'                    TO                           
                                     WS-FBW06-NO-READ-CD(WS-FBW06-SUB)  
               IF  E-FBW06-CODE-METER-NO-READ > SPACES                  
                   MOVE E-FBW06-CODE-METER-NO-READ                      
                                           TO                           
                                     WS-FBW06-NO-READ-CD(WS-FBW06-SUB)  
               END-IF                                                   
               IF  E-FBW06-CODE-METER-READ EQUAL WS-REGULAR-READ        
                   MOVE WS-SKIP-READ       TO E-FBW06-CODE-METER-READ   
               END-IF                                                   
               MOVE WS-NO                  TO                           
                                     WS-FBW06-RD-VALID-FL(WS-FBW06-SUB) 
               MOVE ZEROS                  TO                           
                                     WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
               GO TO 1610-EXIT                                          
           END-IF                                                       
      *                                                                         
A03352     IF AT-COMPANY-NO = '01'                                      
A03352        MOVE WS-CATEGORY-ID-528      TO WS-CATEGORY-ID            
A03352        MOVE '4'                     TO WS-ROUTING-CATEGORY       
A03352     ELSE                                                         
A03352        MOVE WS-CATEGORY-ID-529      TO WS-CATEGORY-ID            
A03352        MOVE '1'                     TO WS-ROUTING-CATEGORY       
A03352     END-IF.                                                      
      *                                                                         
      *CHECK FOR METER CONSTANT SURVEY.                                         
           IF  E-FBW06-REG-MEASURE-CD EQUAL WS-CONSTANT-SURVEY          
               ADD 1                       TO WS-COUNT-SURVEY           
               MOVE 'A'                    TO MC-CODE-CAP-TYPE          
               MOVE ZEROS                  TO MC-CONSTANT               
               PERFORM 7325-GET-MTR-CONSTANT THRU 7325-EXIT             
               IF  E-FBW06-METER-READING NOT = MC-CONSTANT              
                   SET WS-METER-WARNING    TO TRUE                      
                   MOVE MSG-MTR-CONST-SURVEY  TO WS-WQ-MESSAGE          
                   MOVE 'N'                TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
                   MOVE ZEROS   TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)     
                   PERFORM 2500-CREATE-WQ THRU 2500-EXIT                
                   GO TO 1610-EXIT                                      
               END-IF                                                   
               GO TO 1610-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE WS-BASIC-SERVICE           TO                           
                                  WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB) 
           MOVE WS-ADDTNL-REGISTER         TO                           
                               WS-FBW06-CODE-USAGE-SOURCE (WS-FBW06-SUB)
           MOVE +1                         TO                           
                               WS-FBW06-CONSTANT (WS-FBW06-SUB)         
      *CHECK FOR OTHER NON-CNSMPTN READS                                        
           MOVE MN-CODE-UTIL-TYPE          TO OA-CODE-UTIL-TYPE.        
           MOVE MN-DIGTL-MTR-TYPE          TO OA-DIGTL-MTR-TYPE.        
           MOVE MN-PROGRAM-ID              TO OA-PROGRAM-ID.            
           MOVE MN-MTR-READ-SOURCE-CD      TO OA-MTR-READ-SOURCE-CD.    
           MOVE MN-REMOTE-READ-IND         TO OA-REMOTE-READ-IND.       
P00251     MOVE E-FBW06-CODE-USAGE-ID      TO OA-CODE-USAGE-ID          
P00251                                        WS-OA-CODE-USAGE-ID.      
           MOVE E-FBW06-CODE-USAGE-TYPE    TO OA-CODE-USAGE-TYPE.       
           MOVE E-FBW06-CODE-TOU-SEASN     TO OA-CODE-TOU-SEASN.        
           MOVE E-FBW06-CODE-TIME-PERIOD   TO OA-CODE-TIME-PERIOD.      
           MOVE ZEROS                      TO OA-MIN-READ               
                                              OA-MAX-READ.              
           PERFORM 7400-SELECT-MTR-RD-FMT THRU 7400-EXIT.               
           IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                    
               MOVE MSG-NO-MTR-RD-FMT-ENTRY TO WS-WQ-MESSAGE            
               SET WS-METER-WARNING        TO TRUE                      
               MOVE 'N'                    TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
               MOVE WS-VERIFIED-READ       TO                           
                              WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)      
               MOVE ZEROS   TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)         
               PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
               GO TO 1610-EXIT                                          
           END-IF.                                                      
      *                                                                         
           IF  OA-MIN-READ = ZEROS AND OA-MAX-READ EQUAL ZEROS          
               CONTINUE                                                 
           ELSE                                                         
               IF  E-FBW06-METER-READING < OA-MIN-READ                  
                   MOVE MSG-FAILED-LOW     TO WS-WQ-MESSAGE             
                   SET WS-METER-WARNING    TO TRUE                      
                   MOVE '1'                TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                   MOVE 'N'                TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
                   MOVE SPACES             TO                           
                                        WS-FBW06-MN-RG-CD (WS-FBW06-SUB)
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   MOVE ZEROS              TO                           
                                  WS-FBW06-CRNT-USE (WS-FBW06-SUB)      
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               ELSE                                                     
                   IF  E-FBW06-METER-READING > OA-MAX-READ              
                       SET WS-METER-WARNING                             
                                           TO TRUE                      
                       MOVE MSG-FAILED-HIGH                             
                                           TO WS-WQ-MESSAGE             
                       MOVE '4'            TO                           
                                  WS-FBW06-NO-READ-CD(WS-FBW06-SUB)     
                       MOVE 'N'            TO                           
                                  WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)    
                       MOVE SPACES         TO                           
                                        WS-FBW06-MN-RG-CD (WS-FBW06-SUB)
                       MOVE WS-VERIFIED-READ                            
                                           TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                       MOVE ZEROS          TO                           
                                      WS-FBW06-CRNT-USE (WS-FBW06-SUB)  
                       PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT     
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1610-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * DECIDE ON THE PROCESS                                         *         
      *****************************************************************         
       1620-CHECK-FOR-REGISTER.                                         
           PERFORM 7300-SELECT-MN THRU 7300-EXIT.                       
           IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
               SET WS-MN-PROCESS           TO TRUE                      
               MOVE WS-TYPE-PROCESS        TO                           
                                       WS-FBW06-MN-RG-CD (WS-FBW06-SUB) 
               MOVE MN-CODE-USAGE-SOURCE   TO                           
                               WS-FBW06-CODE-USAGE-SOURCE(WS-FBW06-SUB) 
               MOVE MN-CODE-USAGE-ID       TO                           
                               WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB)    
               MOVE MN-REG-ID-NO           TO                           
                                  WS-FBW06-REG-ID-NO(WS-FBW06-SUB)      
               MOVE MN-CODE-METER-STATUS   TO                           
                                  WS-FBW06-REG-STATUS (WS-FBW06-SUB)    
               MOVE MN-CODE-CRNT-REG-READ  TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
               MOVE MN-LAST-READ-VALUE     TO                           
                                  WS-FBW06-PREV-READING (WS-FBW06-SUB)  
           ELSE                                                         
               PERFORM 7310-SELECT-RG THRU 7310-EXIT                    
               IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL          
                   MOVE RG-CODE-USAGE-SOURCE                            
                                           TO                           
                               WS-FBW06-CODE-USAGE-SOURCE(WS-FBW06-SUB) 
                   MOVE RG-CODE-USAGE-ID   TO                           
                               WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB)    
                   SET WS-RG-PROCESS       TO TRUE                      
                   MOVE WS-TYPE-PROCESS    TO                           
                                       WS-FBW06-MN-RG-CD (WS-FBW06-SUB) 
                   MOVE RG-REG-ID-NO       TO                           
                                  WS-FBW06-REG-ID-NO(WS-FBW06-SUB)      
                   MOVE RG-CODE-REG-STATUS TO                           
                                  WS-FBW06-REG-STATUS (WS-FBW06-SUB)    
                   MOVE RG-CODE-CRNT-REG-READ                           
                                           TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   MOVE RG-LAST-READ-VALUE TO                           
                                  WS-FBW06-PREV-READING (WS-FBW06-SUB)  
               ELSE                                                     
                   MOVE MSG-NO-MN-RG-ERR   TO WS-WQ-MESSAGE             
                   IF  MC-CODE-UTIL-TYPE EQUAL WS-GAS                   
                       MOVE WS-CATEGORY-ID-141                          
                                           TO WS-CATEGORY-ID            
                       MOVE '4'            TO WS-ROUTING-CATEGORY       
                   ELSE                                                 
A03352                 MOVE WS-CATEGORY-ID-528                          
                                           TO WS-CATEGORY-ID            
A03352                 MOVE '4'            TO WS-ROUTING-CATEGORY       
                   END-IF                                               
                   MOVE 'N'                TO                           
                                   WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)   
                   MOVE WS-VERIFIED-READ   TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
                   MOVE ZEROS              TO                           
                                    WS-FBW06-CRNT-USE (WS-FBW06-SUB)    
                   PERFORM 2500-CREATE-WQ THRU 2500-EXIT                
                   SET READ-SKIP           TO TRUE                      
                   GO TO 1620-EXIT                                      
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1620-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *   SEARCH FOR THE REGISTER                                      *        
      ******************************************************************        
       1625-SEARCH-FOR-REGISTER.                                        
           SET REGISTER-NOT-FOUND          TO TRUE.                     
           MOVE 1                          TO WS-SRCH-SUB.              
           PERFORM UNTIL WS-SRCH-SUB > WS-FBW06-MAX-SUB                 
                      OR REGISTER-FOUND                                 
              MOVE WS-FBW06-READ-REC(WS-SRCH-SUB) TO FIOBW06            
              IF  E-FBW06-CODE-USAGE-TYPE = WS-SAVE-UTYPE               
                    AND E-FBW06-CODE-TIME-PERIOD = WS-SAVE-TP           
                    AND E-FBW06-CODE-TOU-SEASN   = WS-PREVIOUS          
P00251              AND E-FBW06-CODE-USAGE-ID    = WS-SAVE-CODE-USAGE-ID
                  SET REGISTER-FOUND       TO TRUE                      
                  MOVE WS-FBW06-CODE-USAGE-SOURCE(WS-SRCH-SUB)          
                                           TO                           
                             WS-FBW06-CODE-USAGE-SOURCE(WS-FBW06-SUB)   
                  MOVE WS-FBW06-CODE-USAGE-ID (WS-SRCH-SUB)             
                                           TO                           
                               WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB)    
                  MOVE WS-FBW06-MN-RG-CD (WS-SRCH-SUB)                  
                                           TO                           
                                       WS-FBW06-MN-RG-CD (WS-FBW06-SUB) 
                  MOVE WS-FBW06-REG-ID-NO(WS-SRCH-SUB)                  
                                           TO                           
                                  WS-FBW06-REG-ID-NO(WS-FBW06-SUB)      
                  MOVE WS-FBW06-REG-STATUS (WS-SRCH-SUB)                
                                           TO                           
                                  WS-FBW06-REG-STATUS (WS-FBW06-SUB)    
                  IF  WS-FBW06-RD-VALID-FL (WS-SRCH-SUB) = 'Y'          
                      MOVE WS-FBW06-MN-RG-READ-CD(WS-SRCH-SUB)          
                                           TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                      MOVE E-FBW06-METER-READING                        
                                           TO                           
                                  WS-FBW06-PREV-READING (WS-FBW06-SUB)  
A00914                SET DEMAND-WQ-NOT-REQ TO TRUE                     
                  ELSE                                                  
                      MOVE WS-FBW06-NO-READ-CD(WS-SRCH-SUB)             
                                           TO                           
                                      WS-FBW06-NO-READ-CD(WS-FBW06-SUB) 
                      MOVE 'N'             TO                           
                                      WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)
                      MOVE WS-VERIFIED-READ                             
                                           TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
                      MOVE ZEROS           TO                           
                                       WS-FBW06-CRNT-USE (WS-FBW06-SUB) 
                      SET READ-SKIP        TO TRUE                      
                  END-IF                                                
                  MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                  
                                           TO FIOBW06                   
              END-IF                                                    
              COMPUTE WS-SRCH-SUB = WS-SRCH-SUB + 1                     
           END-PERFORM.                                                 
      *                                                                         
           IF  REGISTER-NOT-FOUND                                       
A01738         MOVE WS-FBW06-READ-REC(WS-FBW06-SUB) TO FIOBW06          
               PERFORM 1620-CHECK-FOR-REGISTER THRU 1620-EXIT           
           END-IF.                                                      
      *                                                                         
       1625-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *   EXECUTE CPD00072 LOGIC TO GET HIGH/LOW'S                     *        
      ******************************************************************        
       1650-EXECUTE-HI-LO-CHK.                                          
      *                                                                         
A04462     IF E-FBW06-CODE-USAGE-ID = WS-STAND-BY-USAGE                 
A04462        PERFORM 1655-NORMAL-READ THRU 1655-EXIT                   
A04462        GO TO 1650-EXIT                                           
A04462     END-IF.                                                      
      *                                                                         
A00795     MOVE MN-ACCOUNT-NO              TO CWS72-ACCOUNT-NO          
A00795     MOVE MN-MTR-REF-NO              TO CWS72-MTR-REF-NO          
A00795     MOVE MN-CODE-UTIL-TYPE          TO CWS72-UTIL-TYPE           
A00795     MOVE MN-IC-NO                   TO CWS72-IC-NO               
A00795     MOVE E-FBW06-CODE-TIME-PERIOD   TO CWS72-TIME-PERIOD         
A00795                                        CX-CODE-TIME-PERIOD       
A00795     MOVE UT-RATE-PLAN-NO            TO CWS72-RATE-PLAN           
A00795     MOVE AT-REV-MTH-LST-NRML        TO CWS72-REV-MTH-LST-NRML    
P00251     MOVE E-FBW06-CODE-USAGE-ID      TO CWS72-CODE-USAGE-ID       
A00795     SET CWS72-BATCH-CALL            TO TRUE.                     
A00795*                                                                         
      *CALL CPD72 ONLY IF IT'S FIRST TIME FOR A METER OR TIME-PERIOD CHG        
           IF  CX-CODE-TIME-PERIOD NOT EQUAL WS-PREV-TIME-PERIOD        
P00251      OR E-FBW06-CODE-USAGE-ID NOT = WS-PREV-CODE-USAGE-ID        
                OR GET-HILO                                             
               MOVE CX-CODE-TIME-PERIOD    TO WS-PREV-TIME-PERIOD       
P00251         MOVE E-FBW06-CODE-USAGE-ID TO WS-PREV-CODE-USAGE-ID      
               MOVE 'N'                    TO WS-GET-HILO-FL            
A00795         PERFORM 6351-CPD72-HI-LO-MAIN                            
A00795            THRU 6351-CPD72-EXIT                                  
           END-IF.                                                      
      *                                                                         
      **  THIS CODE IS ADDED TO CHECK SQL RETURN CODE FROM THE COPY **          
      **  BOOK CPD00072  WHICH IS USED TO PERFORM HI\LO CHECK       **          
      *                                                                         
A00795     IF CWS72-WARNING                                             
A00795         DISPLAY ' '                                              
A00795         DISPLAY '***************************************'        
A00795         DISPLAY '**     PCSBW143 PROCESSING WARNING   **'        
A00795         DISPLAY ' in ' CWS72-ERROR-PARAGRAPH-NAME                
A00795         DISPLAY 'CWS72-ERROR-MESSAGE:'  CWS72-ERROR-MESSAGE      
A00795         DISPLAY '***************************************'        
A00795     END-IF.                                                      
A00795     IF CWS72-ERROR                                               
A00795         DISPLAY ' '                                              
A00795         DISPLAY '***************************************'        
A00795         DISPLAY '**     PCSBW143 PROCESSING ERROR     **'        
A00795         DISPLAY ' in ' CWS72-ERROR-PARAGRAPH-NAME                
A00795         DISPLAY 'CWS72-ERROR-MESSAGE:'  CWS72-ERROR-MESSAGE      
A00795         DISPLAY 'CWS72-ERROR-SQLCODE:'  CWS72-ERROR-SQLCODE      
A00795         DISPLAY 'CWS72-ERROR-FUNCTION:' CWS72-ERROR-FUNCTION     
A00795         DISPLAY 'CWS72-ERROR-TABLE1:'   CWS72-ERROR-TABLE1       
A00795         DISPLAY 'CWS72-ERROR-TABLE2:'   CWS72-ERROR-TABLE2       
A00795         DISPLAY  CWS72-ERROR-TAB-COLUMN-1 '='                    
A00795                          CWS72-ERROR-HOSTVAR-1                   
A00795         DISPLAY  CWS72-ERROR-TAB-COLUMN-2 '='                    
A00795                          CWS72-ERROR-HOSTVAR-2                   
A00795         DISPLAY  CWS72-ERROR-TAB-COLUMN-3 '='                    
A00795                          CWS72-ERROR-HOSTVAR-3                   
A00795         DISPLAY  CWS72-ERROR-TAB-COLUMN-4 '='                    
A00795                          CWS72-ERROR-HOSTVAR-4                   
A00795         PERFORM 9900-ABEND  THRU  9900-EXIT                      
A00795         DISPLAY '***************************************'        
A00795     END-IF.                                                      
A00795*                                                                         
           MOVE SPACES                     TO WS-HILO-FAIL-IND.         
           PERFORM 1675-EVALUATE-HIGH-LOW THRU 1675-EXIT.               
                                                                        
           IF  HILO-FAIL                                                
               ADD 1                       TO WS-HIGH-LOW-FAIL          
               IF  AT-CODE-ACCT-STAT NOT = 'S'                          
P00508             PERFORM 1680-SET-HILO-CODES THRU 1680-EXIT           
               END-IF                                                   
               GO TO 1650-EXIT                                          
           ELSE                                                         
P00508         IF (E-FBW06-CODE-METER-NO-READ = '>'                     
P00508            OR E-FBW06-CODE-METER-NO-READ = '<'                   
P00508            OR E-FBW06-CODE-METER-NO-READ = '!')                  
P00508            MOVE E-FBW06-CODE-METER-NO-READ                       
P00508                                     TO                           
P00508                               WS-FBW06-NO-READ-CD(WS-FBW06-SUB)  
ACT301            MOVE WS-CATEGORY-ID-583  TO WS-CATEGORY-ID            
P00508            MOVE '4'                 TO WS-ROUTING-CATEGORY       
P00508            MOVE 'N'                 TO                           
P00508                               WS-FBW06-RD-VALID-FL(WS-FBW06-SUB) 
P00508            MOVE WS-VERIFIED-READ    TO                           
P00508                            WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
P00508            IF E-FBW06-CODE-METER-NO-READ = '!'                   
P00508               MOVE MSG-TOU-MDM-ESTIMATE TO WS-WQ-MESSAGE         
P00508               SET MDM-ESTIMATED-READ   TO TRUE                   
P00508            ELSE                                                  
P00508               MOVE MSG-SS-HILO-MDM     TO WS-WQ-MESSAGE          
P00508               SET MDM-HI-LO-EXCEPT     TO TRUE                   
P00508            END-IF                                                
P00508            PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT          
P00508            GO TO 1650-EXIT                                       
P00508         END-IF                                                   
           END-IF.                                                      
                                                                        
A04462     PERFORM 1655-NORMAL-READ THRU 1655-EXIT.                     
                                                                        
       1650-EXIT.                                                       
           EXIT.                                                        
A04462                                                                  
A04462 1655-NORMAL-READ.                                                
A04462                                                                  
A04462     MOVE '0'                    TO                               
A04462                        WS-FBW06-NO-READ-CD(WS-FBW06-SUB)         
A04462     MOVE WS-NORMAL-READ         TO                               
A04462                        WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)      
A04462     IF  WS-CRNT-USE = 0                                          
A04462         PERFORM 1660-CHK-FOR-ZERO-USE THRU 1660-EXIT             
A04462     END-IF.                                                      
A04462*                                                                         
A04462 1655-EXIT.                                                       
A04462     EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CHECK FOR ZERO USE AND CREATE A WQ USING CPD00140              *        
      ******************************************************************        
       1660-CHK-FOR-ZERO-USE.                                           
      *                                                                         
           IF  AT-CODE-ACCT-STAT NOT = WS-ACTIVE                        
                 OR MN-CODE-METER-STATUS = WS-INACTIVE                  
A04880           OR AT-REV-MTH-LST-NRML = 0                             
ACT301           OR WS-ZERO-USE-WQ > WS-NO-READ-DAYS                    
P00251           OR (J1-CMPNT-ID-CD = WS-CO-GEN-COMP-ID AND             
P00251               E-FBW06-CODE-USAGE-ID NOT = WS-CO-GENERATION)      
A04462           OR (E-FBW06-CODE-USAGE-ID = WS-STAND-BY-USAGE)         
               GO TO 1660-EXIT                                          
           END-IF.                                                      
           MOVE 'N'                        TO WS-DO-NOT-CALL-CPD140-FL. 
      *                                                                         
           MOVE WS-RUN-DATE                TO WS-140-RUN-DATE           
           MOVE AT-ACCOUNT-NO              TO WS-140-ACCOUNT-NO         
           MOVE E-FBW06-METER-NO           TO WS-140-METER-NO           
           MOVE UT-IC-NO                   TO WS-140-IC-NO              
           MOVE UT-CODE-UTIL-TYPE          TO WS-140-CODE-UTIL-TYPE.    
           MOVE E-FBW06-CODE-USAGE-TYPE    TO WS-140-CODE-USAGE-TYPE.   
           MOVE E-FBW06-DATE-READ          TO WS-140-MTR-READ-DATE.     
           MOVE WS-REVENUE-MONTH           TO WS-140-CURR-REVMTH.       
      *                                                                         
      *EXECUTE ZERO-USE WQ ROUTINE ONLY ONCE FOR EACH USAGE-TYPE                
           MOVE 1                          TO WS-SUB1                   
           PERFORM UNTIL WS-SUB1 > WS-FBW06-MAX-SUB                     
                      OR DO-NOT-CALL-CPD140                             
              MOVE WS-FBW06-READ-REC(WS-SUB1) TO FIOBW06                
              IF  E-FBW06-CODE-UTIL-TYPE = WS-140-CODE-UTIL-TYPE        
                    AND E-FBW06-METER-NO  = WS-140-METER-NO             
                    AND E-FBW06-CODE-USAGE-TYPE = WS-140-CODE-USAGE-TYPE
                    AND WS-FBW06-CALL-CPD140-FL (WS-SUB1) = 'Y'         
                  SET DO-NOT-CALL-CPD140   TO TRUE                      
              END-IF                                                    
              COMPUTE WS-SUB1 = WS-SUB1 + 1                             
           END-PERFORM.                                                 
      *                                                                         
           MOVE WS-FBW06-READ-REC (WS-FBW06-SUB) TO FIOBW06.            
           IF  DO-NOT-CALL-CPD140                                       
               GO TO 1660-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE 'Y'                        TO                           
                                WS-FBW06-CALL-CPD140-FL (WS-FBW06-SUB)  
           PERFORM 6400-PROCESS-ZERO-USE-WQ THRU 6400-CPD140-EXIT.      
      *                                                                         
       1660-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *   EVALUATE HIGH/LOW'S FOR EACH REGISTER                        *        
      ******************************************************************        
       1675-EVALUATE-HIGH-LOW.                                          
      *                                                                         
C30662     MOVE WS-FBW06-CRNT-USE (WS-FBW06-SUB)                        
C30662                                     TO WS-CRNT-USE.              
           MOVE WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB)                    
                                           TO WS-NO-READ-DAYS           
                                              WS-TOTAL-DAYS.            
      *GET NUMBER OF DAYS FROM SEASON CHANGE TIME                               
           IF  SEASON-CHANGE                                            
               MOVE ZEROS                  TO WS-NO-READ-DAYS           
               MOVE E-FBW06-DATE-READ      TO WS-CURR-READ-DATE         
               MOVE WS-SEASN-CHG-DATE      TO WS-PREV-READ-DATE         
               PERFORM 7330-GET-NO-DAYS THRU 7330-EXIT                  
               IF  E-FBW06-CODE-TOU-SEASN = WS-PREVIOUS                 
                   COMPUTE WS-NO-READ-DAYS                              
                          = WS-TOTAL-DAYS - WS-NO-READ-DAYS             
               END-IF                                                   
               IF  WS-NO-READ-DAYS EQUAL ZEROS                          
                   MOVE 1                  TO WS-NO-READ-DAYS           
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           EVALUATE E-FBW06-CODE-USAGE-TYPE                             
             WHEN WS-KWH                                                
A00795          IF CWS72-HI-KWH NOT = CWS72-HILO-MAX-LIMIT              
                   COMPUTE WS-HI-TOT-KWH ROUNDED =                      
A00795                      WS-NO-READ-DAYS * CWS72-HI-KWH              
                   COMPUTE WS-LO-TOT-KWH ROUNDED =                      
A00795                      WS-NO-READ-DAYS * CWS72-LO-KWH              
A00795             MOVE WS-HI-TOT-KWH     TO WS-WQ-HI-VAL               
A00795             MOVE WS-LO-TOT-KWH     TO WS-WQ-LO-VAL               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > WS-HI-TOT-KWH  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '4'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < WS-LO-TOT-KWH  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '1'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795          END-IF                                                  
             WHEN WS-CCF                                                
A00795          IF CWS72-HI-KWH NOT = CWS72-HILO-MAX-LIMIT              
                   COMPUTE WS-HI-TOT-KWH ROUNDED =                      
A00795                      WS-NO-READ-DAYS * CWS72-HI-KWH              
                   COMPUTE WS-LO-TOT-KWH ROUNDED =                      
A00795                      WS-NO-READ-DAYS * CWS72-LO-KWH              
A00795             MOVE WS-HI-TOT-KWH     TO WS-WQ-HI-VAL               
A00795             MOVE WS-LO-TOT-KWH     TO WS-WQ-LO-VAL               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > WS-HI-TOT-KWH  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '4'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < WS-LO-TOT-KWH  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '1'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795          END-IF                                                  
             WHEN WS-UNC                                                
A00795          IF CWS72-HI-UNC NOT = CWS72-HILO-MAX-LIMIT              
                   COMPUTE WS-HI-TOT-UNC ROUNDED =                      
A00795                   WS-NO-READ-DAYS * CWS72-HI-UNC                 
                   COMPUTE WS-LO-TOT-UNC ROUNDED =                      
A00795                   WS-NO-READ-DAYS * CWS72-LO-UNC                 
A00795             MOVE WS-HI-TOT-UNC     TO WS-WQ-HI-VAL               
A00795             MOVE WS-LO-TOT-UNC     TO WS-WQ-LO-VAL               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > WS-HI-TOT-UNC  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '4'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < WS-LO-TOT-UNC  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '1'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795          END-IF                                                  
A00795       WHEN WS-INT                                                
A00795          IF CWS72-HI-INT NOT = CWS72-HILO-MAX-LIMIT              
                   COMPUTE WS-HI-TOT-INT ROUNDED =                      
A00795                       WS-NO-READ-DAYS * CWS72-HI-INT             
                   COMPUTE WS-LO-TOT-INT ROUNDED =                      
A00795                       WS-NO-READ-DAYS * CWS72-LO-INT             
                   MOVE WS-HI-TOT-INT     TO WS-WQ-HI-VAL               
                   MOVE WS-LO-TOT-INT     TO WS-WQ-LO-VAL               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > WS-HI-TOT-INT  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '4'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795             IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < WS-LO-TOT-INT  
                      SET HILO-FAIL          TO TRUE                    
                      MOVE '1'               TO                         
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                   END-IF                                               
A00795          END-IF                                                  
A00795        WHEN WS-KW                                                
A00795           IF CWS72-HI-KW  NOT = CWS72-HILO-MAX-LIMIT             
A00795              MOVE CWS72-HI-KW           TO WS-WQ-HI-VAL          
A00795              MOVE CWS72-LO-KW           TO WS-WQ-LO-VAL          
A00795              IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > CWS72-HI-KW   
                       SET HILO-FAIL          TO TRUE                   
                       MOVE '4'               TO                        
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                    END-IF                                              
A00795              IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < CWS72-LO-KW   
                       SET HILO-FAIL          TO TRUE                   
                       MOVE '1'               TO                        
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                    END-IF                                              
A00795           END-IF                                                 
A00795        WHEN WS-KVA                                               
A00795           IF CWS72-HI-KVA NOT = CWS72-HILO-MAX-LIMIT             
A00795              MOVE CWS72-HI-KVA          TO WS-WQ-HI-VAL          
A00795              MOVE CWS72-LO-KVA          TO WS-WQ-LO-VAL          
A00795              IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) > CWS72-HI-KVA  
                       MOVE '4'               TO                        
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                       SET HILO-FAIL          TO TRUE                   
                    END-IF                                              
A00795              IF WS-FBW06-NO-UNITS (WS-FBW06-SUB) < CWS72-LO-KVA  
                       MOVE '1'               TO                        
                                WS-FBW06-NO-READ-CD (WS-FBW06-SUB)      
                       SET HILO-FAIL          TO TRUE                   
                    END-IF                                              
A00795           END-IF                                                 
           END-EVALUATE.                                                
      *                                                                         
       1675-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
P00508*===============================================================*         
P00508 1680-SET-HILO-CODES.                                             
P00508*===============================================================*         
A05744*** SET HIGH LOW EXCEPTION CODES TO DISPLAY IN CIS MOD METER POST         
P00508*                                                                         
ACT301     MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID                    
P00508     MOVE '4'                TO WS-ROUTING-CATEGORY               
P00508     MOVE WS-VERIFIED-READ   TO                                   
P00508                            WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
P00508*                                                                         
P00508     IF SMART-SYNCH-MTR                                           
ACT256        MOVE 'N'            TO WS-FBW06-RD-VALID-FL(WS-FBW06-SUB) 
P00508        SET CIS-HI-LO-EXCEPT    TO TRUE                           
P00508        EVALUATE TRUE                                             
P00508          WHEN E-FBW06-CODE-METER-NO-READ = '!'                   
P00508            MOVE E-FBW06-CODE-METER-NO-READ                       
P00508                            TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508            MOVE MSG-TOU-MDM-ESTIMATE TO WS-WQ-MESSAGE            
P00508            SET MDM-ESTIMATED-READ    TO TRUE                     
P00508          WHEN WS-FBW06-NO-READ-CD (WS-FBW06-SUB) = '4'           
P00508            EVALUATE TRUE                                         
P00508              WHEN E-FBW06-CODE-METER-NO-READ = '>'               
P00508                MOVE '*'    TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508                MOVE MSG-SS-HILO-CIS-MDM  TO WS-WQ-MESSAGE        
P00508                SET MDM-HI-LO-EXCEPT      TO TRUE                 
P00508              WHEN E-FBW06-CODE-METER-NO-READ = '<'               
P00508                MOVE '+'    TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508                MOVE MSG-SS-HILO-CIS-MDM  TO WS-WQ-MESSAGE        
P00508                SET MDM-HI-LO-EXCEPT      TO TRUE                 
P00508              WHEN OTHER                                          
P00508                MOVE MSG-SS-HILO-CIS      TO WS-WQ-MESSAGE        
P00508            END-EVALUATE                                          
P00508*                                                                         
P00508          WHEN WS-FBW06-NO-READ-CD (WS-FBW06-SUB) = '1'           
P00508            EVALUATE TRUE                                         
P00508              WHEN E-FBW06-CODE-METER-NO-READ = '>'               
P00508                MOVE '-'    TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508                MOVE MSG-SS-HILO-CIS-MDM  TO WS-WQ-MESSAGE        
P00508                SET MDM-HI-LO-EXCEPT      TO TRUE                 
P00508              WHEN E-FBW06-CODE-METER-NO-READ = '<'               
P00508                MOVE '?'    TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508                MOVE MSG-SS-HILO-CIS-MDM  TO WS-WQ-MESSAGE        
P00508                SET MDM-HI-LO-EXCEPT      TO TRUE                 
P00508              WHEN OTHER                                          
P00508                MOVE MSG-SS-HILO-CIS      TO WS-WQ-MESSAGE        
P00508            END-EVALUATE                                          
P00508        END-EVALUATE                                              
P00508     ELSE                                                         
ACT068        IF MN-CODE-DATA-PRESENT = SPACES                          
ACT151           AND NOT TOU-ALL                                        
ACT256           SET HILO-WARNING        TO TRUE                        
ACT256           MOVE WS-NORMAL-READ                                    
ACT256                     TO WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)      
ACT068        END-IF                                                    
P00508        IF WS-FBW06-NO-READ-CD (WS-FBW06-SUB) = '4'               
P00508           MOVE MSG-FAILED-HIGH TO WS-WQ-MESSAGE                  
P00508           IF E-FBW06-CODE-METER-NO-READ = '@'                    
P00508               MOVE WS-ERR-MSG-VERIFIED-HI TO WS-WQ-MESSAGE       
P00508           END-IF                                                 
P00508        END-IF                                                    
P00508        IF WS-FBW06-NO-READ-CD (WS-FBW06-SUB) = '1'               
P00508           MOVE MSG-FAILED-LOW TO WS-WQ-MESSAGE                   
P00508           IF E-FBW06-CODE-METER-NO-READ = '@'                    
P00508              MOVE WS-ERR-MSG-VERIFIED-LO TO WS-WQ-MESSAGE        
P00508           END-IF                                                 
P00508        END-IF                                                    
P00508        IF E-FBW06-CODE-METER-NO-READ > SPACES                    
P00508           MOVE E-FBW06-CODE-METER-NO-READ                        
P00508                            TO WS-FBW06-NO-READ-CD (WS-FBW06-SUB) 
P00508        END-IF                                                    
P00508     END-IF.                                                      
P00508*                                                                         
P00508     PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT.                
P00508*                                                                         
P00508 1680-EXIT.                                                       
P00508     EXIT.                                                        
P00508*                                                                         
      *****************************************************************         
      * DECIDE UNAUTHORIZED USE WQ CATEGORY                           *         
      *****************************************************************         
       1700-GET-WQ-CAT-INACT.                                           
      *                                                                         
           IF  WS-SECURED-RATE-FL = 'Y'                                 
               IF  AT-COMPANY-NO = '01'                                 
                   MOVE WS-CATEGORY-ID-282 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
               ELSE                                                     
                   IF  AT-COMPANY-NO = WS-PSNC                          
                       MOVE WS-CATEGORY-ID-283 TO WS-CATEGORY-ID        
                       MOVE '4'            TO WS-ROUTING-CATEGORY       
                   END-IF                                               
               END-IF                                                   
           ELSE                                                         
               IF  UT-CODE-REVENUE-CLASS(2:1) = '1'                     
                   MOVE WS-CATEGORY-ID-173 TO WS-CATEGORY-ID            
               ELSE                                                     
                   MOVE WS-CATEGORY-ID-284 TO WS-CATEGORY-ID            
               END-IF                                                   
               MOVE '1'                    TO WS-ROUTING-CATEGORY       
           END-IF.                                                      
      *                                                                         
       1700-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *  ELECTRIC COMBO READ VALIDATIONS                               *        
      ******************************************************************        
       1800-CHK-ELEC-COMBO-EDITS.                                       
      *                                                                         
      *CROSS-CHECK TOTAL KWH AND TOTAL OF ALL PEAKS                             
           MOVE 'C'                        TO WS-TOU-SEASN.             
P00251     MOVE 'B'                        TO WS-TEMP-READ-ITEM-STATUS. 
P00508     IF TOU-ALL                                                   
P00251         MOVE 'A'                    TO WS-TEMP-CODE-USAGE-ID     
               PERFORM 1810-CROSS-CHK-KWH THRU 1810-EXIT                
P00251         IF CO-GEN-REG-EXISTS                                     
P00251            MOVE WS-CO-GENERATION TO WS-TEMP-CODE-USAGE-ID        
P00251            PERFORM 1810-CROSS-CHK-KWH THRU 1810-EXIT             
P00251         END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  SEASON-CHANGE                                            
               MOVE MN-CODE-UTIL-TYPE      TO OA-CODE-UTIL-TYPE         
               MOVE MN-DIGTL-MTR-TYPE      TO OA-DIGTL-MTR-TYPE         
               MOVE MN-PROGRAM-ID          TO OA-PROGRAM-ID             
               MOVE MN-MTR-READ-SOURCE-CD  TO OA-MTR-READ-SOURCE-CD     
               MOVE MN-REMOTE-READ-IND     TO OA-REMOTE-READ-IND        
               MOVE WS-KWH                 TO OA-CODE-USAGE-TYPE        
               MOVE ZEROS                  TO OA-CODE-TIME-PERIOD       
               MOVE 'P'                    TO OA-CODE-TOU-SEASN         
                                              WS-TOU-SEASN              
P00251         MOVE 'A'                    TO OA-CODE-USAGE-ID          
P00251         MOVE WS-CO-GENERATION       TO WS-OA-CODE-USAGE-ID       
               PERFORM 7400-SELECT-MTR-RD-FMT THRU 7400-EXIT            
               IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL          
P00251             MOVE 'A'               TO WS-TEMP-CODE-USAGE-ID      
                   PERFORM 1810-CROSS-CHK-KWH THRU 1810-EXIT            
P00251             IF CO-GEN-REG-EXISTS                                 
P00251                MOVE WS-CO-GENERATION  TO WS-TEMP-CODE-USAGE-ID   
P00251                PERFORM 1810-CROSS-CHK-KWH THRU 1810-EXIT         
P00251             END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  NOT HILO-ON-PARM                                         
               GO TO 1800-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE SPACES                     TO WS-HILO-FAIL-IND.         
           MOVE UT-CODE-UTIL-TYPE          TO O9-CODE-UTIL-TYPE.        
           MOVE UT-RATE-PLAN-NO            TO O9-RATE-PLAN-NO.          
           PERFORM 7410-GET-FACTOR-HILO THRU 7410-EXIT.                 
           MOVE 'N'                        TO WS-DO-NOT-CALC-LF-FL.     
           MOVE ZEROS                      TO WS-TOTAL-KWH              
                                              WS-MAX-KW                 
                                              WS-LOAD-FACTOR            
           MOVE 1                          TO WS-FBW06-SUB.             
           PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
              MOVE WS-FBW06-READ-REC(WS-FBW06-SUB) TO FIOBW06           
              MOVE ZEROS                   TO WS-POWER-FACTOR           
              IF  E-FBW06-CODE-USAGE-TYPE = WS-KWH                      
                   AND E-FBW06-CODE-TIME-PERIOD = 0                     
P00251             AND E-FBW06-CODE-USAGE-ID NOT = WS-CO-GENERATION     
                  IF  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) = 'Y'         
                      MOVE WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB)         
                                           TO WS-NO-READ-DAYS           
                      COMPUTE WS-TOTAL-KWH ROUNDED                      
                          = WS-TOTAL-KWH                                
                                 + WS-FBW06-NO-UNITS (WS-FBW06-SUB)     
                  ELSE                                                  
                      SET DO-NOT-CALC-LF   TO TRUE                      
                  END-IF                                                
              END-IF                                                    
      *                                                                         
              IF  E-FBW06-CODE-USAGE-TYPE = WS-KW                       
                    AND WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) = 'Y'       
                    AND WS-FBW06-NO-UNITS (WS-FBW06-SUB) > 0            
P00251              AND E-FBW06-CODE-USAGE-ID NOT = WS-CO-GENERATION    
                  MOVE E-FBW06-CODE-TIME-PERIOD                         
                                           TO WS-SAVE-TP                
                  MOVE E-FBW06-CODE-TOU-SEASN                           
                                           TO WS-SAVE-SEASN             
P00251            MOVE E-FBW06-CODE-USAGE-ID                            
P00251                                     TO WS-SAVE-CODE-USAGE-ID     
                  MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                 
                                           TO WS-SAVE-KW                
                  IF  WS-SAVE-KW > WS-MAX-KW                            
                      MOVE WS-FBW06-SUB    TO WS-SAVE-SUB               
                      MOVE WS-SAVE-KW      TO WS-MAX-KW                 
                  END-IF                                                
                  PERFORM 1830-CALC-PWR-FACTOR THRU 1830-EXIT           
              END-IF                                                    
              COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
           END-PERFORM.                                                 
      *                                                                         
           IF  DO-NOT-CALC-LF OR WS-MAX-KW = 0                          
A00914         OR WS-TOTAL-KWH = 0  OR  WS-NO-READ-DAYS = 0             
               CONTINUE                                                 
           ELSE                                                         
               COMPUTE WS-LOAD-FACTOR ROUNDED = WS-TOTAL-KWH            
                                 / (WS-MAX-KW * 24 * WS-NO-READ-DAYS)   
           END-IF.                                                      
      *                                                                         
A04462     IF  E-FBW06-CODE-USAGE-ID = WS-STAND-BY-USAGE                
A04462         GO TO 1800-EXIT                                          
A04462     END-IF.                                                      
                                                                        
           IF  WS-LOAD-FACTOR > 0                                       
               IF  WS-LOAD-FACTOR > O9-MAX-LOAD-FACTOR                  
                   MOVE WS-SAVE-SUB        TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   MOVE MSG-LOAD-HIGH-CHECK-FAIL                        
                                           TO WS-WQ-MESSAGE             
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
P00508             SET CIS-HI-LO-EXCEPT    TO TRUE                      
                   MOVE '('                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
               IF  WS-LOAD-FACTOR < O9-MIN-LOAD-FACTOR                  
                   MOVE WS-SAVE-SUB        TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   MOVE MSG-LOAD-LOW-CHECK-FAIL TO WS-WQ-MESSAGE        
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
P00508             SET CIS-HI-LO-EXCEPT    TO TRUE                      
                   MOVE '('                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1800-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *  VALIDATE TOTAL KWH AND TOTAL OF ALL PEAKS                     *        
      ******************************************************************        
       1810-CROSS-CHK-KWH.                                              
      *                                                                         
P00251     SET CO-GEN-REG-NOT-EXISTS       TO TRUE.                     
           SET TOTAL-KWH-NOT-FOUND         TO TRUE.                     
           SET ON-OFF-KWH-NOT-FOUND        TO TRUE.                     
           MOVE 'N'                        TO WS-DO-NOT-COMPARE-FL.     
           MOVE ZEROS                      TO WS-TOTAL-KWH              
                                              WS-TOTAL-ACCUM-KWH        
                                              WS-SAVE-SUB.              
           MOVE 1                          TO WS-FBW06-SUB.             
           PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
P00251               OR DO-NOT-COMPARE                                  
              MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                      
                                           TO FIOBW06                   
              IF  E-FBW06-CODE-USAGE-TYPE = WS-KWH                      
                       AND E-FBW06-CODE-TOU-SEASN   = WS-TOU-SEASN      
                  IF  WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) = 'Y'         
P00251                IF E-FBW06-CODE-USAGE-ID  = WS-CO-GENERATION      
P00251                   SET CO-GEN-REG-EXISTS   TO TRUE                
P00251                END-IF                                            
P00251                IF E-FBW06-CODE-USAGE-ID = WS-TEMP-CODE-USAGE-ID  
                        IF  E-FBW06-CODE-TIME-PERIOD = 0                
                            MOVE WS-FBW06-SUB TO WS-SAVE-SUB            
                            SET TOTAL-KWH-FOUND TO TRUE                 
                            MOVE WS-FBW06-CRNT-USE (WS-FBW06-SUB)       
                                            TO WS-TOTAL-KWH             
                        ELSE                                            
P00251                      MOVE E-FBW06-READ-ITEM-STATUS               
P00251                                   TO WS-TEMP-READ-ITEM-STATUS    
                            COMPUTE WS-TOTAL-ACCUM-KWH ROUNDED          
                            = WS-TOTAL-ACCUM-KWH                        
                                   + WS-FBW06-CRNT-USE (WS-FBW06-SUB)   
                            SET ON-OFF-KWH-FOUND TO TRUE                
                        END-IF                                          
P00251                END-IF                                            
                  ELSE                                                  
                      SET DO-NOT-COMPARE   TO TRUE                      
P00251                SET CO-GEN-REG-NOT-EXISTS       TO TRUE           
                  END-IF                                                
              END-IF                                                    
              COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
           END-PERFORM.                                                 
      *                                                                         
           IF  DO-NOT-COMPARE OR ON-OFF-KWH-NOT-FOUND                   
               CONTINUE                                                 
           ELSE                                                         
               IF  TOTAL-KWH-NOT-FOUND                                  
                   PERFORM 1820-CREATE-ZERO-KWH-REC THRU 1820-EXIT      
               ELSE                                                     
                   COMPUTE WS-KWH-DIFF ROUNDED                          
                      = WS-TOTAL-KWH - WS-TOTAL-ACCUM-KWH               
                   IF  WS-KWH-DIFF < 0                                  
                       COMPUTE WS-KWH-DIFF = WS-KWH-DIFF * -1           
                   END-IF                                               
                   IF  WS-KWH-DIFF > 1                                  
                       MOVE WS-SAVE-SUB    TO WS-FBW06-SUB              
                       MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)             
                                           TO FIOBW06                   
ACT301                 MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID        
                       MOVE '4'            TO WS-ROUTING-CATEGORY       
                       MOVE WS-ERR-MSG-KWH TO WS-WQ-MESSAGE             
                       MOVE '%'            TO                           
                                   WS-FBW06-NO-READ-CD(WS-FBW06-SUB)    
                       MOVE 'N'            TO                           
                                    WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) 
                       MOVE WS-VERIFIED-READ TO                         
                                  WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB) 
                       PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT     
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1810-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CREATE A KWH USAGE RECORD USING THE TOU PEAK READINGS          *        
      ******************************************************************        
       1820-CREATE-ZERO-KWH-REC.                                        
      *                                                                         
           ADD 1                           TO WS-FBW06-MAX-SUB.         
           MOVE WS-FBW06-MAX-SUB           TO WS-FBW06-SUB.             
           MOVE MN-ACCOUNT-NO              TO E-FBW06-ACCOUNT-NO        
           MOVE MN-METER-NO                TO E-FBW06-METER-NO          
           MOVE MN-CODE-UTIL-TYPE          TO E-FBW06-CODE-UTIL-TYPE    
           MOVE WS-KWH                     TO E-FBW06-CODE-USAGE-TYPE   
                                              MN-CODE-USAGE-TYPE        
                                              RG-CODE-USAGE-TYPE.       
           MOVE 0                          TO E-FBW06-CODE-TIME-PERIOD  
                                              MN-CODE-TIME-PERIOD       
                                              RG-CODE-TIME-PERIOD.      
P00251     MOVE WS-TEMP-CODE-USAGE-ID      TO MN-CODE-USAGE-ID          
P00251                                        RG-CODE-USAGE-ID          
P00251                                        E-FBW06-CODE-USAGE-ID     
P00251     IF WS-TEMP-CODE-USAGE-ID = WS-CO-GENERATION                  
P00251        MOVE 'C'                     TO E-FBW06-CODE-USAGE-SOURCE 
P00251     ELSE                                                         
P00251        MOVE 'B'                     TO E-FBW06-CODE-USAGE-SOURCE 
P00251     END-IF.                                                      
P00251     MOVE 'KWH'                      TO E-FBW06-REG-MEASURE-CD    
P00251     MOVE WS-TEMP-READ-ITEM-STATUS   TO E-FBW06-READ-ITEM-STATUS  
           MOVE 'N'                        TO WS-READ-SKIP-FL.          
           PERFORM 1620-CHECK-FOR-REGISTER THRU 1620-EXIT               
      *                                                                         
           IF  READ-SKIP                                                
               GO TO 1820-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE WS-TOU-SEASN               TO E-FBW06-CODE-TOU-SEASN    
           MOVE '0'                        TO                           
                          WS-FBW06-NO-READ-CD (WS-FBW06-SUB).           
           MOVE WS-NORMAL-READ             TO                           
                                 WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)   
           MOVE 'Y'                        TO                           
                          WS-FBW06-RD-VALID-FL (WS-FBW06-SUB).          
           MOVE WS-TOTAL-ACCUM-KWH         TO                           
                                 WS-FBW06-CRNT-USE (WS-FBW06-SUB)       
                                            WS-CRNT-USE.                
A02367     MOVE WS-FBW06-REG-ID-NO(WS-FBW06-SUB)                        
A02367                                     TO MC-REG-ID-NO.             
A02367     MOVE ZEROS                      TO MC-FULL-SCALE.            
           PERFORM 7320-SELECT-MTR-CAP      THRU 7320-EXIT.             
      *                                                                         
           COMPUTE WS-FBW06-NO-UNITS (WS-FBW06-SUB) ROUNDED             
                  = WS-FBW06-CRNT-USE (WS-FBW06-SUB) * MC-CONSTANT.     
      *                                                                         
           COMPUTE E-FBW06-METER-READING ROUNDED                        
               = WS-FBW06-PREV-READING (WS-FBW06-SUB)                   
                                + WS-FBW06-CRNT-USE (WS-FBW06-SUB)      
           COMPUTE WS-MAX-DIGITS = (10 ** MC-NO-READ-DIALS - 1)         
           IF  E-FBW06-METER-READING > WS-MAX-DIGITS                    
               COMPUTE E-FBW06-METER-READING =                          
                           E-FBW06-METER-READING - (WS-MAX-DIGITS + 1)  
           END-IF.                                                      
      *                                                                         
           MOVE WS-REGULAR-READ            TO E-FBW06-CODE-METER-READ   
           MOVE SPACES                     TO E-FBW06-CODE-METER-NO-READ
                                              E-FBW06-MTR-COMMENT-TX    
                                              E-FBW06-MTR-COND-CD1      
                                              E-FBW06-MTR-COND-CD2      
           MOVE MN-MTR-READ-SOURCE-CD      TO E-FBW06-MTR-READ-SOURCE-CD
           MOVE WS-YES                     TO E-FBW06-CNSMPTN-READ-FL   
           MOVE WS-INDEX                   TO E-FBW06-INDEX-VALUE-CD    
           MOVE MC-CONSTANT                TO                           
                                     WS-FBW06-CONSTANT (WS-FBW06-SUB)   
           MOVE MC-NO-READ-DIALS           TO                           
                                   WS-FBW06-RD-DIALS (WS-FBW06-SUB).    
      *                                                                         
           MOVE ZEROS                      TO WS-NO-READ-DAYS.          
           MOVE E-FBW06-DATE-READ          TO WS-CURR-READ-DATE.        
           PERFORM 7330-GET-NO-DAYS THRU 7330-EXIT.                     
           IF  WS-NO-READ-DAYS EQUAL ZEROS                              
               MOVE 1                      TO WS-NO-READ-DAYS           
           END-IF.                                                      
           MOVE WS-NO-READ-DAYS            TO                           
                                  WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB). 
      *                                                                         
           MOVE FIOBW06                    TO                           
                                      WS-FBW06-READ-REC (WS-FBW06-SUB). 
      *                                                                         
           IF  HILO-ON-PARM                                             
               PERFORM 1650-EXECUTE-HI-LO-CHK THRU 1650-EXIT            
           END-IF.                                                      
      *                                                                         
       1820-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CALCULATE LOAD FACTOR AND POWER FACTOR                         *        
      ******************************************************************        
       1830-CALC-PWR-FACTOR.                                            
           MOVE 1                          TO WS-SUB1                   
           PERFORM UNTIL WS-SUB1    > WS-FBW06-MAX-SUB                  
              MOVE WS-FBW06-READ-REC(WS-SUB1) TO FIOBW06                
              IF  E-FBW06-CODE-USAGE-TYPE = WS-KVA                      
                   AND WS-FBW06-RD-VALID-FL (WS-SUB1) = 'Y'             
                   AND E-FBW06-CODE-TIME-PERIOD = WS-SAVE-TP            
                   AND E-FBW06-CODE-TOU-SEASN = WS-SAVE-SEASN           
P00251             AND E-FBW06-CODE-USAGE-ID  = WS-SAVE-CODE-USAGE-ID   
                   AND WS-FBW06-NO-UNITS (WS-SUB1) > 0                  
                  MOVE WS-SUB1             TO WS-SAVE-SUB               
                  MOVE WS-FBW06-NO-UNITS (WS-SUB1)                      
                                           TO WS-SAVE-KVA               
                  COMPUTE WS-POWER-FACTOR ROUNDED                       
                   = WS-SAVE-KW / WS-SAVE-KVA                           
              END-IF                                                    
              ADD 1                        TO WS-SUB1                   
           END-PERFORM.                                                 
      *                                                                         
A04462     IF  E-FBW06-CODE-USAGE-ID = WS-STAND-BY-USAGE                
A04462         GO TO 1830-EXIT                                          
A04462     END-IF.                                                      
                                                                        
           IF  WS-POWER-FACTOR > 0                                      
               IF  WS-POWER-FACTOR > O9-MAX-POWER-FACTOR                
                   MOVE WS-SAVE-SUB        TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   MOVE MSG-POWER-HIGH-CHECK-FAIL TO WS-WQ-MESSAGE      
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
P00508             SET CIS-HI-LO-EXCEPT    TO TRUE                      
                   MOVE ')'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
               IF  WS-POWER-FACTOR < O9-MIN-POWER-FACTOR                
                   MOVE WS-SAVE-SUB        TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   MOVE MSG-POWER-LOW-CHECK-FAIL TO WS-WQ-MESSAGE       
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
P00508             SET CIS-HI-LO-EXCEPT    TO TRUE                      
                   MOVE ')'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1830-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * GAS COMBO VALIDATIONS                                          *        
      ******************************************************************        
       1900-CHK-GAS-COMBO-EDITS.                                        
      *                                                                         
           IF  NOT HILO-ON-PARM                                         
               GO TO 1900-EXIT                                          
           END-IF.                                                      
      *                                                                         
           MOVE ZEROS                      TO WS-UNC-RATIO              
                                              WS-INT-RATIO.             
           MOVE 1                          TO WS-FBW06-SUB.             
           PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
              MOVE WS-FBW06-READ-REC(WS-FBW06-SUB) TO FIOBW06           
              IF  E-FBW06-CODE-USAGE-TYPE = WS-CCF                      
                   AND WS-FBW06-RD-VALID-FL (WS-FBW06-SUB) = 'Y'        
                   AND WS-FBW06-NO-UNITS (WS-FBW06-SUB) > 0             
P00251             AND E-FBW06-CODE-USAGE-ID NOT = WS-CO-GENERATION     
                  MOVE E-FBW06-CODE-TIME-PERIOD TO WS-SAVE-TP           
                  MOVE E-FBW06-CODE-TOU-SEASN   TO WS-SAVE-SEASN        
P00251            MOVE E-FBW06-CODE-USAGE-ID    TO WS-SAVE-CODE-USAGE-ID
                  MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                 
                                           TO WS-SAVE-COR               
                  PERFORM 1910-CALC-RATIO THRU 1910-EXIT                
              END-IF                                                    
              COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
           END-PERFORM.                                                 
      *                                                                         
           IF  WS-UNC-RATIO > 0                                         
A00795         IF  WS-UNC-RATIO < CWS72-LO-UNC-RATIO                    
                   MOVE WS-UNC-SUB         TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
                   MOVE MSG-FAILED-LO-UNC-RATIO                         
                                           TO WS-WQ-MESSAGE             
                   MOVE '2'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
A00795         IF  WS-UNC-RATIO > CWS72-HI-UNC-RATIO                    
                   MOVE WS-UNC-SUB         TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
                   MOVE MSG-FAILED-HI-UNC-RATIO                         
                                           TO WS-WQ-MESSAGE             
                   MOVE '2'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  WS-INT-RATIO > 0                                         
               IF  WS-INT-RATIO < CWS72-LO-INT-RATIO                    
                   MOVE WS-INT-SUB         TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   MOVE MSG-FAILED-LO-INT-RATIO                         
                                           TO WS-WQ-MESSAGE             
                   MOVE '3'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
               IF  WS-INT-RATIO > CWS72-HI-INT-RATIO                    
                   MOVE WS-INT-SUB         TO WS-FBW06-SUB              
                   MOVE WS-FBW06-READ-REC(WS-FBW06-SUB)                 
                                           TO FIOBW06                   
                   ADD 1                   TO WS-HIGH-LOW-FAIL          
ACT301             MOVE WS-CATEGORY-ID-583 TO WS-CATEGORY-ID            
                   MOVE '4'                TO WS-ROUTING-CATEGORY       
                   MOVE MSG-FAILED-HI-INT-RATIO                         
                                           TO WS-WQ-MESSAGE             
                   MOVE '3'                TO                           
                               WS-FBW06-NO-READ-CD (WS-FBW06-SUB)       
                   MOVE 'N'                TO                           
                                WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)      
                   MOVE WS-VERIFIED-READ   TO                           
                                  WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)  
                   PERFORM 2400-LOAD-WQ-FREEFORM THRU 2400-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1900-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CALCULATE UNC AND INT RATIOS                                   *        
      ******************************************************************        
       1910-CALC-RATIO.                                                 
      *                                                                         
           MOVE 1                          TO WS-SUB1.                  
           PERFORM UNTIL WS-SUB1    > WS-FBW06-MAX-SUB                  
              MOVE WS-FBW06-READ-REC(WS-SUB1) TO FIOBW06                
              IF  WS-FBW06-RD-VALID-FL (WS-SUB1) = 'Y'                  
                   AND E-FBW06-CODE-TIME-PERIOD = WS-SAVE-TP            
                   AND E-FBW06-CODE-TOU-SEASN = WS-SAVE-SEASN           
P00251             AND E-FBW06-CODE-USAGE-ID  = WS-SAVE-CODE-USAGE-ID   
                   AND WS-FBW06-NO-UNITS (WS-SUB1) > 0                  
                   IF  E-FBW06-CODE-USAGE-TYPE = WS-UNC                 
                       MOVE WS-SUB1        TO WS-UNC-SUB                
                       MOVE WS-FBW06-NO-UNITS (WS-SUB1)                 
                                           TO WS-SAVE-UNC               
                       COMPUTE WS-UNC-RATIO ROUNDED                     
                            = WS-SAVE-COR / WS-SAVE-UNC                 
                   ELSE                                                 
                       IF  E-FBW06-CODE-USAGE-TYPE = WS-INT             
                           MOVE WS-SUB1    TO WS-INT-SUB                
                           MOVE WS-FBW06-NO-UNITS (WS-SUB1)             
                                           TO WS-SAVE-INT               
                            COMPUTE WS-INT-RATIO ROUNDED                
                            = WS-SAVE-COR / WS-SAVE-INT                 
                       END-IF                                           
                   END-IF                                               
              END-IF                                                    
              COMPUTE WS-SUB1 = WS-SUB1 + 1                             
           END-PERFORM.                                                 
      *                                                                         
       1910-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C31697*****************************************************************         
C31697* ROUTINE TO PERFROM NON HI/LO VALIDATIONS                      *         
C31697*****************************************************************         
C31697 1950-NON-HI-LO-GAS-VLDT.                                         
C31697     MOVE ZEROS                      TO WS-SAVE-UNC               
C31697                                        WS-SAVE-UCG.              
C31697     MOVE 1                          TO WS-FBW06-SUB.             
C31697     PERFORM UNTIL WS-FBW06-SUB > WS-FBW06-MAX-SUB                
C31697        MOVE WS-FBW06-READ-REC(WS-FBW06-SUB) TO FIOBW06           
C31697        IF  E-FBW06-CODE-USAGE-TYPE = WS-UCG AND                  
C31697              WS-FBW06-RD-VALID-FL(WS-FBW06-SUB) NOT = 'N'        
C31697            MOVE E-FBW06-CODE-TIME-PERIOD TO WS-SAVE-TP           
C31697            MOVE E-FBW06-CODE-TOU-SEASN   TO WS-SAVE-SEASN        
P00251            MOVE E-FBW06-CODE-USAGE-ID    TO WS-SAVE-CODE-USAGE-ID
C31697            MOVE E-FBW06-METER-READING                            
C31697                                     TO WS-SAVE-UCG               
C31697            MOVE WS-FBW06-SUB        TO WS-SAVE-SUB               
C31697            PERFORM 1951-COMPARE-UCG-UNC THRU 1951-EXIT           
C31697        END-IF                                                    
C31697        COMPUTE WS-FBW06-SUB = WS-FBW06-SUB + 1                   
C31697     END-PERFORM.                                                 
C31697*                                                                         
C31697 1950-EXIT.                                                       
C31697     EXIT.                                                        
C31697*                                                                         
C31697*****************************************************************         
C31697* VALIDATE UCG AGAINST UNC TO MAKE SURE THEY ARE IN SYNC        *         
C31697*****************************************************************         
C31697 1951-COMPARE-UCG-UNC.                                            
C31697     SET UNC-READ-NOT-FOUND          TO TRUE                      
C31697     MOVE 1                          TO WS-SUB1                   
C31697     PERFORM UNTIL WS-SUB1 > WS-FBW06-MAX-SUB OR UNC-READ-FOUND   
C31697        MOVE WS-FBW06-READ-REC(WS-SUB1) TO FIOBW06                
C31697        IF  E-FBW06-CODE-USAGE-TYPE = WS-UNC                      
C31697             AND WS-FBW06-RD-VALID-FL (WS-SUB1) = 'Y'             
C31697             AND E-FBW06-CODE-TIME-PERIOD = WS-SAVE-TP            
C31697             AND E-FBW06-CODE-TOU-SEASN = WS-SAVE-SEASN           
P00251             AND E-FBW06-CODE-USAGE-ID  = WS-SAVE-CODE-USAGE-ID   
C31697            MOVE E-FBW06-METER-READING                            
C31697                                     TO WS-SAVE-UNC               
C31697                                        WS-WQ-UNC                 
C31697            SET UNC-READ-FOUND       TO TRUE                      
C31697        END-IF                                                    
C31697        ADD 1                        TO WS-SUB1                   
C31697     END-PERFORM.                                                 
C31697*                                                                         
C31697     IF  UNC-READ-NOT-FOUND                                       
C31697         GO TO 1951-EXIT                                          
C31697     END-IF.                                                      
C31697*                                                                         
C31697     MOVE WS-SAVE-SUB                TO WS-FBW06-SUB              
C31697     MOVE WS-FBW06-READ-REC(WS-FBW06-SUB) TO FIOBW06              
C31697     COMPUTE WS-UCG-DIFF ROUNDED                                  
C31697                        = WS-SAVE-UNC - WS-SAVE-UCG               
C31697     IF  WS-UCG-DIFF < 0                                          
C31697         COMPUTE WS-UCG-DIFF = WS-UCG-DIFF * -1                   
C31697     END-IF.                                                      
C31697     IF  WS-UCG-DIFF > 2                                          
C31697         IF  WS-SAVE-UNC > WS-SAVE-UCG                            
C31697             MOVE 'B'            TO MC-CODE-CAP-TYPE              
C31697             MOVE WS-SAVE-UCG    TO WS-UCG-ROLLOVER               
C31697         ELSE                                                     
C31697             MOVE 'U'            TO MC-CODE-CAP-TYPE              
C31697             MOVE WS-SAVE-UNC    TO WS-UCG-ROLLOVER               
C31697         END-IF                                                   
C31697         MOVE ZEROS              TO MC-NO-READ-DIALS              
C31697         PERFORM 7325-GET-MTR-CONSTANT THRU 7325-EXIT             
C31697         COMPUTE WS-METER-READ-NUM ROUNDED =                      
C31697              WS-UCG-ROLLOVER + 10 ** MC-NO-READ-DIALS            
C31697         IF  WS-SAVE-UNC > WS-SAVE-UCG                            
C31697             MOVE WS-METER-READ-NUM TO WS-SAVE-UCG                
C31697         ELSE                                                     
C31697             MOVE WS-METER-READ-NUM TO WS-SAVE-UNC                
C31697         END-IF                                                   
C31697         COMPUTE WS-UCG-DIFF ROUNDED                              
C31697                = WS-SAVE-UNC - WS-SAVE-UCG                       
C31697         IF  WS-UCG-DIFF < 0                                      
C31697             COMPUTE WS-UCG-DIFF = WS-UCG-DIFF * -1               
C31697         END-IF                                                   
C31697         IF  WS-UCG-DIFF > 2                                      
C31697             MOVE MSG-UCG-ERROR          TO WS-WQ-MESSAGE         
C31697             SET WS-METER-WARNING        TO TRUE                  
C31697             MOVE 'N'                    TO                       
C31697                        WS-FBW06-RD-VALID-FL(WS-FBW06-SUB)        
C31697             MOVE WS-VERIFIED-READ   TO                           
C31697                    WS-FBW06-MN-RG-READ-CD(WS-FBW06-SUB)          
A03352             IF AT-COMPANY-NO = '01'                              
A03352                MOVE WS-CATEGORY-ID-528  TO WS-CATEGORY-ID        
A03352                MOVE '4'                 TO WS-ROUTING-CATEGORY   
A03352             ELSE                                                 
A03352                MOVE WS-CATEGORY-ID-529  TO WS-CATEGORY-ID        
A03352                MOVE '1'                 TO WS-ROUTING-CATEGORY   
A03352             END-IF                                               
C31697             MOVE ZEROS TO WS-CRNT-USE                            
C31697             PERFORM 2500-CREATE-WQ THRU 2500-EXIT                
C31697         END-IF                                                   
C31697     END-IF.                                                      
C31697*                                                                         
C31697 1951-EXIT.                                                       
C31697     EXIT.                                                        
C31697*                                                                         
      ******************************************************************        
      * INSERT A RECORD INTO ROUTE REPORT TABLE FOR EVERY METER READ   *        
      * ON EACH ROUTE.                                                 *        
      ******************************************************************        
       2000-PROCESS-ROUTE-RPT.                                          
      *                                                                         
      **** READ CODE AND CONDITION CODE                                         
           MOVE E-FBW06-CODE-METER-READ    TO PW-READING-CODE.          
           MOVE E-FBW06-CODE-METER-NO-READ TO PW-READING-COND-CD.       
C36317***  READS WITH INVALID DATE POSTED TO ROUTE REPORT ONLY                  
C36317***  WITH READING-COND-CD AS 'J'. SOME TIMES REPROCESSING NEEDED          
C36317***  TO POST CORRECTED READS WITHOUT GENERATING DUPLICATE READ WQ         
C36317     IF WS-INVALID-READ-DATE AND PW-READING-COND-CD = SPACES      
C36317        MOVE 'J'                     TO PW-READING-COND-CD        
C36317     END-IF                                                       
      *                                                                         
           IF  ACCOUNT-SKIP OR METER-SKIP                               
PRJ914         OR MTR-CHNG-OFF-CYC-READ OR CC-CHNG-OFF-CYC-READ         
PRJ914         IF ACCOUNT-SKIP OR METER-SKIP                            
PRJ914            MOVE ZEROS               TO UT-READ-ROUTE             
PRJ914            MOVE SPACES              TO UT-READ-CYCLE             
PRJ914            MOVE +1                  TO PW-IC-NO                  
PRJ914                                        PW-CONSTANT               
PRJ914                                        MN-MTR-REF-NO             
PRJ914         END-IF                                                   
               IF  ACCOUNT-SKIP                                         
                   MOVE SPACES             TO AT-LOCAL-OFFICE           
                                              AT-BILL-CYCLE             
                   MOVE WS-CURR-REV-MONTH  TO RW-REVENUE-MONTH          
               END-IF                                                   
P00251         MOVE E-FBW06-CODE-USAGE-SOURCE  TO PW-CODE-USAGE-SOURCE  
PRJ914         IF MTR-CHNG-OFF-CYC-READ OR CC-CHNG-OFF-CYC-READ         
PRJ914            MOVE MN-IC-NO               TO PW-IC-NO               
PRJ914            MOVE ZEROS                  TO PW-CONSTANT            
PRJ914         END-IF                                                   
               MOVE ZEROS                  TO PW-PREV-METER-READING     
               MOVE E-FBW06-MTR-READ-SOURCE-CD                          
                                           TO MN-MTR-READ-SOURCE-CD     
           ELSE                                                         
               MOVE MN-IC-NO               TO PW-IC-NO                  
               MOVE WS-FBW06-CONSTANT (WS-FBW06-SUB)                    
                                           TO PW-CONSTANT               
               MOVE WS-FBW06-PREV-READING(WS-FBW06-SUB)                 
                                           TO PW-PREV-METER-READING     
P00251         MOVE WS-FBW06-CODE-USAGE-SOURCE (WS-FBW06-SUB)           
P00251                                     TO PW-CODE-USAGE-SOURCE      
               IF  WS-FBW06-NO-READ-CD (WS-FBW06-SUB) NOT EQUAL '0'     
                     AND WS-FBW06-NO-READ-CD (WS-FBW06-SUB) > SPACES    
                   MOVE WS-FBW06-NO-READ-CD (WS-FBW06-SUB)              
                                           TO PW-READING-COND-CD        
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           MOVE RW-REVENUE-MONTH           TO PW-REVENUE-MONTH.         
           MOVE E-FBW06-READ-ITEM-STATUS   TO WS-READ-ITEM-STATUS       
P00251                                        PW-READ-STATUS-CD.        
P00251     MOVE E-FBW06-CODE-USAGE-TYPE    TO PW-CODE-USAGE-TYPE.       
P00251     MOVE E-FBW06-CODE-USAGE-ID      TO PW-CODE-USAGE-ID.         
P00251     MOVE E-FBW06-INDEX-VALUE-CD     TO PW-INDEX-VALUE-CD.        
P00251     MOVE E-FBW06-CNSMPTN-READ-FL    TO PW-CNSMPTN-READ-FL.       
P00251     MOVE E-FBW06-READ-PROCESS-CD    TO PW-READ-PROCESS-CD.       
           MOVE E-FBW06-CODE-UTIL-TYPE     TO PW-CODE-UTIL-TYPE.        
           MOVE E-FBW06-CODE-TIME-PERIOD   TO PW-CODE-TIME-PERIOD.      
           MOVE E-FBW06-CODE-TOU-SEASN     TO PW-CODE-TOU-SEASN.        
           MOVE E-FBW06-METER-NO           TO PW-METER-NO.              
           MOVE AT-COMPANY-NO              TO PW-COMPANY-NO.            
           MOVE SPACES                     TO PW-CODE-MAKE              
           MOVE AT-ACCOUNT-NO              TO PW-ACCOUNT-NO             
           MOVE AT-LOCAL-OFFICE            TO PW-LOCAL-OFFICE           
           MOVE E-FBW06-DATE-READ          TO PW-LAST-REG-READ-DT       
           MOVE E-FBW06-TIME-READ          TO PW-LAST-REG-READ-TM       
           MOVE MN-MTR-REF-NO              TO PW-MTR-REF-NO             
A01738     MOVE E-FBW06-EMPLOYEE-NO        TO PW-METER-READER-ID        
C36317     IF  MIDMONTH-READ-ALL                                        
               MOVE '90'                   TO PW-READ-CYCLE             
           ELSE                                                         
               MOVE UT-READ-CYCLE          TO PW-READ-CYCLE             
           END-IF.                                                      
           MOVE AT-BILL-CYCLE              TO PW-BILL-CYCLE             
           MOVE UT-READ-ROUTE              TO PW-READ-ROUTE             
           MOVE E-FBW06-REG-MEASURE-CD     TO PW-REG-MEASURE-CD         
           MOVE MN-REGISTER-RD-SEQ         TO PW-REGISTER-RD-SEQ        
      *IF READ IS ON A PENDING-OFF ORDER ACCT, SET THE TYPE TO 'P'              
C35066     MOVE SPACES                     TO PW-TYPE-OF-RD-IND         
C35066*                                                                         
C35066     EVALUATE TRUE                                                
C36317***  CHANGE THE PROCESS ORDER TO S->H->P INSTEAD OF P->H->S               
C35066        WHEN WS-SUPERVISOR-EST-READ                               
C35066             MOVE 'S'                TO PW-TYPE-OF-RD-IND         
C35066        WHEN WS-FIELD-HI-LO-EXCEPT                                
C35066             MOVE 'H'                TO PW-TYPE-OF-RD-IND         
C35066        WHEN PEND-OFF-WQ-CREATED                                  
C35066             MOVE 'P'                TO PW-TYPE-OF-RD-IND         
C35066        WHEN OFF-CYCLE-READ                                       
C35066             MOVE 'O'                TO PW-TYPE-OF-RD-IND         
C35066        WHEN OTHER                                                
C35066             MOVE SPACES             TO PW-TYPE-OF-RD-IND         
C35066     END-EVALUATE                                                 
C35066*                                                                         
           MOVE E-FBW06-METER-READING      TO PW-METER-READING          
           MOVE MN-MTR-READ-SOURCE-CD      TO PW-MTR-READ-SOURCE-CD     
      *                                                                         
           IF  (PW-LAST-REG-READ-DT = SPACES OR LOW-VALUES)             
                 OR (PW-LAST-REG-READ-TM = SPACES OR LOW-VALUES)        
C35066         GO TO 2000-EXIT                                          
C35066     END-IF.                                                      
C35066*                                                                         
C35066     PERFORM 7240-OPEN-ROUTE-REPORT  THRU 7240-EXIT.              
C35066     PERFORM 7250-FETCH-ROUTE-REPORT THRU 7250-EXIT.              
C35066*                                                                         
C35066     SET WS-ROUTE-REPT-NOT-LOADED TO TRUE.                        
C35066*                                                                         
C35066     PERFORM 2900-CHECK-ROUTE-REPORT THRU 2900-EXIT               
C35066             UNTIL WS-ACTIVE-RETURN-CODE = NOT-FOUND.             
C35066*                                                                         
C35066     PERFORM 7260-CLOSE-ROUTE-REPORT THRU 7260-EXIT.              
C35066*                                                                         
C35066     IF WS-ROUTE-REPT-NOT-LOADED                                  
C35066        PERFORM 8200-INSERT-ROUTE-REPORT THRU 8200-EXIT           
C35066        IF  WS-ACTIVE-RETURN-CODE = ALREADY-EXISTS                
C35066            PERFORM 8250-UPDATE-ROUTE-REPORT                      
C35066               THRU 8250-EXIT                                     
C35066        END-IF                                                    
C35066     END-IF.                                                      
      *                                                                         
       2000-EXIT.                                                       
           EXIT.                                                        
      ******************************************************************        
      * MODULE TO PROCESS IRREGULAR METER READ COMMENTS/CODES          *        
      ******************************************************************        
       2100-PROCESS-MTR-RDR-COMMENTS.                                   
           MOVE MN-ACCOUNT-NO              TO IM-ACCOUNT-NO.            
           MOVE MN-CODE-UTIL-TYPE          TO IM-CODE-UTIL-TYPE.        
           MOVE MN-IC-NO                   TO IM-IC-NO.                 
           MOVE MN-MTR-REF-NO              TO IM-METER-REF-NO.          
A01738     MOVE E-FBW06-EMPLOYEE-NO        TO IM-METER-READER-ID.       
           MOVE E-FBW06-DATE-READ          TO IM-METER-READ-DT.         
           MOVE E-FBW06-TIME-READ          TO IM-METER-READ-TM.         
           MOVE E-FBW06-MTR-COMMENT-TX     TO IM-MTR-RD-COMMENTS.       
           MOVE E-FBW06-MTR-COND-CD1       TO IM-IRRGLR-MTR-CD-1.       
           MOVE E-FBW06-MTR-COND-CD2       TO IM-IRRGLR-MTR-CD-2.       
           IF  IM-IRRGLR-MTR-CD-1 = WS-TAMPER                           
                OR IM-IRRGLR-MTR-CD-2 = WS-TAMPER                       
               MOVE WS-YES                 TO MN-CODE-DIVERSION         
           END-IF.                                                      
           PERFORM 8100-INSERT-IRRGLR-MTR-RD   THRU 8100-EXIT.          
      *                                                                         
           PERFORM UNTIL WS-ACTIVE-RETURN-CODE NOT EQUAL ALREADY-EXISTS 
               PERFORM 7335-ADD-ONE-SEC THRU 7335-EXIT                  
               PERFORM 8100-INSERT-IRRGLR-MTR-RD THRU 8100-EXIT         
           END-PERFORM.                                                 
      *                                                                         
       2100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * MODULE TO UPDATE MN/RG READ CODES, WHEN READINGS FAIL CHECKS   *        
      ******************************************************************        
       2150-UPDATE-READ-CODE.                                           
      *                                                                         
           MOVE WS-FBW06-MN-RG-CD (WS-FBW06-SUB)                        
                                           TO WS-TYPE-PROCESS.          
           IF  WS-MN-PROCESS                                            
               MOVE WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB)               
                                           TO MN-CODE-CRNT-REG-READ     
               PERFORM 8300-UPDATE-MTRD-ENVRNMT THRU 8300-EXIT          
           END-IF.                                                      
      *                                                                         
           IF  WS-RG-PROCESS                                            
               MOVE WS-FBW06-REG-ID-NO (WS-FBW06-SUB)                   
                                           TO RG-REG-ID-NO              
               MOVE E-FBW06-CODE-TIME-PERIOD                            
                                           TO RG-CODE-TIME-PERIOD       
               MOVE WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB)               
                                           TO RG-CODE-CRNT-REG-READ     
               PERFORM 8360-UPDATE-RG-READ-CD THRU 8360-EXIT            
           END-IF.                                                      
      *                                                                         
           IF  AT-CODE-ACCT-STAT NOT = WS-ACTIVE                        
                 OR (AT-CODE-ACCT-BILLED EQUAL WS-HOLD-NO-READING       
                                      OR WS-AWAITING-CHECK-READ)        
               CONTINUE                                                 
           ELSE                                                         
               MOVE WS-AWAITING-CHECK-READ TO AT-CODE-ACCT-BILLED       
               PERFORM 8560-UPDATE-ACCOUNT THRU 8560-EXIT               
           END-IF.                                                      
      *                                                                         
       2150-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * MODULE TO UPDATE MN/RG AND INSERT READING DATA IN CX           *        
      ******************************************************************        
       2200-PROCESS-UPDATES.                                            
      *                                                                         
           MOVE 'N'                        TO WS-INACT-MTR-0-USE-FL.    
           IF  WS-FBW06-CRNT-USE (WS-FBW06-SUB) = 0                     
                 AND (MN-CODE-METER-STATUS = WS-INACTIVE                
                  OR MN-CODE-METER-STATUS = WS-REMOVED                  
                  OR AT-CODE-ACCT-STAT NOT = WS-ACTIVE)                 
               SET INACT-MTR-0-USE         TO TRUE                      
           END-IF.                                                      
      *                                                                         
           MOVE WS-FBW06-MN-RG-CD (WS-FBW06-SUB)                        
                                           TO WS-TYPE-PROCESS.          
           IF  WS-MN-PROCESS AND E-FBW06-CODE-TOU-SEASN = WS-CURRENT    
               PERFORM 2210-PROCESS-MN-UPDATES THRU 2210-EXIT           
           END-IF.                                                      
      *                                                                         
           IF  WS-RG-PROCESS AND E-FBW06-CODE-TOU-SEASN = WS-CURRENT    
               PERFORM 2220-PROCESS-RG-UPDATES THRU 2220-EXIT           
           END-IF.                                                      
      *                                                                         
           IF  INACT-MTR-0-USE                                          
               CONTINUE                                                 
           ELSE                                                         
               PERFORM 2300-PROCESS-CX-INSERT THRU 2300-EXIT            
C33023*** INSERT AGL FACTOR FOR EVERY READ                                      
C33023         IF SEB-DATABASE AND WS-AGL-FF-FACTOR > 0                 
C33023            PERFORM 2800-PROCESS-AGL-FACTOR                       
C33023               THRU 2800-EXIT                                     
C33023         END-IF                                                   
C33950         IF  E-FBW06-BTU-FACTOR > 0                               
C33950             MOVE E-FBW06-BTU-FACTOR     TO BG-BTU-FACTOR         
C33950             PERFORM 8500-UPDATE-BILLING-DET THRU 8500-EXIT       
C33950         END-IF                                                   
           END-IF.                                                      
      *                                                                         
       2200-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * UPDATE READING DETAILS ON MN                                  *         
      *****************************************************************         
       2210-PROCESS-MN-UPDATES.                                         
      *                                                                         
           MOVE SPACES                     TO MN-CODE-NO-RD-REASON.     
           MOVE WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB)                   
                                           TO MN-CODE-CRNT-REG-READ.    
C29853     IF  MN-CODE-CRNT-REG-READ = WS-NORMAL-READ                   
C29853           AND SEB-DATABASE AND                                   
C29853           E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE        
C29853         MOVE WS-AGL-ESTIMATE        TO MN-CODE-CRNT-REG-READ     
C29853                            WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB) 
C29853         MOVE E-FBW06-CODE-METER-NO-READ                          
C29853                                     TO MN-CODE-NO-RD-REASON      
C29853                                WS-FBW06-NO-READ-CD(WS-FBW06-SUB) 
C29853     END-IF.                                                      
C29853*                                                                         
C29853     IF  SEB-DATABASE AND                                         
C29853           E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE        
C29853         ADD 1                       TO MN-NO-CONSEC-ESTIMATE     
C29853     ELSE                                                         
               IF  MN-CODE-CRNT-REG-READ = WS-NORMAL-READ               
                                        OR WS-VERIFIED-READ             
                   MOVE ZERO               TO MN-NO-CONSEC-CRD-READ     
                                              MN-NO-CONSEC-ESTIMATE     
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           MOVE MN-CODE-CRNT-REG-READ      TO MN-CODE-LAST-REG-READ.    
           MOVE E-FBW06-DATE-READ          TO MN-LAST-REG-READ-DATE.    
           MOVE E-FBW06-TIME-READ          TO MN-LAST-REG-READ-TIME.    
           IF  E-FBW06-INDEX-VALUE-CD EQUAL WS-INDEX                    
                 AND WS-FBW06-CRNT-USE (WS-FBW06-SUB) = 0               
C31826         MOVE WS-FBW06-PREV-READING (WS-FBW06-SUB)                
C31826                                     TO MN-LAST-READ-VALUE        
           ELSE                                                         
               MOVE E-FBW06-METER-READING  TO MN-LAST-READ-VALUE        
           END-IF.                                                      
      *****************************************************************         
      *    DO NOT UPDATE LAST VALID READ INFO IF METER FAILED THE HIGH-         
      *    LOW CHECK OR OTHER VALIDATIONS                                       
      *****************************************************************         
           IF  (MN-CODE-CRNT-REG-READ = WS-VERIFIED-READ                
C29853                               OR WS-AGL-ESTIMATE)                
                  OR INACT-MTR-0-USE                                    
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE MN-LAST-READ-VALUE     TO MN-LAST-VAL-RD-VALUE      
               MOVE MN-CODE-CRNT-REG-READ  TO MN-CODE-LAST-VALID-RD     
               MOVE MN-LAST-REG-READ-DATE  TO MN-LAST-VALID-READ-DT     
               MOVE MN-LAST-REG-READ-TIME  TO MN-LAST-VALID-READ-TM     
           END-IF.                                                      
      *                                                                         
           COMPUTE WS-USAGE-PER-DAY ROUNDED                             
              = (WS-FBW06-NO-UNITS (WS-FBW06-SUB)                       
                               / WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB))  
           COMPUTE MN-EST-USAGE ROUNDED = WS-USAGE-PER-DAY * 30         
      *                                                                         
      *PER JERRY, SET TO AWAITING READ, ONLY IF THIS CODE IS 'BOTH'             
      *IT WOULD BE BOTH ONLY FOR STANDBY-GEN METERS, EX:A8/51 METERS            
           IF  MN-IDR-RECIPIENT-CD = 'B' AND TOU-IDR                    
               MOVE WS-AWAITING-READ       TO MN-CODE-CRNT-REG-READ     
           END-IF.                                                      
      *                                                                         
           PERFORM 8300-UPDATE-MTRD-ENVRNMT THRU 8300-EXIT.             
      *                                                                         
       2210-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * UPDATE READING DETAILS ON RG                                  *         
      *****************************************************************         
       2220-PROCESS-RG-UPDATES.                                         
      *                                                                         
           MOVE SPACES                     TO RG-CODE-NO-RD-REASON.     
           MOVE WS-FBW06-REG-ID-NO (WS-FBW06-SUB)                       
                                           TO RG-REG-ID-NO.             
           MOVE E-FBW06-CODE-TIME-PERIOD   TO RG-CODE-TIME-PERIOD.      
           MOVE E-FBW06-CODE-USAGE-TYPE    TO RG-CODE-USAGE-TYPE.       
P00251     MOVE E-FBW06-CODE-USAGE-ID      TO RG-CODE-USAGE-ID.         
      *                                                                         
           PERFORM 7310-SELECT-RG THRU 7310-EXIT                        
      *                                                                         
           MOVE WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB)                   
                                           TO RG-CODE-CRNT-REG-READ     
C29853     IF  RG-CODE-CRNT-REG-READ = WS-NORMAL-READ                   
C29853           AND SEB-DATABASE AND                                   
C29853           E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE        
C29853         MOVE WS-AGL-ESTIMATE        TO RG-CODE-CRNT-REG-READ     
C29853                            WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB) 
C29853         MOVE E-FBW06-CODE-METER-NO-READ                          
C29853                                     TO RG-CODE-NO-RD-REASON      
C29853                                WS-FBW06-NO-READ-CD(WS-FBW06-SUB) 
C29853     END-IF.                                                      
      *                                                                         
           MOVE RG-CODE-CRNT-REG-READ      TO RG-CODE-LAST-REG-READ.    
           MOVE E-FBW06-DATE-READ          TO RG-LAST-REG-READ-DT.      
           MOVE E-FBW06-TIME-READ          TO RG-LAST-REG-READ-TM.      
           IF  E-FBW06-INDEX-VALUE-CD EQUAL WS-INDEX                    
                 AND WS-FBW06-CRNT-USE (WS-FBW06-SUB) = 0               
C31826         MOVE WS-FBW06-PREV-READING(WS-FBW06-SUB)                 
C31826                                     TO RG-LAST-READ-VALUE        
           ELSE                                                         
               MOVE E-FBW06-METER-READING  TO RG-LAST-READ-VALUE        
           END-IF.                                                      
      *****************************************************************         
      *    DO NOT UPDATE LAST VALID READ INFO IF METER FAILED THE HIGH-         
      *    LOW CHECK OR OTHER VALIDATIONS                                       
      *****************************************************************         
           IF  (RG-CODE-CRNT-REG-READ = WS-VERIFIED-READ                
C29853                               OR WS-AGL-ESTIMATE)                
                  OR INACT-MTR-0-USE                                    
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE RG-LAST-READ-VALUE     TO RG-LAST-VAL-RD-VALUE      
               MOVE RG-CODE-CRNT-REG-READ  TO RG-CODE-LAST-VALID-RD     
               MOVE RG-LAST-REG-READ-DT    TO RG-LAST-VALID-READ-DT     
               MOVE RG-LAST-REG-READ-TM    TO RG-LAST-VALID-READ-TM     
           END-IF.                                                      
      *                                                                         
           PERFORM 8350-UPDATE-REGISTER-READ THRU 8350-EXIT.            
      *                                                                         
       2220-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * INSERT READING DETAILS INTO CX                                *         
      *****************************************************************         
       2300-PROCESS-CX-INSERT.                                          
      *                                                                         
P00246     SET DONT-CREATE-NEW-BG          TO TRUE.                     
P00246*                                                                         
           IF  VERIFY-BILL-HOOK                                         
               MOVE MN-ACCOUNT-NO          TO WS-CPD111-ACCOUNT-NO      
               MOVE MN-CODE-UTIL-TYPE      TO WS-CPD111-UTIL-TYPE       
               MOVE MN-IC-NO               TO WS-CPD111-IC-NO           
               PERFORM 6001-GET-FUTURE-BILL-HOOK THRU 6001-CPD111-EXIT  
               MOVE SPACES                 TO WS-VERIFY-BILL-HOOK-FL    
           END-IF.                                                      
      *                                                                         
           MOVE BG-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 MN-MTR-REF-NO              TO CX-MTR-REF-NO.            
           MOVE WS-FBW06-REG-ID-NO (WS-FBW06-SUB)                       
                                           TO CX-REG-ID-NO.             
           MOVE E-FBW06-CODE-TIME-PERIOD   TO CX-CODE-TIME-PERIOD.      
           MOVE E-FBW06-CODE-USAGE-TYPE    TO CX-CODE-USAGE-TYPE.       
           MOVE WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB)                   
                                           TO CX-CODE-USAGE-ID.         
      *                                                                         
30989      MOVE WS-FBW06-PCOMP-FCT (WS-FBW06-SUB) TO CX-PCOMP-FCT.      
      *                                                                         
           MOVE WS-FBW06-CODE-USAGE-SOURCE (WS-FBW06-SUB)               
                                           TO CX-CODE-USAGE-SOURCE.     
           MOVE MN-METER-NO                TO CX-METER-NO.              
           MOVE E-FBW06-DATE-READ          TO CX-DATE-READ.             
           MOVE WS-FBW06-MN-RG-READ-CD (WS-FBW06-SUB)                   
                                           TO CX-CODE-METER-READ.       
           IF  WS-FBW06-NO-READ-CD(WS-FBW06-SUB) = '0'                  
               MOVE SPACES                 TO CX-CODE-METER-NO-READ     
           ELSE                                                         
               MOVE WS-FBW06-NO-READ-CD(WS-FBW06-SUB)                   
                                           TO CX-CODE-METER-NO-READ     
           END-IF.                                                      
           IF  E-FBW06-CODE-USAGE-TYPE = WS-KW OR WS-KVA                
               MOVE E-FBW06-METER-READING  TO CX-DEMAND-READING         
               MOVE ZEROES                 TO CX-METER-READING          
                                              CX-NO-UNITS               
               MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                    
                                           TO CX-NO-DEMAND-UNITS        
           ELSE                                                         
               MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                    
                                           TO CX-NO-UNITS               
               IF  WS-FBW06-CRNT-USE (WS-FBW06-SUB) > 0                 
                   MOVE E-FBW06-METER-READING                           
                                           TO CX-METER-READING          
               ELSE                                                     
                   MOVE WS-FBW06-PREV-READING (WS-FBW06-SUB)            
                                           TO CX-METER-READING          
               END-IF                                                   
               MOVE ZEROES                 TO CX-DEMAND-READING         
                                              CX-NO-DEMAND-UNITS        
           END-IF.                                                      
           MOVE WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB)                    
                                           TO CX-NO-DAYS.               
A01738     MOVE ZEROS                      TO CX-EMPLOYEE-NO.           
      *                                                                         
           MOVE E-FBW06-MTR-READ-SOURCE-CD TO CX-MTR-READ-SOURCE-CD.    
           EVALUATE CX-MTR-READ-SOURCE-CD                               
C29853        WHEN 'E'                                                  
C29853           MOVE WS-METRETEK          TO CX-CODE-SOURCE-ID         
              WHEN 'I'                                                  
              WHEN 'C'                                                  
C33884        WHEN 'B'                                                  
C29853           IF  E-FBW06-CODE-METER-READ EQUAL WS-AMR-READ          
C29853                                          OR WS-ERT-TYPE15-RCVD   
C29853               MOVE WS-ITRON-AMR     TO CX-CODE-SOURCE-ID         
C29853           ELSE                                                   
C29853               MOVE WS-ITRON-SOURCE  TO CX-CODE-SOURCE-ID         
C29853           END-IF                                                 
              WHEN 'T'                                                  
                 MOVE WS-TWACS-SOURCE      TO CX-CODE-SOURCE-ID         
P00462        WHEN 'R'                                                  
P00462           MOVE WS-SMART-SYNCH-SOURCE TO CX-CODE-SOURCE-ID        
PRJ914        WHEN 'P'                                                  
PRJ914           MOVE WS-OPEN-WAY-SOURCE    TO CX-CODE-SOURCE-ID        
              WHEN OTHER                                                
                 MOVE WS-ITRON-SOURCE      TO CX-CODE-SOURCE-ID         
           END-EVALUATE.                                                
           IF  CX-CODE-METER-READ = WS-SYSTEM-ESTIMATE                  
               MOVE 'D'                    TO CX-CODE-SOURCE-ID         
           END-IF.                                                      
      *                                                                         
P00251*** Cogeneration energy/demand received from a Customer is posted         
P00251*** as Credit.(CODE USAGE ID is 'F')                                      
P00251     IF  CX-CODE-USAGE-ID = 'F'                                   
               MOVE WS-CREDIT              TO CX-CODE-DEBIT-CREDIT      
           ELSE                                                         
               MOVE WS-DEBIT               TO CX-CODE-DEBIT-CREDIT      
           END-IF.                                                      
      *                                                                         
           MOVE WS-FBW06-REG-STATUS (WS-FBW06-SUB)                      
                                           TO CX-CODE-ITEM-STATUS.      
C29853     IF  E-FBW06-READ-PROCESS-CD = WS-SONP-READ AND               
C29853            WS-FBW06-REG-STATUS (WS-FBW06-SUB) = WS-INACTIVE      
               MOVE 'T'                    TO CX-CODE-ITEM-STATUS       
           END-IF.                                                      
           MOVE MN-CODE-DISCOUNT           TO CX-CODE-DISCOUNT.         
           MOVE ZEROS                      TO CX-BTU-FACTOR.            
           MOVE WS-FBW06-CONSTANT (WS-FBW06-SUB)                        
                                           TO CX-CONSTANT.              
           MOVE WS-FBW06-RD-DIALS (WS-FBW06-SUB)                        
                                           TO CX-NO-DIALS.              
           MOVE AT-COMPANY-NO              TO CX-COMPANY-NO             
           MOVE MN-DIGTL-MTR-TYPE          TO CX-DIGTL-MTR-TYPE.        
           MOVE E-FBW06-CODE-TOU-SEASN     TO CX-CODE-TOU-SEASN         
           MOVE WS-NO                      TO CX-EXCL-DMD-RCHT-IND.     
           MOVE SPACES                     TO CX-EXCEPT-OVERRIDE-CD     
                                              CX-DIGTL-INTRL-MTR-NO.    
      *                                                                         
P00246*FOR SEB ACCOUNTS CHECK IF A NEW BG NEEDS TO BE CREATED.                  
P00246     IF SEB-DATABASE                                              
P00246        MOVE +0                       TO WS-HOLD-CX-DAYS          
P00246        PERFORM 7415-SUM-EXISTING-CX  THRU 7415-EXIT              
P00246        IF WS-HOLD-CX-DAYS > 0                                    
P00246           COMPUTE WS-HOLD-CX-DAYS = WS-HOLD-CX-DAYS              
P00246                                   + CX-NO-DAYS                   
P00246           IF WS-HOLD-CX-DAYS > 45                                
P00246              SET CREATE-NEW-BG       TO TRUE                     
P00246              PERFORM 6003-VERIFY-BILLING-DET                     
P00246                 THRU 6003-CPD111-EXIT                            
P00246*PUT ACCOUNT ON HOLD                                                      
P00246              MOVE WS-HOLD-NO-READING TO AT-CODE-ACCT-BILLED      
P00246              PERFORM 8560-UPDATE-ACCOUNT THRU 8560-EXIT          
P00246*UPDATE EXEMPT CODES ON AT TABLE                                          
P00246              PERFORM 2310-EXEMPT-ACCOUNT THRU 2310-EXIT          
P00246*GENERATE WARNING WQ                                                      
P00246              SET WS-METER-WARNING    TO TRUE                     
P00246              MOVE MSG-NEW-BG-CREATED TO WS-WQ-MESSAGE            
P00246              MOVE WS-CATEGORY-ID-17  TO WS-CATEGORY-ID           
P00246              MOVE '4'                TO WS-ROUTING-CATEGORY      
P00246              PERFORM 2500-CREATE-WQ  THRU 2500-EXIT              
P00246           END-IF                                                 
P00246        END-IF                                                    
P00246     END-IF.                                                      
P00246                                                                  
P00246     MOVE BG-BILL-ITEM-TIMESTMP      TO CX-BILL-ITEM-TIMESTMP.    
P00246*                                                                         
           PERFORM 7420-SELECT-MAX-CNSMPTN-HIST THRU 7420-EXIT.         
           ADD +0001                       TO CX-ITEM-SEQ-NO.           
           PERFORM 8400-ISRT-CNSMPTN-HIST  THRU 8400-EXIT.              
      *                                                                         
           EVALUATE CX-CODE-USAGE-TYPE                                  
              WHEN WS-KWH                                               
                 ADD 1                     TO WS-COUNT-KWH              
              WHEN WS-CCF                                               
                 ADD 1                     TO WS-COUNT-GAS              
              WHEN WS-UNC                                               
                 ADD 1                     TO WS-COUNT-UNC              
              WHEN WS-INT                                               
                 ADD 1                     TO WS-COUNT-INT              
              WHEN WS-KW                                                
                 ADD 1                     TO WS-COUNT-KW               
              WHEN WS-KVA                                               
                 ADD 1                     TO WS-COUNT-KVA              
           END-EVALUATE.                                                
      *                                                                         
C31697*THIS CHECK IS TO CREATE A WQ IF A READING IS POSTED TWICE                
C31697     MOVE ZEROS                      TO WS-READ-COUNT.            
C31697     PERFORM 7430-CHECK-FOR-DUP-READS THRU 7430-EXIT.             
C31697     IF  WS-READ-COUNT > 1                                        
C31697         SET WS-METER-WARNING        TO TRUE                      
C31697         MOVE MSG-DUPLICATE-READ     TO WS-WQ-MESSAGE             
C31697         MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
C31697         MOVE '4'                    TO WS-ROUTING-CATEGORY       
C31697         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
C31697     END-IF.                                                      
C31697*                                                                         
       2300-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
P00246*****************************************************************         
P00246* EXEMPT ACCOUNT FOR 3 MONTHS TO AVOID CREDIT ACTION.           *         
P00246*****************************************************************         
P00246 2310-EXEMPT-ACCOUNT.                                             
P00246*                                                                         
P00246     MOVE SPACES                     TO WS-XMT-CODES              
P00246                                        WS-XMT-SWITCHES.          
P00246     IF AT-CODE-DISC-OK  = SPACES OR                              
P00246        AT-CODE-DISC-OK IS NUMERIC                                
P00246        IF AT-CODE-DISC-OK < '3'                                  
P00246           MOVE WS-Y                 TO DISC-OK-CHANGED           
P00246           MOVE AT-CODE-DISC-OK      TO WS-CODE-DISC-OK           
P00246           MOVE '3'                  TO AT-CODE-DISC-OK           
P00246        END-IF                                                    
P00246     END-IF.                                                      
P00246     IF AT-NOTICE-EXEMPT-CD  = SPACES OR                          
P00246        AT-NOTICE-EXEMPT-CD IS NUMERIC                            
P00246        IF AT-NOTICE-EXEMPT-CD < '3'                              
P00246           MOVE WS-Y                 TO EXEMPT-CD-CHANGED         
P00246           MOVE AT-NOTICE-EXEMPT-CD  TO WS-NOTICE-EXEMPT-CD       
P00246           MOVE '3'                  TO AT-NOTICE-EXEMPT-CD       
P00246        END-IF                                                    
P00246     END-IF.                                                      
P00246     IF AT-CODE-LPC-XMT  = SPACES OR                              
P00246        AT-CODE-LPC-XMT IS NUMERIC                                
P00246        IF AT-CODE-LPC-XMT < '3'                                  
P00246           MOVE WS-Y                 TO LPC-XMT-CHANGED           
P00246           MOVE AT-CODE-LPC-XMT      TO WS-CODE-LPC-XMT           
P00246           MOVE '3'                  TO AT-CODE-LPC-XMT           
P00246        END-IF                                                    
P00246     END-IF.                                                      
P00246     IF AT-IVR-EXEMPT-CD  = SPACES OR                             
P00246        AT-IVR-EXEMPT-CD IS NUMERIC                               
P00246        IF AT-IVR-EXEMPT-CD < '3'                                 
P00246           MOVE WS-Y                 TO IVR-EXEMPT-CHANGED        
P00246           MOVE AT-IVR-EXEMPT-CD     TO WS-IVR-EXEMPT-CD          
P00246           MOVE '3'                  TO AT-IVR-EXEMPT-CD          
P00246        END-IF                                                    
P00246     END-IF.                                                      
P00246                                                                  
P00246     IF DISC-OK-CHANGED    = WS-YES OR                            
P00246        EXEMPT-CD-CHANGED  = WS-YES OR                            
P00246        LPC-XMT-CHANGED    = WS-YES OR                            
P00246        IVR-EXEMPT-CHANGED = WS-YES                               
P00246        PERFORM 2320-LOAD-TRAN-HIST    THRU 2320-EXIT             
P00246        PERFORM 8570-UPDT-AT-XMT-CODES THRU 8570-EXIT             
P00246     END-IF.                                                      
P00246*                                                                         
P00246 2310-EXIT.                                                       
P00246     EXIT.                                                        
P00246*                                                                         
P00246*****************************************************************         
P00246* LOAD TRANSACTION HISTORY HEADER AND DETAILS.                  *         
P00246*****************************************************************         
P00246 2320-LOAD-TRAN-HIST.                                             
P00246*                                                                         
P00246     MOVE BG-BILL-ITEM-TIMESTMP      TO MH-TRANS-HIST-SEQ-NO.     
P00246     MOVE WS-RUN-DATE                TO MH-DATE-TRANS.            
P00246     MOVE 'F'                        TO MH-CODE-TRAN-TYPE.        
P00246     MOVE '437'                      TO MH-RESP-AREA-ID.          
P00246     MOVE BG-ACCOUNT-NO              TO MH-ACCOUNT-NO.            
P00246     MOVE ZEROS                      TO MH-CUSTOMER-NO.           
P00246     MOVE ZEROS                      TO MH-PREMISE-NO.            
P00246     MOVE 'SYSTEM '                  TO MH-USER-ID.               
P00246     MOVE PROGRAM-NAME               TO MH-APPL-PROGRAM-ID.       
P00246     STRING 'ACCOUNT EXEMPT CODES UPDATED' DELIMITED BY SIZE      
P00246                                   INTO MH-TRAN-COMMENT-TEXT      
P00246     MOVE +28                        TO MH-TRAN-COMMENT-LEN.      
P00246     MOVE ZEROS                      TO WS-TRAN-APPL-NO.          
P00246*LOAD MNT TRANSACTION HISTORY DETAILS                                     
P00246     IF DISC-OK-CHANGED = WS-Y                                    
P00246        MOVE BG-BILL-ITEM-TIMESTMP   TO MI-TRANS-HIST-SEQ-NO      
P00246        ADD 1                        TO WS-TRAN-APPL-NO           
P00246        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
P00246        MOVE 'DISCONNECT CODE'       TO MI-COLUMN-DESC            
P00246        IF WS-CODE-DISC-OK > SPACE                                
P00246           MOVE 24                   TO MI-PRV-COLUMN-VALUE-LEN   
P00246           MOVE WS-CODE-DISC-OK      TO WS-MSG-MONTHS             
P00246           MOVE WS-MSG-LITERAL       TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        ELSE                                                      
P00246           MOVE SPACES               TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        END-IF                                                    
P00246        MOVE 24                      TO MI-CHG-COLUMN-VALUE-LEN   
P00246        MOVE '3'                     TO WS-MSG-MONTHS             
P00246        MOVE WS-MSG-LITERAL          TO MI-CHG-COLUMN-VALUE-TEXT  
P00246        MOVE SPACES                  TO MI-TABLE-ID               
P00246        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
P00246     END-IF.                                                      
P00246*                                                                         
P00246     IF EXEMPT-CD-CHANGED = WS-Y                                  
P00246        MOVE BG-BILL-ITEM-TIMESTMP   TO MI-TRANS-HIST-SEQ-NO      
P00246        ADD 1                        TO WS-TRAN-APPL-NO           
P00246        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
P00246        MOVE 'NOTICE XMT CODE'       TO MI-COLUMN-DESC            
P00246        IF WS-NOTICE-EXEMPT-CD > SPACE                            
P00246           MOVE 24                   TO MI-PRV-COLUMN-VALUE-LEN   
P00246           MOVE WS-NOTICE-EXEMPT-CD  TO WS-MSG-MONTHS             
P00246           MOVE WS-MSG-LITERAL       TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        ELSE                                                      
P00246           MOVE SPACES               TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        END-IF                                                    
P00246        MOVE 24                      TO MI-CHG-COLUMN-VALUE-LEN   
P00246        MOVE '3'                     TO WS-MSG-MONTHS             
P00246        MOVE WS-MSG-LITERAL          TO MI-CHG-COLUMN-VALUE-TEXT  
P00246        MOVE SPACES                  TO MI-TABLE-ID               
P00246        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
P00246     END-IF.                                                      
P00246*                                                                         
P00246     IF LPC-XMT-CHANGED = WS-Y                                    
P00246        MOVE BG-BILL-ITEM-TIMESTMP   TO MI-TRANS-HIST-SEQ-NO      
P00246        ADD 1                        TO WS-TRAN-APPL-NO           
P00246        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
P00246        MOVE 'LPC EXEMPT CODE'       TO MI-COLUMN-DESC            
P00246        IF WS-CODE-LPC-XMT > SPACE                                
P00246           MOVE 24                   TO MI-PRV-COLUMN-VALUE-LEN   
P00246           MOVE WS-CODE-LPC-XMT      TO WS-MSG-MONTHS             
P00246           MOVE WS-MSG-LITERAL       TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        ELSE                                                      
P00246           MOVE SPACES               TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        END-IF                                                    
P00246        MOVE 24                      TO MI-CHG-COLUMN-VALUE-LEN   
P00246        MOVE '3'                     TO WS-MSG-MONTHS             
P00246        MOVE WS-MSG-LITERAL          TO MI-CHG-COLUMN-VALUE-TEXT  
P00246        MOVE SPACES                  TO MI-TABLE-ID               
P00246        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
P00246     END-IF.                                                      
P00246*                                                                         
P00246     IF IVR-EXEMPT-CHANGED = WS-Y                                 
P00246        MOVE BG-BILL-ITEM-TIMESTMP   TO MI-TRANS-HIST-SEQ-NO      
P00246        ADD 1                        TO WS-TRAN-APPL-NO           
P00246        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
P00246        MOVE 'IVR EXEMPT CODE'       TO MI-COLUMN-DESC            
P00246        IF WS-IVR-EXEMPT-CD > SPACE                               
P00246           MOVE 24                   TO MI-PRV-COLUMN-VALUE-LEN   
P00246           MOVE WS-IVR-EXEMPT-CD     TO WS-MSG-MONTHS             
P00246           MOVE WS-MSG-LITERAL       TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        ELSE                                                      
P00246           MOVE SPACES               TO MI-PRV-COLUMN-VALUE-TEXT  
P00246        END-IF                                                    
P00246        MOVE 24                      TO MI-CHG-COLUMN-VALUE-LEN   
P00246        MOVE '3'                     TO WS-MSG-MONTHS             
P00246        MOVE WS-MSG-LITERAL          TO MI-CHG-COLUMN-VALUE-TEXT  
P00246        MOVE SPACES                  TO MI-TABLE-ID               
P00246        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
P00246     END-IF.                                                      
P00246*                                                                         
P00246 2320-EXIT.                                                       
P00246     EXIT.                                                        
P00246*                                                                         
      *****************************************************************         
      * LOAD READINGS TO WQ FREEFORM-COMMENTS                         *         
      *****************************************************************         
       2400-LOAD-WQ-FREEFORM.                                           
      *                                                                         
27793      MOVE E-FBW06-READ-ITEM-STATUS TO WS-READ-ITEM-STATUS         
P00251                                      WS-WQ-READ-STATUS-CD.       
P00251     MOVE E-FBW06-READ-PROCESS-CD  TO WS-WQ-READ-PROCESS-CD.      
C36317     IF MIDMONTH-READ-ALL AND                                     
27793         WS-DO-I-CREATE-MID-MONTH-WQ = 'N'                         
27793         GO TO 2400-EXIT                                           
27793      END-IF.                                                      
      *                                                                         
P00508     IF TOU-ALL                                                   
               MOVE 'Y'                    TO WS-WQ-TOU-FL              
           ELSE                                                         
               MOVE ZEROS                  TO WS-WQ-SUB                 
               MOVE 'N'                    TO WS-WQ-TOU-FL              
           END-IF.                                                      
      *                                                                         
           SET WQ-GENERATED                TO TRUE.                     
           ADD 1                           TO WS-WQ-SUB.                
      *                                                                         
           IF  WS-WQ-SUB > 14                                           
               SET GT-14-READS             TO TRUE                      
               GO TO 2400-EXIT                                          
           END-IF.                                                      
      *                                                                         
           IF  E-FBW06-CODE-USAGE-TYPE = WS-KW OR WS-KVA                
               COMPUTE WS-WQ-READ (WS-WQ-SUB)                           
                      = E-FBW06-METER-READING * (10 ** 3)               
           ELSE                                                         
               COMPUTE WS-WQ-READ (WS-WQ-SUB) = E-FBW06-METER-READING   
           END-IF.                                                      
      *                                                                         
           MOVE WS-FBW06-NO-READ-CD (WS-FBW06-SUB)                      
                                           TO                           
                                           WS-WQ-NO-READ-CD(WS-WQ-SUB)  
           MOVE E-FBW06-CODE-USAGE-TYPE    TO                           
                                         WS-WQ-USAGE-TYPE(WS-WQ-SUB)    
           MOVE WS-FBW06-CODE-USAGE-ID (WS-FBW06-SUB)                   
                                           TO WS-WQ-USAGE-ID(WS-WQ-SUB) 
           MOVE WS-FBW06-CODE-USAGE-SOURCE (WS-FBW06-SUB)               
                                           TO                           
                                        WS-WQ-USAGE-SOURCE(WS-WQ-SUB)   
           MOVE E-FBW06-CODE-TOU-SEASN     TO WS-WQ-SESN-CD(WS-WQ-SUB)  
           MOVE E-FBW06-CODE-TIME-PERIOD   TO                           
                                         WS-WQ-TIME-PERIOD(WS-WQ-SUB).  
           MOVE E-FBW06-METER-NO           TO WS-WQ-METER-NO            
           MOVE E-FBW06-DATE-READ          TO WS-WQ-DATE-READ           
           MOVE E-FBW06-CODE-UTIL-TYPE     TO WS-WQ-UTIL-TYPE           
ACT256     MOVE UT-IC-NO                   TO WS-WQ-READER-ID           
           MOVE E-FBW06-BTU-FACTOR         TO WS-WQ-BTU-FACTOR          
C36317     IF  MIDMONTH-READ-ALL                                        
               MOVE 'M'                    TO WS-WQ-CYCLE-IND           
           ELSE                                                         
               MOVE 'E'                    TO WS-WQ-CYCLE-IND           
           END-IF.                                                      
           MOVE 'N'                        TO WS-WQ-FF-FORMAT-CD.       
           MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                        
                                           TO WS-CRNT-USE.              
           MOVE WS-FBW06-NO-READ-DAYS (WS-FBW06-SUB)                    
                                           TO WS-NO-READ-DAYS.          
C29853     IF  SEB-DATABASE AND                                         
C29853           E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE        
C29853         MOVE WS-AGL-ESTIMATE        TO WS-WQ-READ-CODE           
C29853     ELSE                                                         
C29853         MOVE WS-NORMAL-READ         TO WS-WQ-READ-CODE           
C29853     END-IF.                                                      
      *                                                                         
P00508     IF TOU-ALL                                                   
P00508        CONTINUE                                                  
P00508     ELSE                                                         
C29853*POPULATE NO-READ CODE, IF THE READING IS AGL ESTIMATE READ               
C29853         IF  SEB-DATABASE AND                                     
C29853               E-FBW06-CODE-METER-READ EQUAL WS-FIELD-ESTIMATE    
C29853             CONTINUE                                             
C29853         ELSE                                                     
C29853             MOVE '0'                TO                           
C29853                                    WS-WQ-NO-READ-CD(WS-WQ-SUB)   
C29853         END-IF                                                   
               PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
               SET WQ-NOT-GENERATED        TO TRUE                      
           END-IF.                                                      
      *                                                                         
       2400-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * CREATE WQ                                                     *         
      *****************************************************************         
       2500-CREATE-WQ.                                                  
      *                                                                         
           MOVE SPACES TO WS-WQ-ISSUE-DESC                              
C33889                    WS-COMMENTS-TEXT.                             
ACT015*                                                                         
ACT015     INITIALIZE CWS00077-FIELDS.                                  
ACT015                                                                  
27793      MOVE E-FBW06-READ-ITEM-STATUS TO WS-READ-ITEM-STATUS.        
C36317     IF MIDMONTH-READ-ALL AND                                     
27793         WS-DO-I-CREATE-MID-MONTH-WQ = 'N'                         
27793         GO TO 2500-EXIT                                           
27793      END-IF.                                                      
      *                                                                         
ACT301     IF  WS-CATEGORY-ID = WS-CATEGORY-ID-141                      
ACT301           AND WS-SECURED-RATE-FL = 'Y'                           
ACT301         MOVE WS-CATEGORY-ID-142     TO WS-CATEGORY-ID            
ACT301     END-IF.                                                      
ACT301                                                                  
ACT301     IF  WS-CATEGORY-ID = WS-CATEGORY-ID-583                      
ACT256         IF WS-SECURED-RATE-FL = 'Y'                              
ACT301            MOVE WS-CATEGORY-ID-584     TO WS-CATEGORY-ID         
ACT256         END-IF                                                   
ACT256         IF HILO-WARNING                                          
ACT068            SET WS-METER-WARNING    TO TRUE                       
ACT256            IF WS-SECURED-RATE-FL = 'Y'                           
ACT256               MOVE WS-CATEGORY-ID-582     TO WS-CATEGORY-ID      
ACT256            ELSE                                                  
ACT256               MOVE WS-CATEGORY-ID-581     TO WS-CATEGORY-ID      
ACT256            END-IF                                                
ACT256         END-IF                                                   
           END-IF.                                                      
                                                                        
ACT015     MOVE WS-CATEGORY-ID             TO WS-77-CATEGORY-ID.        
      *                                                                         
           MOVE E-FBW06-METER-NO           TO WS-WQ-ERROR-METER-NO      
                                              WS-WQ-WARN-METER-NO.      
           IF  TOU-WQ                                                   
               MOVE 'TOU'                  TO WS-WQ-E-USAGE-TYPE-DESC   
                                              WS-WQ-W-USAGE-TYPE-DESC   
               IF  GT-14-READS                                          
                   STRING MSG-TOU-READ-FAILED                           
                     'WQ COULD NOT HOLD ALL READINGS. PLEASE CHK '      
                             'PANEL 35 FOR REST OF THE READS.'          
                         DELIMITED BY SIZE                              
                   INTO WS-WQ-ISSUE-DESC                                
               ELSE                                                     
P00508             IF WS-WQ-MESSAGE > SPACES                            
P00508                STRING WS-WQ-MESSAGE DELIMITED BY '  '            
A05744                 'YOU MAY GET MORE DETAILS BY '                   
P00508                       'CLICKING ON THE WORK BUTTON.'             
P00508                   DELIMITED BY SIZE                              
P00508                INTO WS-WQ-ISSUE-DESC                             
P00508             ELSE                                                 
P00508                STRING MSG-TOU-READ-FAILED                        
A05744                 'YOU MAY GET MORE DETAILS BY '                   
P00508                       'CLICKING ON THE WORK BUTTON.'             
P00508                   DELIMITED BY SIZE                              
P00508                INTO WS-WQ-ISSUE-DESC                             
P00508             END-IF                                               
               END-IF                                                   
           ELSE                                                         
               MOVE E-FBW06-REG-MEASURE-CD TO WS-WQ-E-USAGE-TYPE-DESC   
                                              WS-WQ-W-USAGE-TYPE-DESC   
               EVALUATE E-FBW06-CODE-TIME-PERIOD                        
                   WHEN 0                                               
                      MOVE 'NON-TOU '      TO WS-WQ-PEAK-DESC           
                   WHEN 1                                               
                      MOVE 'ON-PEAK '      TO WS-WQ-PEAK-DESC           
                   WHEN 2                                               
                      MOVE 'OFF-PEAK'      TO WS-WQ-PEAK-DESC           
                   WHEN 3                                               
                      MOVE 'SHOULDER'      TO WS-WQ-PEAK-DESC           
               END-EVALUATE                                             
               EVALUATE E-FBW06-CODE-TOU-SEASN                          
                   WHEN 'C'                                             
                      MOVE 'CURRENT '      TO WS-WQ-SEASN-DESC          
                   WHEN 'P'                                             
                      MOVE 'PREVIOUS'      TO WS-WQ-SEASN-DESC          
               END-EVALUATE                                             
               MOVE E-FBW06-DATE-READ      TO WS-WQ-READ-DT             
               MOVE WS-CRNT-USE            TO WS-WQ-USAGE               
               MOVE WS-NO-READ-DAYS        TO WS-WQ-USAGE-DAYS          
               IF  E-FBW06-CODE-USAGE-TYPE = WS-KW OR WS-KVA            
                   MOVE E-FBW06-METER-READING                           
                                           TO WS-WQ-READ-INDX-D         
               ELSE                                                     
                   MOVE E-FBW06-METER-READING                           
                                           TO WS-WQ-READ-INDX-E         
               END-IF                                                   
               MOVE WS-WQ-READ-INDX        TO WS-WQ-READ-INDEX          
               IF  HILO-FAIL                                            
                   MOVE WS-WQ-HI-VAL       TO WS-WQ-DISP-HI-VAL         
                   MOVE WS-WQ-LO-VAL       TO WS-WQ-DISP-LO-VAL         
                   STRING WS-WQ-READ-DET                                
                          WS-WQ-HI-LO-DET                               
                          WS-WQ-MESSAGE                                 
                         DELIMITED BY SIZE                              
                   INTO WS-WQ-ISSUE-DESC                                
               ELSE                                                     
                   STRING WS-WQ-READ-DET                                
                          WS-WQ-MESSAGE                                 
                         DELIMITED BY SIZE                              
                   INTO WS-WQ-ISSUE-DESC                                
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  WS-METER-WARNING                                         
               STRING WS-WQ-WARNING-TEXT                                
                      WS-WQ-ISSUE-DESC                                  
                      DELIMITED BY SIZE                                 
C33889           INTO WS-COMMENTS-TEXT                                  
           ELSE                                                         
               ADD 1 TO WS-NO-OF-REJECT                                 
               STRING WS-WQ-ERROR-TEXT                                  
                      WS-WQ-ISSUE-DESC                                  
                      DELIMITED BY SIZE                                 
C33889           INTO WS-COMMENTS-TEXT                                  
           END-IF.                                                      
                                                                        
P00462     EVALUATE TRUE                                                
P00462        WHEN E-FBW06-CODE-METER-READ = 'A'                        
C35418         STRING WS-AMR-WQ-PFIX                                    
C33889                WS-COMMENTS-TEXT                                  
C33889                DELIMITED BY SIZE                                 
ACT015           INTO WS-77-COMMENTS-TEXT                               
P00508        WHEN SMART-SYNCH-MTR                                      
P00462         STRING WS-AMI-SS-WQ-PFIX                                 
P00462                WS-COMMENTS-TEXT                                  
P00462                DELIMITED BY SIZE                                 
ACT015           INTO WS-77-COMMENTS-TEXT                               
PRJ914        WHEN OPEN-WAY-MTR                                         
PRJ914         STRING WS-AMI-OPEN-WAY-PFIX                              
PRJ914                WS-COMMENTS-TEXT                                  
PRJ914                DELIMITED BY SIZE                                 
PRJ914           INTO WS-77-COMMENTS-TEXT                               
P00462        WHEN OTHER                                                
ACT015         MOVE WS-COMMENTS-TEXT       TO WS-77-COMMENTS-TEXT       
P00462     END-EVALUATE.                                                
                                                                        
ACT015     MOVE LENGTH OF WS-77-COMMENTS-TEXT TO WS-77-COMMENTS-LEN.    
      *                                                                         
ACT015     MOVE SPACES                     TO WS-77-RESP-AREA-ID.       
ACT015     MOVE ZEROS                      TO WS-77-SERV-ORDER-NO.      
ACT015     MOVE WS-RUN-DATE                TO WS-77-DATE-REQUIRED(1:10).
ACT015     MOVE AT-ACCOUNT-NO              TO WS-77-ACCOUNT-NO.         
ACT015     MOVE AT-PREMISE-NO              TO WS-77-PREMISE-NO.         
ACT015     MOVE AT-CUSTOMER-NO             TO WS-77-CUSTOMER-NO.        
ACT015     MOVE AT-LOCAL-OFFICE            TO WS-77-LOCAL-OFFICE.       
ACT015     MOVE WS-ROUTING-CATEGORY        TO WS-77-ROUTE-CATEGORY.     
ACT015     MOVE WS-NORMAL-PRIORITY         TO WS-77-PRIORITY.           
ACT015     MOVE WS-PGRMNAME                TO WS-77-CREATED-BY.         
ACT256***-- 'USG' IS MOVED TO NAVIGATE TO USAGE VIEW WHEN TASK IS WORKED        
ACT256***-- FREEFORM NOT REQUIRED AS 581 AND 582 WILL TAKE TO USAGE VIEW        
ACT256***-- WITH CONSUMPTION POSTED.                                            
ACT301     EVALUATE TRUE                                                
ACT301        WHEN WS-CATEGORY-ID = WS-CATEGORY-ID-581                  
ACT068        WHEN WS-CATEGORY-ID = WS-CATEGORY-ID-582                  
P00899           MOVE 1                   TO WS-77-FREE-FORM-LEN        
P00899           STRING 'USG'                                           
P00899               WS-WORK-QUEUE-DATA                                 
P00899               DELIMITED BY SIZE                                  
P00899           INTO WS-77-FREE-FORM-TXT                               
P00899           WITH POINTER WS-77-FREE-FORM-LEN                       
P00899                                                                  
P00899           COMPUTE WS-77-FREE-FORM-LEN = WS-77-FREE-FORM-LEN - 1  
ACT301        WHEN WS-CATEGORY-ID = WS-CATEGORY-ID-583                  
ACT301        WHEN WS-CATEGORY-ID = WS-CATEGORY-ID-584                  
ACT301           MOVE 1                   TO WS-77-FREE-FORM-LEN        
ACT301           STRING 'COR'                                           
ACT301               WS-WORK-QUEUE-DATA                                 
ACT301               DELIMITED BY SIZE                                  
ACT301           INTO WS-77-FREE-FORM-TXT                               
ACT301           WITH POINTER WS-77-FREE-FORM-LEN                       
ACT301                                                                  
ACT301           COMPUTE WS-77-FREE-FORM-LEN = WS-77-FREE-FORM-LEN - 1  
ACT256        WHEN OTHER                                                
ACT256           MOVE WS-WORK-QUEUE-DATA     TO WS-77-FREE-FORM-TXT     
ACT015           MOVE LENGTH OF WS-WORK-QUEUE-DATA                      
ACT015                                    TO WS-77-FREE-FORM-LEN        
ACT301     END-EVALUATE.                                                
                                                                        
ACT015*                                                                         
           PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT.               
      *                                                                         
           MOVE SPACES                     TO WS-WORK-QUEUE-DATA        
                                              WS-WQ-MESSAGE             
                                              WS-WARNING-IND            
                                              WS-WQ-ISSUE-DESC          
                                              WS-COMMENTS-TEMP          
C33889                                        WS-COMMENTS-TEXT          
                                              WS-WQ-ERROR-METER-NO      
                                              WS-WQ-WARN-METER-NO.      
      *                                                                         
       2500-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * CHECK WHETHER ALL REGISTERS RECEIVED THE READS. IF SO, UPDATE *         
      * ACCOUNT TO READY TO BILL                                      *         
      *****************************************************************         
      *                                                                         
       2600-CHECK-FOR-NO-READS.                                         
           MOVE ZERO                       TO WS-UT-COUNT               
                                              WS-READS-POSTED.          
           MOVE WS-PREV-ACCT-NO            TO UT-ACCOUNT-NO             
                                              AT-ACCOUNT-NO.            
           PERFORM 7500-OPEN-UTIL-ENVRNMT THRU 7500-EXIT.               
           PERFORM 7510-FETCH-UTIL-ENVRNMT THRU 7510-EXIT.              
           PERFORM 2610-CHECK-READ-CODES THRU 2610-EXIT                 
                UNTIL WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND.            
           PERFORM 7520-CLOSE-UTIL-ENVRNMT     THRU 7520-EXIT.          
      *                                                                         
           IF  WS-UT-COUNT GREATER THAN ZERO                            
               IF  WS-READS-POSTED EQUAL WS-UT-COUNT                    
                   IF  AT-CODE-ACCT-BILLED EQUAL WS-HOLD-NO-READING     
                                           OR WS-ACCT-HAS-BILLED        
                       CONTINUE                                         
                   ELSE                                                 
                       MOVE WS-READY       TO AT-CODE-ACCT-BILLED       
                       PERFORM 8560-UPDATE-ACCOUNT THRU 8560-EXIT       
                   END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           MOVE UT-ACCOUNT-NO              TO OC-ACCOUNT-NO.            
           PERFORM 7560-CHECK-OFF-CYCLE THRU 7560-EXIT.                 
           IF  WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
               MOVE AT-BILL-CYCLE          TO  BN-BILL-CYCLE            
               PERFORM 7570-CHECK-BILL-DATE  THRU 7570-EXIT             
               IF  WS-DELETE-OFFCYC = 'Y'                               
                   PERFORM 8600-DELETE-OFF-CYCLE THRU 8600-EXIT         
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       2600-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * CHECK FOR REGISTERS AWAITING METER READS                      *         
      *****************************************************************         
       2610-CHECK-READ-CODES.                                           
           MOVE WS-YES                     TO WS-METER-NOT-READ-FL.     
           MOVE ZERO                       TO WS-MN-AWAITING-RD-COUNT   
                                              WS-RG-AWAITING-RD-COUNT.  
           MOVE UT-ACCOUNT-NO              TO MN-ACCOUNT-NO             
                                              RG-ACCOUNT-NO.            
           MOVE UT-CODE-UTIL-TYPE          TO MN-CODE-UTIL-TYPE         
                                              RG-CODE-UTIL-TYPE.        
           MOVE UT-IC-NO                   TO MN-IC-NO                  
                                              RG-IC-NO.                 
           MOVE WS-AWAITING-READ           TO MN-CODE-CRNT-REG-READ     
                                              RG-CODE-CRNT-REG-READ.    
           PERFORM 7530-CNT-MN-NO-READS THRU 7530-EXIT.                 
           IF  WS-MN-AWAITING-RD-COUNT GREATER THAN ZERO                
               MOVE WS-NO                  TO WS-METER-NOT-READ-FL      
           ELSE                                                         
               PERFORM 7540-CNT-RG-NO-READS THRU 7540-EXIT              
               IF  WS-RG-AWAITING-RD-COUNT GREATER THAN ZERO            
                   MOVE WS-NO              TO WS-METER-NOT-READ-FL      
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF  METER-NOT-READ                                           
               NEXT SENTENCE                                            
           ELSE                                                         
               ADD 1                       TO WS-READS-POSTED           
           END-IF.                                                      
           ADD 1                           TO WS-UT-COUNT.              
           PERFORM 7510-FETCH-UTIL-ENVRNMT THRU 7510-EXIT.              
      *                                                                         
       2610-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
T33376*****************************************************************         
T33376* CHECK FOR VALID TIME                                          *         
T33376*****************************************************************         
T33376 2700-CHECK-VALID-TIME.                                           
T33376                                                                  
T33376     MOVE 'N'                          TO WS-VALID-TIME           
T33376                                                                  
T33376     IF WS-MTR-RD-TIME-HH EQUAL (LOW-VALUES OR SPACES) OR         
T33376        WS-MTR-RD-TIME-MM EQUAL (LOW-VALUES OR SPACES) OR         
T33376        WS-MTR-RD-TIME-SS EQUAL (LOW-VALUES OR SPACES)            
T33376         NEXT SENTENCE                                            
T33376     ELSE                                                         
T33376       IF WS-MTR-RD-TIME-HH IS NUMERIC AND                        
T33376          WS-MTR-RD-TIME-MM IS NUMERIC AND                        
T33376          WS-MTR-RD-TIME-SS IS NUMERIC                            
T33376             MOVE 'Y'                  TO WS-VALID-TIME           
T33376       END-IF                                                     
T33376     END-IF.                                                      
T33376                                                                  
T33376 2700-EXIT.                                                       
T33376     EXIT.                                                        
C33023***                                                                       
C33023*===============================================================*         
C33023 2800-PROCESS-AGL-FACTOR.                                         
C33023*===============================================================*         
C33023                                                                  
C33023     MOVE AT-ACCOUNT-NO          TO FF-ACCOUNT-NO                 
C33023                                    WS-AGL-ACCOUNT-NO             
C33023     MOVE E-FBW06-CODE-UTIL-TYPE TO FF-CODE-UTIL-TYPE             
C33023     MOVE MN-IC-NO               TO FF-IC-NO                      
C33023     MOVE WS-AGL-FF-FACTOR-ID    TO FF-FACTOR-ID                  
C33023     MOVE '10'                   TO FF-CMPNT-ID-CD                
C33023     MOVE 'B'                    TO FF-CODE-SEASON                
C33023     MOVE 'R'                    TO FF-INSTR-USE-TYPE-CD.         
C33023     MOVE 0                      TO FF-CODE-TIME-PERIOD.          
C33023     MOVE 0                      TO FF-CODE-TIME-PERIOD           
C33023     MOVE SPACES                 TO FF-FIXED-FCTR-TYP-CD          
C33023     MOVE 0                      TO FF-FAC-CHRG-BASE-AM           
C35597     MOVE '2999-12-31'           TO FF-EFF-DATE-TO                
C33023                                                                  
P00246     MOVE ZEROS                  TO WS-AGLMTCHRG-COUNT.           
P00246     PERFORM 7665-COUNT-AGL-CURR-MONTH-CHRG THRU 7665-EXIT.       
P00246     IF WS-AGLMTCHRG-COUNT > 1                                    
P00246** Delete Expired AGLMTCHRG factors from CSS_FIXED_FCTR table.            
P00246        PERFORM 8640-DEL-EXPIRED-AGLMTCHRG  THRU 8640-EXIT        
P00246     END-IF.                                                      
P00246                                                                  
C35597     SET WS-AGL-FACTOR-NOT-EXISTS       TO TRUE                   
C35597     MOVE 0                 TO FF-DURATION-REMAIN-NO              
C35597     PERFORM 7660-CHECK-AGL-CURR-MONTH-CHRG THRU 7660-EXIT        
C35597                                                                  
C35597     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C35597        SET WS-AGL-FACTOR-EXISTS     TO TRUE                      
C35597        IF WS-NULL-11 < 0                                         
C35597           MOVE 0        TO FF-DURATION-REMAIN-NO                 
C35597        END-IF                                                    
C35597     ELSE                                                         
C35597         IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                     
C35597            SET WS-AGL-FACTOR-NOT-EXISTS TO TRUE                  
C35597         ELSE IF WS-ACTIVE-RETURN-CODE = WS-811                   
C35597                 MOVE WS-CATEGORY-ID-17 TO WS-CATEGORY-ID         
C35597                 MOVE 4                 TO WS-ROUTING-CATEGORY    
C35597                 SET WS-METER-WARNING   TO TRUE                   
C35597                 MOVE WS-AGL-WQ-TXT     TO WS-WQ-MESSAGE          
C35597                 PERFORM 2500-CREATE-WQ THRU 2500-EXIT            
C35597              END-IF                                              
C35597         END-IF                                                   
C35597     END-IF                                                       
C35597                                                                  
C35597     IF WS-AGL-FACTOR-EXISTS                                      
C35597        IF FF-DURATION-REMAIN-NO EQUAL ZERO                       
C35597* FACTOR ALREADY EXISTS                                                   
C35597           MOVE WS-AGL-FF-FACTOR     TO FF-FACTOR                 
C35597           MOVE SF-DEFLT-DURATION-NO TO FF-DURATION-REMAIN-NO     
C35597           PERFORM 8620-UPDATE-AGL-FACTOR THRU 8620-EXIT          
C35597        ELSE                                                      
C35597* ADDING FACTOR VALUE FOR THE ONE WHICH ALREADY EXISTS FOR                
C35597* CURRENT MONTH (ASSUMTION : SECOND READ )                                
C35597           ADD  WS-AGL-FF-FACTOR        TO FF-FACTOR              
C35597           MOVE SF-DEFLT-DURATION-NO    TO FF-DURATION-REMAIN-NO  
C35597           PERFORM 8620-UPDATE-AGL-FACTOR THRU 8620-EXIT          
C35597        END-IF                                                    
C35597     ELSE                                                         
C35597* CREATING NEW FACTOR FOR NEW ACCOUNTS                                    
C35597        PERFORM 2810-DETERMINE-REV-MONTH  THRU 2810-EXIT          
C35597        PERFORM 2812-FORMAT-REV-MONTH     THRU 2812-EXIT          
C35597        PERFORM 7670-GET-NEXT-FCTR-SEQ    THRU 7670-EXIT          
C35597        MOVE WS-AGL-FF-FACTOR             TO FF-FACTOR            
C35597        MOVE SF-DEFLT-DURATION-NO    TO FF-DURATION-REMAIN-NO     
C35597        PERFORM 8630-INSERT-AGL-FACTOR    THRU 8630-EXIT          
C35597     END-IF                                                       
C33023     .                                                            
C33023 2800-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
C33023*===============================================================*         
C33023 2810-DETERMINE-REV-MONTH.                                        
C33023*===============================================================*         
C33023                                                                  
C35597     IF WS-AGL-BN-REV-MONTH = 0                                   
C35597        MOVE WS-CURR-REV-MONTH      TO WS-AGL-BN-REV-MONTH        
C35597     END-IF                                                       
C35597                                                                  
C35597     MOVE WS-AGL-BN-REV-MONTH       TO WS-AGL-CUR-REV-MONTH       
C35597     MOVE WS-AGL-CUR-REV-MONTH(1:4) TO WS-AGL-LAST-REV-CCYY       
C35597     MOVE WS-AGL-CUR-REV-MONTH(5:2) TO WS-AGL-LAST-REV-MM         
C33023     .                                                            
C33023 2810-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
C33023*===============================================================*         
C33023 2812-FORMAT-REV-MONTH.                                           
C33023*===============================================================*         
C33023                                                                  
C33023     MOVE '-'                  TO FF-EFF-DATE-FROM(5:1)           
C33023                                  FF-EFF-DATE-FROM(8:1)           
C33023     MOVE WS-AGL-LAST-REV-CCYY TO FF-EFF-DATE-FROM(1:4)           
C33023     MOVE WS-AGL-LAST-REV-MM   TO FF-EFF-DATE-FROM(6:2)           
C33023     MOVE '01'                 TO FF-EFF-DATE-FROM(9:2)           
C33023     .                                                            
C33023 2812-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
C35066*===============================================================*         
C35066 2900-CHECK-ROUTE-REPORT.                                         
C35066*===============================================================*         
C35066*                                                                         
C35066     IF WS-TYPE-OF-RD-IND = ' '                                   
C36533        AND PW-TYPE-OF-RD-IND NOT = 'O'                           
C35066        AND WS-READING-COND-CD = ' '                              
C35066        AND CSR-DATABASE                                          
PRJ914        AND NOT (MTR-CHNG-OFF-CYC-READ OR CC-CHNG-OFF-CYC-READ)   
C35066        AND NOT (ACCOUNT-SKIP OR METER-SKIP)                      
C36317        AND NOT (MIDMONTH-READ-ALL AND                            
C35066                  WS-DO-I-CREATE-MID-MONTH-WQ = 'N')              
C35066*** WQ TO NOTIFY DUPLICATE NORMAL READS                                   
C35066         MOVE MSG-MORE-THAN-ONE-READ TO WS-WQ-MESSAGE             
C35066         MOVE WS-CATEGORY-ID-141     TO WS-CATEGORY-ID            
C35066         MOVE '4'                    TO WS-ROUTING-CATEGORY       
C35066         MOVE SPACES TO WS-FBW06-RD-VALID-FL (WS-FBW06-SUB)       
C35066         MOVE ZEROS  TO WS-FBW06-CRNT-USE (WS-FBW06-SUB)          
ACT064         MOVE WS-FBW06-NO-UNITS (WS-FBW06-SUB)                    
ACT064                                     TO WS-CRNT-USE               
C35066         PERFORM 2500-CREATE-WQ THRU 2500-EXIT                    
C35066     END-IF.                                                      
C35066     IF PW-LAST-REG-READ-DT     = WS-LAST-REG-READ-DT             
C35066        AND PW-LAST-REG-READ-TM = WS-LAST-REG-READ-TM             
C35066        AND PW-REG-MEASURE-CD   = WS-REG-MEASURE-CD               
C35066        PERFORM 8250-UPDATE-ROUTE-REPORT THRU 8250-EXIT           
C35066                                                                  
C35066        SET WS-ROUTE-REPT-LOADED  TO TRUE                         
C35066     ELSE                                                         
C35066        EVALUATE TRUE                                             
C36533          WHEN PW-TYPE-OF-RD-IND = 'O'                            
C36533***         ALL AROP READS HANDLED HERE AND DELETE IF PRIOR AROP          
C36533***         READ IS SKIP READ                                             
C36533            IF WS-TYPE-OF-RD-IND = 'O' AND (WS-READING-CODE = '0' 
C36533                                       OR  WS-READING-CODE = 'J') 
C36533               MOVE 'O' TO WS-UPD-TYPE-OF-RD-IND                  
C36533               PERFORM 8610-DELETE-ROUTE-REPORT THRU 8610-EXIT    
C36533            END-IF                                                
C35066          WHEN WS-TYPE-OF-RD-IND = 'S'                            
C35066***         EXISING SUPERVISOR ESTIMATES SHOULD BE DELETED                
C35066            MOVE 'S' TO WS-UPD-TYPE-OF-RD-IND                     
C35066            PERFORM 8610-DELETE-ROUTE-REPORT THRU 8610-EXIT       
C35066          WHEN WS-TYPE-OF-RD-IND = 'H' OR WS-TYPE-OF-RD-IND = 'P' 
C35066***         EXISTING HILO EXCEPTIONS UPDATED WITH D                       
C35066            MOVE 'D' TO WS-UPD-TYPE-OF-RD-IND                     
C35066            PERFORM 8260-UPDATE-DUP-ROUTE-REPORT THRU 8260-EXIT   
C35066          WHEN WS-TYPE-OF-RD-IND = ' '                            
C35066***       NO CHANGES TO EXISTING NORMAL READS BUT WQ MAY GENERATE         
C35066            CONTINUE                                              
C35066          WHEN OTHER                                              
C35066            CONTINUE                                              
C35066        END-EVALUATE                                              
C35066     END-IF.                                                      
C35066*                                                                         
C35066     PERFORM 7250-FETCH-ROUTE-REPORT THRU 7250-EXIT.              
C35066*                                                                         
C35066 2900-EXIT.                                                       
C35066     EXIT.                                                        
C35066***                                                                       
PRJ914***                                                                       
PRJ914*===============================================================*         
PRJ914 3000-PROCESS-OFF-CYC-READS.                                      
PRJ914*===============================================================*         
PRJ914*                                                                         
PRJ914     MOVE E-FBW06-CODE-TIME-PERIOD   TO CX-CODE-TIME-PERIOD       
PRJ914     MOVE E-FBW06-CODE-USAGE-TYPE    TO CX-CODE-USAGE-TYPE        
PRJ914     MOVE E-FBW06-CODE-USAGE-ID      TO CX-CODE-USAGE-ID          
PRJ914     MOVE E-FBW06-CODE-TOU-SEASN     TO CX-CODE-TOU-SEASN         
PRJ914     IF CX-CODE-TOU-SEASN  = 'C'                                  
PRJ914        MOVE SPACES                  TO WS-CODE-TOU-SEASN         
PRJ914     ELSE                                                         
PRJ914        MOVE E-FBW06-CODE-TOU-SEASN  TO WS-CODE-TOU-SEASN         
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914     PERFORM 7418-GET-EXISTING-READ  THRU 7418-EXIT.              
PRJ914     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
PRJ914        MOVE AT-COMPANY-NO              TO MC-COMPANY-NO          
PRJ914        MOVE CX-CODE-UTIL-TYPE          TO MC-CODE-UTIL-TYPE      
PRJ914        MOVE CX-METER-NO                TO MC-METER-NO            
PRJ914        MOVE CX-REG-ID-NO               TO MC-REG-ID-NO           
PRJ914        MOVE ZEROS                      TO MC-FULL-SCALE          
PRJ914        PERFORM 7320-SELECT-MTR-CAP     THRU 7320-EXIT            
PRJ914        IF CX-CONSTANT > 0                                        
PRJ914           MOVE CX-CONSTANT             TO MC-CONSTANT            
PRJ914        ELSE                                                      
PRJ914           IF MC-CONSTANT > 0                                     
PRJ914              CONTINUE                                            
PRJ914           ELSE                                                   
PRJ914              MOVE 1                    TO MC-CONSTANT            
PRJ914           END-IF                                                 
PRJ914        END-IF                                                    
PRJ914        COMPUTE WS-CRNT-USE ROUNDED = E-FBW06-METER-READING       
PRJ914        COMPUTE WS-NO-DEMAND-UNITS  = WS-CRNT-USE * 1             
PRJ914                                                                  
PRJ914        COMPUTE WS-DEMAND-READING  ROUNDED                        
PRJ914                   = E-FBW06-METER-READING / MC-CONSTANT          
PRJ914        EVALUATE TRUE                                             
PRJ914           WHEN MC-FULL-SCALE > 0 AND                             
PRJ914                E-FBW06-METER-READING >= MC-FULL-SCALE            
PRJ914                CONTINUE                                          
PRJ914           WHEN WS-NO-DEMAND-UNITS > CX-NO-DEMAND-UNITS           
PRJ914                PERFORM 3100-CX-HIST-UPDATE THRU 3100-EXIT        
PRJ914           WHEN OTHER                                             
PRJ914                CONTINUE                                          
PRJ914        END-EVALUATE                                              
PRJ914     END-IF.                                                      
PRJ914                                                                  
PRJ914 3000-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914***                                                                       
PRJ914***                                                                       
PRJ914*===============================================================*         
PRJ914 3100-CX-HIST-UPDATE.                                             
PRJ914*===============================================================*         
PRJ914*                                                                         
PRJ914     PERFORM 7360-SELECT-CUR-TIMESTAMP THRU 7360-EXIT             
PRJ914     MOVE WS-CURRENT-TIMESTMP        TO MH-TRANS-HIST-SEQ-NO.     
PRJ914     MOVE WS-RUN-DATE                TO MH-DATE-TRANS.            
PRJ914     MOVE 'F'                        TO MH-CODE-TRAN-TYPE.        
PRJ914     MOVE '437'                      TO MH-RESP-AREA-ID.          
PRJ914     MOVE CX-ACCOUNT-NO              TO MH-ACCOUNT-NO.            
PRJ914     MOVE ZEROS                      TO MH-CUSTOMER-NO.           
PRJ914     MOVE ZEROS                      TO MH-PREMISE-NO.            
PRJ914     MOVE 'SYSTEM '                  TO MH-USER-ID.               
PRJ914     MOVE PROGRAM-NAME               TO MH-APPL-PROGRAM-ID.       
PRJ914     MOVE 'DEMAND CONSUMPTION ON FUTURE ROW UPDATED'              
PRJ914                                   TO MH-TRAN-COMMENT-TEXT        
PRJ914     MOVE 40                         TO MH-TRAN-COMMENT-LEN.      
PRJ914     MOVE ZEROS                      TO WS-TRAN-APPL-NO.          
PRJ914                                                                  
PRJ914     MOVE MH-TRANS-HIST-SEQ-NO    TO MI-TRANS-HIST-SEQ-NO         
PRJ914     COMPUTE WS-TRAN-APPL-NO = WS-TRAN-APPL-NO + 1                
PRJ914     MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO              
PRJ914     MOVE 'USAGE TYPE'            TO MI-COLUMN-DESC               
PRJ914     MOVE CX-CODE-USAGE-TYPE      TO MI-PRV-COLUMN-VALUE-TEXT     
PRJ914     MOVE 1                       TO MI-PRV-COLUMN-VALUE-LEN      
PRJ914     MOVE CX-CODE-USAGE-TYPE      TO MI-CHG-COLUMN-VALUE-TEXT     
PRJ914     MOVE 1                       TO MI-CHG-COLUMN-VALUE-LEN      
PRJ914     MOVE SPACES                  TO MI-TABLE-ID                  
PRJ914     PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT.             
PRJ914                                                                  
PRJ914     MOVE MH-TRANS-HIST-SEQ-NO    TO MI-TRANS-HIST-SEQ-NO         
PRJ914     COMPUTE WS-TRAN-APPL-NO = WS-TRAN-APPL-NO + 1                
PRJ914     MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO              
PRJ914     MOVE 'CDE TIME PERIOD'       TO MI-COLUMN-DESC               
PRJ914     MOVE CX-CODE-TIME-PERIOD     TO WS-EDIT-DEC-ZERO             
PRJ914     MOVE WS-EDIT-DEC-ZERO        TO MI-PRV-COLUMN-VALUE-TEXT     
PRJ914     MOVE 10                      TO MI-PRV-COLUMN-VALUE-LEN      
PRJ914     MOVE WS-EDIT-DEC-ZERO        TO MI-CHG-COLUMN-VALUE-TEXT     
PRJ914     MOVE 10                      TO MI-CHG-COLUMN-VALUE-LEN      
PRJ914     MOVE SPACES                  TO MI-TABLE-ID                  
PRJ914     PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT.             
PRJ914     IF WS-NO-DEMAND-UNITS     NOT = CX-NO-DEMAND-UNITS           
PRJ914        MOVE MH-TRANS-HIST-SEQ-NO    TO MI-TRANS-HIST-SEQ-NO      
PRJ914        COMPUTE WS-TRAN-APPL-NO = WS-TRAN-APPL-NO + 1             
PRJ914        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
PRJ914        MOVE 'NO DEMAND UNITS'       TO MI-COLUMN-DESC            
PRJ914        MOVE CX-NO-DEMAND-UNITS     TO WS-EDIT-DEC-ZERO           
PRJ914        MOVE WS-EDIT-DEC-ZERO        TO MI-PRV-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-PRV-COLUMN-VALUE-LEN   
PRJ914        MOVE WS-NO-DEMAND-UNITS     TO WS-EDIT-DEC-ZERO           
PRJ914        MOVE WS-EDIT-DEC-ZERO        TO MI-CHG-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-CHG-COLUMN-VALUE-LEN   
PRJ914        MOVE SPACES                  TO MI-TABLE-ID               
PRJ914        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
PRJ914     END-IF.                                                      
PRJ914     IF WS-DEMAND-READING NOT = CX-DEMAND-READING                 
PRJ914        MOVE MH-TRANS-HIST-SEQ-NO    TO MI-TRANS-HIST-SEQ-NO      
PRJ914        COMPUTE WS-TRAN-APPL-NO = WS-TRAN-APPL-NO + 1             
PRJ914        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
PRJ914        MOVE 'DEMAND READING'        TO MI-COLUMN-DESC            
PRJ914        MOVE CX-DEMAND-READING      TO WS-EDIT-DEC-THREE          
PRJ914        MOVE WS-EDIT-DEC-THREE       TO MI-PRV-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-PRV-COLUMN-VALUE-LEN   
PRJ914        MOVE WS-DEMAND-READING      TO WS-EDIT-DEC-THREE          
PRJ914        MOVE WS-EDIT-DEC-THREE       TO MI-CHG-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-CHG-COLUMN-VALUE-LEN   
PRJ914        MOVE SPACES                  TO MI-TABLE-ID               
PRJ914        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
PRJ914     END-IF.                                                      
PRJ914     IF MC-CONSTANT            NOT = CX-CONSTANT                  
PRJ914        MOVE MH-TRANS-HIST-SEQ-NO    TO MI-TRANS-HIST-SEQ-NO      
PRJ914        COMPUTE WS-TRAN-APPL-NO = WS-TRAN-APPL-NO + 1             
PRJ914        MOVE WS-TRAN-APPL-NO         TO MI-TRAN-APPL-NO           
PRJ914        MOVE 'CONSTANT'              TO MI-COLUMN-DESC            
PRJ914        MOVE CX-CONSTANT            TO WS-EDIT-DEC-ZERO           
PRJ914        MOVE WS-EDIT-DEC-ZERO        TO MI-PRV-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-PRV-COLUMN-VALUE-LEN   
PRJ914        MOVE MC-CONSTANT            TO WS-EDIT-DEC-ZERO           
PRJ914        MOVE WS-EDIT-DEC-ZERO        TO MI-CHG-COLUMN-VALUE-TEXT  
PRJ914        MOVE 10                      TO MI-CHG-COLUMN-VALUE-LEN   
PRJ914        MOVE SPACES                  TO MI-TABLE-ID               
PRJ914        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
PRJ914     END-IF.                                                      
PRJ914                                                                  
PRJ914     MOVE WS-NO-DEMAND-UNITS TO CX-NO-DEMAND-UNITS                
PRJ914     MOVE WS-DEMAND-READING  TO CX-DEMAND-READING                 
PRJ914     MOVE MC-CONSTANT        TO CX-CONSTANT                       
PRJ914     PERFORM 8410-UPDATE-CX-HIST THRU 8410-EXIT.                  
PRJ914                                                                  
PRJ914 3100-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914***                                                                       
                                                                        
      * GET FCA00 COMMON DATE                 *                                 
           COPY CPD00040.                                                       
      ******************************************************************        
      * COPYBOOK TO LOOK UP OR CREATE FUTURE BILL HOOK                          
      ******************************************************************        
           EXEC SQL                                                             
               INCLUDE CPD00111                                                 
           END-EXEC.                                                            
      *                                                                         
      ******************************************************************        
      * COPYBOOK TO CHECK FOR ZERO USE AND CREATE A WQ, IF NEEDED               
      ******************************************************************        
           EXEC SQL                                                             
               INCLUDE CPD00140                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      * COPYBOOK TO GET THE MOST CURRENT ACCOUNT AT A PREMISE         *         
      *****************************************************************         
           EXEC SQL                                                             
               INCLUDE CPD00099                                                 
           END-EXEC.                                                            
      *                                                                         
      ******************************************************************        
      * COPYBOOK TO GET THE NEXT BUSINESS DAY                          *        
      ******************************************************************        
           EXEC SQL                                                             
               INCLUDE CPD00315                                                 
           END-EXEC.                                                            
      *                                                                         
      *    6235-GET-FJC01-RESTART-REQ.                                          
       COPY CPD00035.                                                           
      *                                                                         
      *    6251-GET-FJC01-DATE.                                                 
       COPY CPD00037.                                                           
      *                                                                         
      *    6253-GET-FJC01-CHKP-LIMIT.                                           
       COPY CPD00034.                                                           
      *                                                                         
      *    6254-GET-FJC01-STOP-KEY.                                             
       COPY CPD00036.                                                           
      *                                                                         
      *    6255-GET-FJC01-PRT-CNTR.                                             
       COPY CPD00015.                                                           
      *                                                                         
P00246*    6530-LOAD-MNT-TRANS-HIST.                                            
P00246     EXEC SQL                                                             
P00246         INCLUDE CPD00067                                                 
P00246     END-EXEC.                                                            
P00246*                                                                         
      *    6500-LOAD-EXCP-LIMITS.                                               
           EXEC SQL                                                             
               INCLUDE CPD00314                                                 
           END-EXEC.                                                            
      *                                                                         
      ******************************************************************        
      * ERROR ROUTINE TO HANDLE ERRORS FROM CPD00099                   *        
      ******************************************************************        
       6995-CPD99-ERROR-ROUTINE.                                        
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE = WS-811                           
               MOVE AT-ACCOUNT-NO          TO WS-CPD99-ACCOUNT-NO       
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**  ERROR IN PARA ', ACTIVE-PARAGRAPH           
               DISPLAY '**  PREMISE-NO = ', WS-CPD99-PREMISE-NO         
               DISPLAY '**  SQL CODE IS ', WS-CPD99-RETURN-CODE         
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       6995-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * READ INPUT FILE                                                *        
      ******************************************************************        
       7000-READ-FBW06-FILE.                                            
      *                                                                         
           READ FCSBW06-FILE                                            
               AT END MOVE WS-YES          TO WS-END-OF-FBW06-FILE.     
      *                                                                         
           IF  END-OF-FBW06                                             
               CONTINUE                                                 
           ELSE                                                         
               IF  FBW06-SUCCESSFUL                                     
                   CONTINUE                                             
               ELSE                                                     
                   DISPLAY '****************************************'   
                   DISPLAY '**     PCSBW143 PROCESSING ERROR      **'   
                   DISPLAY '**      ABEND IN PARAGRAPH 7000       **'   
                   DISPLAY '**      READ STATUS   = ' WS-FBW06-STATUS   
                   DISPLAY '****************************************'   
                   PERFORM 9900-ABEND THRU 9900-EXIT                    
               END-IF                                                   
               IF  E-FBW06-RECORD-KEY EQUAL WS-ALL-NINES                
                   MOVE WS-YES             TO WS-CNTRL-REC-REACHED      
               ELSE                                                     
                   ADD 1                   TO WS-FBW06-REC-CNTR         
T33376             MOVE E-FBW06-TIME-READ    TO WS-MTR-RD-TIME          
T33376             PERFORM 2700-CHECK-VALID-TIME THRU 2700-EXIT         
T33376             IF WS-VALID-TIME = 'N'                               
T33376               MOVE WS-DEFAULT-TIME    TO E-FBW06-TIME-READ       
T33376             END-IF                                               
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       7000-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C29853******************************************************************        
C29853* GET PARAMETERS FROM DELINQUENCY TABLE                          *        
C29853******************************************************************        
       7010-GET-DELINQ-VALUE.                                           
      *                                                                         
           EXEC SQL                                                     
               SELECT DELINQ_VALUE                                      
                 INTO :C8-DELINQ-VALUE                                  
                 FROM CSS_DELINQUENCY WITH(READUNCOMMITTED)                     
                WHERE COMPANY_NO = :C8-COMPANY-NO                       
                  AND DELINQ_CD  = :C8-DELINQ-CD                        
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT DELINQ_VALUE                                              
MFA-TR*          INTO :C8-DELINQ-VALUE                                          
MFA-TR*          FROM CSS_DELINQUENCY                                           
MFA-TR*         WHERE COMPANY_NO = :C8-COMPANY-NO                               
MFA-TR*           AND DELINQ_CD  = :C8-DELINQ-CD                                
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7010                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7010       **'       
               DISPLAY '**      COMPANY_NO    = ' C8-COMPANY-NO         
               DISPLAY '**      DELINQ_CD     = ' C8-DELINQ-CD          
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7010-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT DETAILS FROM CSS_ACCOUNT                                *        
      ******************************************************************        
       7100-SELECT-ACCOUNT.                                             
      *                                                                         
           EXEC SQL                                                     
               SELECT PREMISE_NO                                        
                     ,CUSTOMER_NO                                       
                     ,CODE_COMPANY_ACCT                                 
                     ,CODE_ACCT_BILLED                                  
                     ,LOCAL_OFFICE                                      
                     ,COMPANY_NO                                        
                     ,NXT_BILL_NO                                       
                     ,CODE_ACCT_STAT                                    
                     ,BILL_CYCLE                                        
                     ,REV_MTH_LST_NRML                                  
P00246               ,CODE_LPC_XMT                                      
P00246               ,NOTICE_EXEMPT_CD                                  
P00246               ,CODE_DISC_OK                                      
P00246               ,IVR_EXEMPT_CD                                     
                 INTO :AT-PREMISE-NO                                    
                     ,:AT-CUSTOMER-NO                                   
                     ,:AT-CODE-COMPANY-ACCT                             
                     ,:AT-CODE-ACCT-BILLED                              
                     ,:AT-LOCAL-OFFICE                                  
                     ,:AT-COMPANY-NO                                    
                     ,:AT-NXT-BILL-NO                                   
                     ,:AT-CODE-ACCT-STAT                                
                     ,:AT-BILL-CYCLE                                    
                     ,:AT-REV-MTH-LST-NRML                              
P00246               ,:AT-CODE-LPC-XMT                                  
P00246               ,:AT-NOTICE-EXEMPT-CD                              
P00246               ,:AT-CODE-DISC-OK                                  
P00246               ,:AT-IVR-EXEMPT-CD                                 
                 FROM CSS_ACCOUNT WITH(READUNCOMMITTED)                         
                WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                       
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT PREMISE_NO                                                
MFA-TR*              ,CUSTOMER_NO                                               
MFA-TR*              ,CODE_COMPANY_ACCT                                         
MFA-TR*              ,CODE_ACCT_BILLED                                          
MFA-TR*              ,LOCAL_OFFICE                                              
MFA-TR*              ,COMPANY_NO                                                
MFA-TR*              ,NXT_BILL_NO                                               
MFA-TR*              ,CODE_ACCT_STAT                                            
MFA-TR*              ,BILL_CYCLE                                                
MFA-TR*              ,REV_MTH_LST_NRML                                          
MFA-TR*              ,CODE_LPC_XMT                                              
MFA-TR*              ,NOTICE_EXEMPT_CD                                          
MFA-TR*              ,CODE_DISC_OK                                              
MFA-TR*              ,IVR_EXEMPT_CD                                             
MFA-TR*          INTO :AT-PREMISE-NO                                            
MFA-TR*              ,:AT-CUSTOMER-NO                                           
MFA-TR*              ,:AT-CODE-COMPANY-ACCT                                     
MFA-TR*              ,:AT-CODE-ACCT-BILLED                                      
MFA-TR*              ,:AT-LOCAL-OFFICE                                          
MFA-TR*              ,:AT-COMPANY-NO                                            
MFA-TR*              ,:AT-NXT-BILL-NO                                           
MFA-TR*              ,:AT-CODE-ACCT-STAT                                        
MFA-TR*              ,:AT-BILL-CYCLE                                            
MFA-TR*              ,:AT-REV-MTH-LST-NRML                                      
MFA-TR*              ,:AT-CODE-LPC-XMT                                          
MFA-TR*              ,:AT-NOTICE-EXEMPT-CD                                      
MFA-TR*              ,:AT-CODE-DISC-OK                                          
MFA-TR*              ,:AT-IVR-EXEMPT-CD                                         
MFA-TR*          FROM CSS_ACCOUNT                                               
MFA-TR*         WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                               
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7100                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7100       **'       
               DISPLAY '**      ACCOUNT_NO    = ' AT-ACCOUNT-NO         
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CHECK WHETHER THE ACCOUNT IS OLD-ACCOUNT-NO                    *        
      ******************************************************************        
       7110-GET-XREF-ACCOUNT.                                           
      *                                                                         
           EXEC SQL                                                     
              SELECT XR.NEW_ACCOUNT_NO                                  
                INTO :XR-NEW-ACCOUNT-NO                                 
                FROM CSS_XREF_ACCT      XR WITH(READUNCOMMITTED)                
                    ,CSS_ACCOUNT        AT WITH(READUNCOMMITTED)                
                WHERE XR.OLD_ACCOUNT_NO = :XR-OLD-ACCOUNT-NO            
                  AND XR.NEW_ACCOUNT_NO = AT.ACCOUNT_NO                 
                  AND AT.CODE_ACCT_STAT <> 'S'                          
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT XR.NEW_ACCOUNT_NO                                          
MFA-TR*         INTO :XR-NEW-ACCOUNT-NO                                         
MFA-TR*         FROM CSS_XREF_ACCT      XR                                      
MFA-TR*             ,CSS_ACCOUNT        AT                                      
MFA-TR*         WHERE XR.OLD_ACCOUNT_NO = :XR-OLD-ACCOUNT-NO                    
MFA-TR*           AND XR.NEW_ACCOUNT_NO = AT.ACCOUNT_NO                         
MFA-TR*           AND AT.CODE_ACCT_STAT <> 'S'                                  
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7110                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7110       **'       
               DISPLAY '**      ACCOUNT_NO    = ' XR-OLD-ACCOUNT-NO     
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7110-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT DETAILS FROM PREMISE                                    *        
      ******************************************************************        
       7120-SELECT-PREMISE.                                             
      *                                                                         
           EXEC SQL                                                     
              SELECT LOCAL_OFFICE                                       
                    ,PREMISE_NO                                         
                    ,PREM_ACCT_SEQ_NO                                   
                    ,REV_DISTRICT_CD                                    
A02367              ,DATEADD( DAY, -2, PEND_OFF_ORD_DT )                        
                INTO :PR-LOCAL-OFFICE                                   
                    ,:PR-PREMISE-NO                                     
                    ,:PR-PREM-ACCT-SEQ-NO                               
                    ,:PR-REV-DISTRICT-CD                                
A02367              ,:WS-PEND-OFF-DT-MIN-2 :WS-NULL-2                   
                FROM CSS_PREMISE WITH(READUNCOMMITTED)                          
               WHERE PREMISE_NO = :PR-PREMISE-NO                        
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ044
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT LOCAL_OFFICE                                               
MFA-TR*             ,PREMISE_NO                                                 
MFA-TR*             ,PREM_ACCT_SEQ_NO                                           
MFA-TR*             ,REV_DISTRICT_CD                                            
MFA-TR*             ,PEND_OFF_ORD_DT - 2 DAYS                                   
MFA-TR*         INTO :PR-LOCAL-OFFICE                                           
MFA-TR*             ,:PR-PREMISE-NO                                             
MFA-TR*             ,:PR-PREM-ACCT-SEQ-NO                                       
MFA-TR*             ,:PR-REV-DISTRICT-CD                                        
MFA-TR*             ,:WS-PEND-OFF-DT-MIN-2 :WS-NULL-2                           
MFA-TR*         FROM CSS_PREMISE                                                
MFA-TR*        WHERE PREMISE_NO = :PR-PREMISE-NO                                
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7120                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7120       **'       
               DISPLAY '**      PREMISE_NO    = ' PR-PREMISE-NO         
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7120-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT REVENUE MONTH                                           *        
      ******************************************************************        
       7130-SELECT-READ-WINDOW.                                         
      *                                                                         
           EXEC SQL                                                     
              SELECT REVENUE_MONTH                                      
                INTO :RW-REVENUE-MONTH                                  
                FROM CSS_READ_WINDOW WITH(READUNCOMMITTED)                      
               WHERE READ_CYCLE = :RW-READ-CYCLE                        
                 AND DATE_MTR_RD_XTRCT =                                
                     (SELECT MAX (DATE_MTR_RD_XTRCT)                    
                        FROM CSS_READ_WINDOW WITH(READUNCOMMITTED)              
                       WHERE READ_CYCLE = :RW-READ-CYCLE                
                         AND DATE_MTR_RD_XTRCT <= IIF(TRY_CONVERT(DATE, 
                                                           :WS-RUN-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-RUN-DATE
              ) <> 0) OR (LEN(:WS-RUN-DATE) <> 10), CIS.CHAR2DATE(
                                                           :WS-RUN-DATE
              ), CONVERT(DATE, :WS-RUN-DATE) ))         
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT REVENUE_MONTH                                              
MFA-TR*         INTO :RW-REVENUE-MONTH                                          
MFA-TR*         FROM CSS_READ_WINDOW                                            
MFA-TR*        WHERE READ_CYCLE = :RW-READ-CYCLE                                
MFA-TR*          AND DATE_MTR_RD_XTRCT =                                        
MFA-TR*              (SELECT MAX (DATE_MTR_RD_XTRCT)                            
MFA-TR*                 FROM CSS_READ_WINDOW                                    
MFA-TR*                WHERE READ_CYCLE = :RW-READ-CYCLE                        
MFA-TR*                  AND DATE_MTR_RD_XTRCT <= :WS-RUN-DATE)                 
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7130                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7130       **'       
               DISPLAY '**      READ CYCLE    = ' RW-READ-CYCLE         
               DISPLAY '**      RUN DATE      = ' WS-RUN-DATE           
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7130-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT OPEN AND CLODE DATES OF THE BILL CYCLE                  *        
      ******************************************************************        
       7140-SELECT-BILL-WINDOW.                                         
      *                                                                         
           EXEC SQL                                                     
              SELECT MIN(DATE_EXTRACT)                                  
                    ,MAX(DATE_EXTRACT)                                  
C35066          INTO :WS-BN-WIN-OPEN-DATE :WS-NULL-1                     
C35066              ,:WS-BN-WIN-CLOSE-DATE :WS-NULL-2                    
                FROM CSS_BILL_WINDOW WITH(READUNCOMMITTED)                      
               WHERE BILL_CYCLE     = :BN-BILL-CYCLE                    
                 AND REVENUE_MONTH  = :BN-REVENUE-MONTH                 
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT MIN(DATE_EXTRACT)                                          
MFA-TR*             ,MAX(DATE_EXTRACT)                                          
MFA-TR*         INTO :WS-BN-WIN-OPEN-DATE:WS-NULL-1                             
MFA-TR*             ,:WS-BN-WIN-CLOSE-DATE:WS-NULL-2                            
MFA-TR*         FROM CSS_BILL_WINDOW                                            
MFA-TR*        WHERE BILL_CYCLE     = :BN-BILL-CYCLE                            
MFA-TR*          AND REVENUE_MONTH  = :BN-REVENUE-MONTH                         
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7140                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7140       **'       
               DISPLAY '**      BILL CYCLE    = ' BN-BILL-CYCLE         
               DISPLAY '**      REV MONTH     = ' BN-REVENUE-MONTH      
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7140-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT METER DETAILS                                           *        
      ******************************************************************        
       7150-SELECT-MTRD-ENVRNMT.                                        
      *                                                                         
           EXEC SQL                                                     
              SELECT ACCOUNT_NO                                         
                    ,CODE_UTIL_TYPE                                     
                    ,IC_NO                                              
                    ,MTR_REF_NO                                         
                    ,CODE_TIME_PERIOD                                   
                    ,METER_NO                                           
                    ,CODE_METER_STATUS                                  
                    ,EST_USAGE                                          
                    ,SPCL_MTR_CONDITION                                 
                    ,CODE_USAGE_TYPE                                    
                    ,CODE_USAGE_ID                                      
                    ,CODE_USAGE_SOURCE                                  
                    ,REG_ID_NO                                          
                    ,CODE_CRNT_REG_READ                                 
                    ,CODE_LAST_REG_READ                                 
                    ,LAST_REG_READ_DATE                                 
                    ,REPLACE(CONVERT(CHAR(8), LAST_REG_READ_TIME, 108), 
           ':', '.') LAST_REG_READ_TIME                                 
                    ,LAST_READ_VALUE                                    
                    ,NO_CONSEC_ESTIMATE                                 
                    ,NO_CONSEC_CRD_READ                                 
                    ,PROGRAM_ID                                         
                    ,CODE_DISCOUNT                                      
                    ,LAST_VALID_READ_DT                                 
                    ,REPLACE(CONVERT(CHAR(8), LAST_VALID_READ_TM, 108), 
           ':', '.') LAST_VALID_READ_TM                                 
                    ,LAST_VAL_RD_VALUE                                  
                    ,IDR_RECIPIENT_CD                                   
                    ,CODE_LAST_VALID_RD                                 
                    ,REMOTE_READ_IND                                    
                    ,DIGTL_MTR_TYPE                                     
                    ,CODE_MTR_RD_INST1                                  
                    ,CODE_MTR_RD_INST2                                  
                    ,CODE_MTR_RD_INST3                                  
                    ,MTR_READ_SOURCE_CD                                 
                    ,REGISTER_RD_SEQ                                    
                    ,DATE_MTR_INSTALL                                   
30989               ,METER_PRESSURE                                     
ACT068              ,CODE_DATA_PRESENT                                  
                INTO :MN-ACCOUNT-NO                                     
                    ,:MN-CODE-UTIL-TYPE                                 
                    ,:MN-IC-NO                                          
                    ,:MN-MTR-REF-NO                                     
                    ,:MN-CODE-TIME-PERIOD                               
                    ,:MN-METER-NO                                       
                    ,:MN-CODE-METER-STATUS                              
                    ,:MN-EST-USAGE                                      
                    ,:MN-SPCL-MTR-CONDITION                             
                    ,:MN-CODE-USAGE-TYPE                                
                    ,:MN-CODE-USAGE-ID                                  
                    ,:MN-CODE-USAGE-SOURCE                              
                    ,:MN-REG-ID-NO                                      
                    ,:MN-CODE-CRNT-REG-READ                             
                    ,:MN-CODE-LAST-REG-READ                             
                    ,:MN-LAST-REG-READ-DATE :WS-NULL-1                  
                    ,:MN-LAST-REG-READ-TIME :WS-NULL-2                  
                    ,:MN-LAST-READ-VALUE                                
                    ,:MN-NO-CONSEC-ESTIMATE                             
                    ,:MN-NO-CONSEC-CRD-READ                             
                    ,:MN-PROGRAM-ID                                     
                    ,:MN-CODE-DISCOUNT                                  
                    ,:MN-LAST-VALID-READ-DT :WS-NULL-3                  
                    ,:MN-LAST-VALID-READ-TM :WS-NULL-4                  
                    ,:MN-LAST-VAL-RD-VALUE                              
                    ,:MN-IDR-RECIPIENT-CD                               
                    ,:MN-CODE-LAST-VALID-RD                             
                    ,:MN-REMOTE-READ-IND                                
                    ,:MN-DIGTL-MTR-TYPE                                 
                    ,:MN-CODE-MTR-RD-INST1                              
                    ,:MN-CODE-MTR-RD-INST2                              
                    ,:MN-CODE-MTR-RD-INST3                              
                    ,:MN-MTR-READ-SOURCE-CD                             
                    ,:MN-REGISTER-RD-SEQ                                
                    ,:MN-DATE-MTR-INSTALL                               
30989               ,:MN-METER-PRESSURE                                 
ACT068              ,:MN-CODE-DATA-PRESENT                              
                FROM CSS_MTRD_ENVRNMT WITH(READUNCOMMITTED)                     
               WHERE ACCOUNT_NO     =  :MN-ACCOUNT-NO                   
                 AND CODE_UTIL_TYPE =  :MN-CODE-UTIL-TYPE               
                 AND METER_NO       =  :MN-METER-NO                     
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT ACCOUNT_NO                                                 
MFA-TR*             ,CODE_UTIL_TYPE                                             
MFA-TR*             ,IC_NO                                                      
MFA-TR*             ,MTR_REF_NO                                                 
MFA-TR*             ,CODE_TIME_PERIOD                                           
MFA-TR*             ,METER_NO                                                   
MFA-TR*             ,CODE_METER_STATUS                                          
MFA-TR*             ,EST_USAGE                                                  
MFA-TR*             ,SPCL_MTR_CONDITION                                         
MFA-TR*             ,CODE_USAGE_TYPE                                            
MFA-TR*             ,CODE_USAGE_ID                                              
MFA-TR*             ,CODE_USAGE_SOURCE                                          
MFA-TR*             ,REG_ID_NO                                                  
MFA-TR*             ,CODE_CRNT_REG_READ                                         
MFA-TR*             ,CODE_LAST_REG_READ                                         
MFA-TR*             ,LAST_REG_READ_DATE                                         
MFA-TR*             ,LAST_REG_READ_TIME                                         
MFA-TR*             ,LAST_READ_VALUE                                            
MFA-TR*             ,NO_CONSEC_ESTIMATE                                         
MFA-TR*             ,NO_CONSEC_CRD_READ                                         
MFA-TR*             ,PROGRAM_ID                                                 
MFA-TR*             ,CODE_DISCOUNT                                              
MFA-TR*             ,LAST_VALID_READ_DT                                         
MFA-TR*             ,LAST_VALID_READ_TM                                         
MFA-TR*             ,LAST_VAL_RD_VALUE                                          
MFA-TR*             ,IDR_RECIPIENT_CD                                           
MFA-TR*             ,CODE_LAST_VALID_RD                                         
MFA-TR*             ,REMOTE_READ_IND                                            
MFA-TR*             ,DIGTL_MTR_TYPE                                             
MFA-TR*             ,CODE_MTR_RD_INST1                                          
MFA-TR*             ,CODE_MTR_RD_INST2                                          
MFA-TR*             ,CODE_MTR_RD_INST3                                          
MFA-TR*             ,MTR_READ_SOURCE_CD                                         
MFA-TR*             ,REGISTER_RD_SEQ                                            
MFA-TR*             ,DATE_MTR_INSTALL                                           
MFA-TR*             ,METER_PRESSURE                                             
MFA-TR*             ,CODE_DATA_PRESENT                                          
MFA-TR*         INTO :MN-ACCOUNT-NO                                             
MFA-TR*             ,:MN-CODE-UTIL-TYPE                                         
MFA-TR*             ,:MN-IC-NO                                                  
MFA-TR*             ,:MN-MTR-REF-NO                                             
MFA-TR*             ,:MN-CODE-TIME-PERIOD                                       
MFA-TR*             ,:MN-METER-NO                                               
MFA-TR*             ,:MN-CODE-METER-STATUS                                      
MFA-TR*             ,:MN-EST-USAGE                                              
MFA-TR*             ,:MN-SPCL-MTR-CONDITION                                     
MFA-TR*             ,:MN-CODE-USAGE-TYPE                                        
MFA-TR*             ,:MN-CODE-USAGE-ID                                          
MFA-TR*             ,:MN-CODE-USAGE-SOURCE                                      
MFA-TR*             ,:MN-REG-ID-NO                                              
MFA-TR*             ,:MN-CODE-CRNT-REG-READ                                     
MFA-TR*             ,:MN-CODE-LAST-REG-READ                                     
MFA-TR*             ,:MN-LAST-REG-READ-DATE :WS-NULL-1                          
MFA-TR*             ,:MN-LAST-REG-READ-TIME :WS-NULL-2                          
MFA-TR*             ,:MN-LAST-READ-VALUE                                        
MFA-TR*             ,:MN-NO-CONSEC-ESTIMATE                                     
MFA-TR*             ,:MN-NO-CONSEC-CRD-READ                                     
MFA-TR*             ,:MN-PROGRAM-ID                                             
MFA-TR*             ,:MN-CODE-DISCOUNT                                          
MFA-TR*             ,:MN-LAST-VALID-READ-DT :WS-NULL-3                          
MFA-TR*             ,:MN-LAST-VALID-READ-TM :WS-NULL-4                          
MFA-TR*             ,:MN-LAST-VAL-RD-VALUE                                      
MFA-TR*             ,:MN-IDR-RECIPIENT-CD                                       
MFA-TR*             ,:MN-CODE-LAST-VALID-RD                                     
MFA-TR*             ,:MN-REMOTE-READ-IND                                        
MFA-TR*             ,:MN-DIGTL-MTR-TYPE                                         
MFA-TR*             ,:MN-CODE-MTR-RD-INST1                                      
MFA-TR*             ,:MN-CODE-MTR-RD-INST2                                      
MFA-TR*             ,:MN-CODE-MTR-RD-INST3                                      
MFA-TR*             ,:MN-MTR-READ-SOURCE-CD                                     
MFA-TR*             ,:MN-REGISTER-RD-SEQ                                        
MFA-TR*             ,:MN-DATE-MTR-INSTALL                                       
MFA-TR*             ,:MN-METER-PRESSURE                                         
MFA-TR*             ,:MN-CODE-DATA-PRESENT                                      
MFA-TR*         FROM CSS_MTRD_ENVRNMT                                           
MFA-TR*        WHERE ACCOUNT_NO     =  :MN-ACCOUNT-NO                           
MFA-TR*          AND CODE_UTIL_TYPE =  :MN-CODE-UTIL-TYPE                       
MFA-TR*          AND METER_NO       =  :MN-METER-NO                             
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7150                                                     
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 
                                                           OR -811      
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7150       **'       
               DISPLAY '**      ACCOUNT-NO    = ' MN-ACCOUNT-NO         
               DISPLAY '**      METER-NO      = ' MN-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' MN-CODE-UTIL-TYPE     
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7150-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C29853******************************************************************        
C29853* SELECT METER READ SOURCE                                       *        
C29853******************************************************************        
       7160-SELECT-RD-SOURCE-TX.                                        
      *                                                                         
           EXEC SQL                                                     
              SELECT MTR_READ_SOURCE_TX                                 
                INTO :X7-MTR-READ-SOURCE-TX                             
                FROM CSS_MTR_RD_SOURCE WITH(READUNCOMMITTED)                    
               WHERE MTR_READ_SOURCE_CD = :X7-MTR-READ-SOURCE-CD        
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT MTR_READ_SOURCE_TX                                         
MFA-TR*         INTO :X7-MTR-READ-SOURCE-TX                                     
MFA-TR*         FROM CSS_MTR_RD_SOURCE                                          
MFA-TR*        WHERE MTR_READ_SOURCE_CD = :X7-MTR-READ-SOURCE-CD                
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7160                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7160       **'       
               DISPLAY '**      ACCOUNT-NO    = ' MN-ACCOUNT-NO         
               DISPLAY '**      METER-NO      = ' MN-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' MN-CODE-UTIL-TYPE     
               DISPLAY '**      READ SOURCE   = ' X7-MTR-READ-SOURCE-CD 
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7160-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*================================================================*        
C35066 7170-SELECT-MIDMONTH-WIN.                                        
C35066*================================================================*        
C35066*----------------------------------------------------------------*        
C35066* SELECT OPEN AND CLOSE DATES OF MID-MONTH BILL CYCLE            *        
C35066*  QUERY FINDS READ CYCLE THAT OPENS ON SAME DAY OF MID-MONTH    *        
C35066*  CYCLE AND GET THE CORRESPONDING BILL CYCLE OPEN & CLOSE DATES *        
C35066*----------------------------------------------------------------*        
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066        SELECT MIN(BN.DATE_EXTRACT)                               
C35066              ,MAX(BN.DATE_EXTRACT)                               
C35066         INTO :WS-MIDMONTH-WIN-OPEN-DT :WS-NULL-9                 
C35066             ,:WS-MIDMONTH-WIN-CLOSE-DT :WS-NULL-10                
C35066         FROM CSS_BILL_WINDOW BN WITH(READUNCOMMITTED)                    
C35066             ,CSS_READ_WINDOW RW1 WITH(READUNCOMMITTED)                   
C35066             ,CSS_READ_WINDOW RW2 WITH(READUNCOMMITTED)                   
C35066         WHERE BN.REVENUE_MONTH      = :WS-MIDMONTH-REV-MONTH     
C35066           AND RW1.DATE_MTR_RD_XTRCT = RW2.DATE_MTR_RD_XTRCT      
C35066           AND RW1.REVENUE_MONTH     = RW2.REVENUE_MONTH          
C35066           AND RW1.REVENUE_MONTH     = BN.REVENUE_MONTH           
C35066           AND RW1.READ_CYCLE        = BN.BILL_CYCLE              
C35066           AND RW2.UT_READ_CYCLE     > ' '                        
C35066                                                           
A03352                                                      
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT MIN(BN.DATE_EXTRACT)                                       
MFA-TR*             ,MAX(BN.DATE_EXTRACT)                                       
MFA-TR*        INTO :WS-MIDMONTH-WIN-OPEN-DT :WS-NULL-9                         
MFA-TR*            ,:WS-MIDMONTH-WIN-CLOSE-DT:WS-NULL-10                        
MFA-TR*        FROM CSS_BILL_WINDOW BN                                          
MFA-TR*            ,CSS_READ_WINDOW RW1                                         
MFA-TR*            ,CSS_READ_WINDOW RW2                                         
MFA-TR*        WHERE BN.REVENUE_MONTH      = :WS-MIDMONTH-REV-MONTH             
MFA-TR*          AND RW1.DATE_MTR_RD_XTRCT = RW2.DATE_MTR_RD_XTRCT              
MFA-TR*          AND RW1.REVENUE_MONTH     = RW2.REVENUE_MONTH                  
MFA-TR*          AND RW1.REVENUE_MONTH     = BN.REVENUE_MONTH                   
MFA-TR*          AND RW1.READ_CYCLE        = BN.BILL_CYCLE                      
MFA-TR*          AND RW2.UT_READ_CYCLE     > ' '                                
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7170                                                     
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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
C35066         IF WS-NULL-9 < 0 OR WS-NULL-10 < 0                       
C35066            MOVE SPACES TO WS-MIDMONTH-WIN-OPEN-DT                
C35066            MOVE SPACES TO WS-MIDMONTH-WIN-CLOSE-DT               
C35066         END-IF                                                   
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**   PCSBW143 PROCESSING ERROR      **'         
C35066         DISPLAY '**   ABEND IN PARAGRAPH 7170       **'          
C35066         DISPLAY '**   REV MONTH     = ' WS-MIDMONTH-REV-MONTH    
C35066         DISPLAY '**   UT_READ_CYCLE     > SPACES '               
C35066         DISPLAY '**         SQLCODE = ' WS-ACTIVE-RETURN-CODE    
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 7170-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
      ******************************************************************        
      * SELECT IC DETAILS                                              *        
      ******************************************************************        
       7200-SELECT-UTIL-ENVRNMT.                                        
      *                                                                         
C36317* REMOVED CSS_RATE_PLAN_DESC TABLE JOIN FROM BELOW QUERY AND MADE         
C36317* SEPARATE QUERY TO KNOW SECURE RATES AT ACCOUNT LEVEL                    
C36317*                                                                         
           EXEC SQL                                                     
              SELECT UT.CODE_ESTIMATE_OK                                
                    ,UT.CODE_CURTAIL_PRTY                               
                    ,UT.CODE_REVENUE_CLASS                              
                    ,UT.RATE_PLAN_NO                                    
                    ,UT.CODE_SIC_NO                                     
                    ,UT.CODE_MTR_READ_FREQ                              
                    ,UT.ACCOUNT_NO                                      
                    ,UT.SEASONAL_USE_CODE                               
                    ,UT.READ_CYCLE                                      
                    ,UT.READ_ROUTE                                      
                    ,UT.COMPANY_NO                                      
                    ,UT.CODE_STAT_TAX_XMT                               
                    ,UT.CODE_CITY_TAX_XMT                               
                    ,UT.CODE_OTHR_TAX_XMT                               
                INTO :UT-CODE-ESTIMATE-OK                               
                    ,:UT-CODE-CURTAIL-PRTY                              
                    ,:UT-CODE-REVENUE-CLASS                             
                    ,:UT-RATE-PLAN-NO                                   
                    ,:UT-CODE-SIC-NO                                    
                    ,:UT-CODE-MTR-READ-FREQ                             
                    ,:UT-ACCOUNT-NO                                     
                    ,:UT-SEASONAL-USE-CODE                              
                    ,:UT-READ-CYCLE                                     
                    ,:UT-READ-ROUTE                                     
                    ,:UT-COMPANY-NO                                     
                    ,:UT-CODE-STAT-TAX-XMT                              
                    ,:UT-CODE-CITY-TAX-XMT                              
                    ,:UT-CODE-OTHR-TAX-XMT                              
                FROM CSS_UTIL_ENVRNMT   UT WITH(READUNCOMMITTED)                
               WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                 
                 AND UT.CODE_UTIL_TYPE = :UT-CODE-UTIL-TYPE             
                 AND UT.IC_NO          = :UT-IC-NO                      
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT UT.CODE_ESTIMATE_OK                                        
MFA-TR*             ,UT.CODE_CURTAIL_PRTY                                       
MFA-TR*             ,UT.CODE_REVENUE_CLASS                                      
MFA-TR*             ,UT.RATE_PLAN_NO                                            
MFA-TR*             ,UT.CODE_SIC_NO                                             
MFA-TR*             ,UT.CODE_MTR_READ_FREQ                                      
MFA-TR*             ,UT.ACCOUNT_NO                                              
MFA-TR*             ,UT.SEASONAL_USE_CODE                                       
MFA-TR*             ,UT.READ_CYCLE                                              
MFA-TR*             ,UT.READ_ROUTE                                              
MFA-TR*             ,UT.COMPANY_NO                                              
MFA-TR*             ,UT.CODE_STAT_TAX_XMT                                       
MFA-TR*             ,UT.CODE_CITY_TAX_XMT                                       
MFA-TR*             ,UT.CODE_OTHR_TAX_XMT                                       
MFA-TR*         INTO :UT-CODE-ESTIMATE-OK                                       
MFA-TR*             ,:UT-CODE-CURTAIL-PRTY                                      
MFA-TR*             ,:UT-CODE-REVENUE-CLASS                                     
MFA-TR*             ,:UT-RATE-PLAN-NO                                           
MFA-TR*             ,:UT-CODE-SIC-NO                                            
MFA-TR*             ,:UT-CODE-MTR-READ-FREQ                                     
MFA-TR*             ,:UT-ACCOUNT-NO                                             
MFA-TR*             ,:UT-SEASONAL-USE-CODE                                      
MFA-TR*             ,:UT-READ-CYCLE                                             
MFA-TR*             ,:UT-READ-ROUTE                                             
MFA-TR*             ,:UT-COMPANY-NO                                             
MFA-TR*             ,:UT-CODE-STAT-TAX-XMT                                      
MFA-TR*             ,:UT-CODE-CITY-TAX-XMT                                      
MFA-TR*             ,:UT-CODE-OTHR-TAX-XMT                                      
MFA-TR*         FROM CSS_UTIL_ENVRNMT   UT                                      
MFA-TR*        WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                         
MFA-TR*          AND UT.CODE_UTIL_TYPE = :UT-CODE-UTIL-TYPE                     
MFA-TR*          AND UT.IC_NO          = :UT-IC-NO                              
MFA-TR*        WITH UR                                                          
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7200       **'       
               DISPLAY '**      ACCOUNT-NO    = ' UT-ACCOUNT-NO         
               DISPLAY '**      IC-NO         = ' UT-IC-NO              
               DISPLAY '**      UTIL TYPE     = ' UT-CODE-UTIL-TYPE     
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7200-EXIT.                                                       
           EXIT.                                                        
C36317*                                                                         
C36317*================================================================*        
C36317 7205-SELECT-UTIL-SECU-RATE.                                      
C36317*================================================================*        
C36317* SELECT TO KNOW IF ANY SECURE RATE FROM ALL IC'S OF ACCOUNT     *        
C36317*----------------------------------------------------------------*        
C36317*                                                                         
C36317     EXEC SQL                                                     
C36317        SELECT TOP(1) 'Y'                                                
C36317          INTO :WS-SECURED-RATE-FL                                
C36317          FROM CSS_UTIL_ENVRNMT   UT WITH(READUNCOMMITTED)                
C36317              ,CSS_RATE_PLAN_DESC RD WITH(READUNCOMMITTED)                
C36317         WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                 
C36317           AND UT.CODE_UTIL_TYPE IN ('E', 'G')                    
C36317           AND RD.CODE_UTIL_TYPE = UT.CODE_UTIL_TYPE              
C36317           AND RD.RATE_PLAN_NO   = UT.RATE_PLAN_NO                
C36317           AND RD.SECURED_RATE_FL = 'Y'                           
C36317                                       
A03352                                                      
C36317     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-SECURED-RATE-FL                                        
MFA-TR*         FROM CSS_UTIL_ENVRNMT   UT                                      
MFA-TR*             ,CSS_RATE_PLAN_DESC RD                                      
MFA-TR*        WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                         
MFA-TR*          AND UT.CODE_UTIL_TYPE IN ('E', 'G')                            
MFA-TR*          AND RD.CODE_UTIL_TYPE = UT.CODE_UTIL_TYPE                      
MFA-TR*          AND RD.RATE_PLAN_NO   = UT.RATE_PLAN_NO                        
MFA-TR*          AND RD.SECURED_RATE_FL = 'Y'                                   
MFA-TR*        FETCH FIRST ROW ONLY WITH UR                                     
MFA-TR*        QUERYNO 7205                                                     
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

C36317*                                                                         
C36317     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C36317*                                                                         
C36317     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
C36317         CONTINUE                                                 
C36317     ELSE                                                         
C36317         DISPLAY '****************************************'       
C36317         DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
C36317         DISPLAY '**      ABEND IN PARAGRAPH 7205       **'       
C36317         DISPLAY '**      ACCOUNT-NO    = ' UT-ACCOUNT-NO         
C36317         DISPLAY '**      UTIL TYPE     IN (E, G)       **'       
C36317         DISPLAY '**      SECURED_RATE_FL =  Y          **'       
C36317         DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
C36317         DISPLAY '****************************************'       
C36317         PERFORM 9900-ABEND THRU 9900-EXIT                        
C36317     END-IF.                                                      
C36317*                                                                         
C36317 7205-EXIT.                                                       
C36317     EXIT.                                                        
C36317*                                                                         
      ******************************************************************        
      * SELECT RATE VERSION                                            *        
      ******************************************************************        
       7210-SELECT-RATE-VERSION.                                        
      *                                                                         
           EXEC SQL                                                     
               SELECT VERSION_NO_CNTRL                                  
                 INTO :RT-VERSION-NO-CNTRL                              
                 FROM CSS_RATE_CREATOR WITH(READUNCOMMITTED)                    
                WHERE CODE_UTIL_TYPE    = :RT-CODE-UTIL-TYPE            
                  AND RATE_PLAN_NO      = :RT-RATE-PLAN-NO              
                  AND CODE_STATUS       = :WS-ACTIVE                    
                  AND FROM_EFFECTIVE_DT =                               
                     (SELECT MAX (FROM_EFFECTIVE_DT)                    
                       FROM CSS_RATE_CREATOR WITH(READUNCOMMITTED)              
                      WHERE CODE_UTIL_TYPE    = :RT-CODE-UTIL-TYPE      
                        AND RATE_PLAN_NO      = :RT-RATE-PLAN-NO        
                        AND CODE_STATUS       = :WS-ACTIVE              
                        AND FROM_EFFECTIVE_DT <= IIF(TRY_CONVERT(DATE, 
                                                  :RT-FROM-EFFECTIVE-DT
              ) IS NULL OR (PATINDEX('%.%', :RT-FROM-EFFECTIVE-DT
              ) <> 0) OR (LEN(:RT-FROM-EFFECTIVE-DT
              ) <> 10), CIS.CHAR2DATE(:RT-FROM-EFFECTIVE-DT
              ), CONVERT(DATE, :RT-FROM-EFFECTIVE-DT) )) 
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT VERSION_NO_CNTRL                                          
MFA-TR*          INTO :RT-VERSION-NO-CNTRL                                      
MFA-TR*          FROM CSS_RATE_CREATOR                                          
MFA-TR*         WHERE CODE_UTIL_TYPE    = :RT-CODE-UTIL-TYPE                    
MFA-TR*           AND RATE_PLAN_NO      = :RT-RATE-PLAN-NO                      
MFA-TR*           AND CODE_STATUS       = :WS-ACTIVE                            
MFA-TR*           AND FROM_EFFECTIVE_DT =                                       
MFA-TR*              (SELECT MAX (FROM_EFFECTIVE_DT)                            
MFA-TR*                FROM CSS_RATE_CREATOR                                    
MFA-TR*               WHERE CODE_UTIL_TYPE    = :RT-CODE-UTIL-TYPE              
MFA-TR*                 AND RATE_PLAN_NO      = :RT-RATE-PLAN-NO                
MFA-TR*                 AND CODE_STATUS       = :WS-ACTIVE                      
MFA-TR*                 AND FROM_EFFECTIVE_DT <= :RT-FROM-EFFECTIVE-DT)         
MFA-TR*         WITH UR                                                         
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7210       **'       
               DISPLAY '**      RATE          = ' RT-RATE-PLAN-NO       
               DISPLAY '**      EFFECTIVE DATE= ' RT-FROM-EFFECTIVE-DT  
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7210-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT SEASON DETAILS                                          *        
      ******************************************************************        
       7220-SELECT-SEASONS.                                             
      *                                                                         
           EXEC SQL                                                     
               SELECT DATE_FROM                                         
                     ,DATE_TO                                           
                     ,CODE_SEASON                                       
                 INTO :RS-DATE-FROM                                     
                     ,:RS-DATE-TO                                       
                     ,:RS-CODE-SEASON                                   
                 FROM CSS_RATE_USE_SEASN WITH(READUNCOMMITTED)                  
                WHERE CODE_UTIL_TYPE   = :RS-CODE-UTIL-TYPE             
                  AND RATE_PLAN_NO     = :RS-RATE-PLAN-NO               
                  AND VERSION_NO_CNTRL = :RS-VERSION-NO-CNTRL           
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT DATE_FROM                                                 
MFA-TR*              ,DATE_TO                                                   
MFA-TR*              ,CODE_SEASON                                               
MFA-TR*          INTO :RS-DATE-FROM                                             
MFA-TR*              ,:RS-DATE-TO                                               
MFA-TR*              ,:RS-CODE-SEASON                                           
MFA-TR*          FROM CSS_RATE_USE_SEASN                                        
MFA-TR*         WHERE CODE_UTIL_TYPE   = :RS-CODE-UTIL-TYPE                     
MFA-TR*           AND RATE_PLAN_NO     = :RS-RATE-PLAN-NO                       
MFA-TR*           AND VERSION_NO_CNTRL = :RS-VERSION-NO-CNTRL                   
MFA-TR*         WITH UR                                                         
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7220       **'       
               DISPLAY '**      RATE          = ' RS-RATE-PLAN-NO       
               DISPLAY '**      VERSION-NO    = ' RS-VERSION-NO-CNTRL   
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7220-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT SEASONAL PRORATE TYPE                                   *        
      ******************************************************************        
       7230-GET-SEASN-PRT-TYPE.                                         
      *                                                                         
           EXEC SQL                                                     
               SELECT SEAS_PRORATE_CD                                   
                 INTO :J4-SEAS-PRORATE-CD                               
                 FROM CSS_RATE_VRSN_DEF WITH(READUNCOMMITTED)                   
                WHERE CODE_UTIL_TYPE   = :J4-CODE-UTIL-TYPE             
                  AND RATE_PLAN_NO     = :J4-RATE-PLAN-NO               
                  AND VERSION_NO_CNTRL = :J4-VERSION-NO-CNTRL           
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT SEAS_PRORATE_CD                                           
MFA-TR*          INTO :J4-SEAS-PRORATE-CD                                       
MFA-TR*          FROM CSS_RATE_VRSN_DEF                                         
MFA-TR*         WHERE CODE_UTIL_TYPE   = :J4-CODE-UTIL-TYPE                     
MFA-TR*           AND RATE_PLAN_NO     = :J4-RATE-PLAN-NO                       
MFA-TR*           AND VERSION_NO_CNTRL = :J4-VERSION-NO-CNTRL                   
MFA-TR*         WITH UR                                                         
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.    
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7230       **'       
               DISPLAY '**      RATE          = ' J4-RATE-PLAN-NO       
               DISPLAY '**      VERSION-NO    = ' J4-VERSION-NO-CNTRL   
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7230-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*================================================================*        
C35066 7240-OPEN-ROUTE-REPORT.                                          
C35066*================================================================*        
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066         OPEN ROUTE_REPORT                                        
C35066     END-EXEC.                                                    

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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
C35066         CONTINUE                                                 
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
C35066         DISPLAY '**  ABEND IN 7240-OPEN-ROUTE-REPORT   **'       
C35066         DISPLAY '*** SQLCODE = ' WS-ACTIVE-RETURN-CODE           
C35066         DISPLAY '** ACCOUNT_NO       = ' PW-ACCOUNT-NO           
C35066         DISPLAY '** REVENUE_MONTH    = ' PW-REVENUE-MONTH        
C35066         DISPLAY '** CODE_UTIL_TYPE   = ' PW-CODE-UTIL-TYPE       
C35066         DISPLAY '** IC_NO            = ' PW-IC-NO                
C35066         DISPLAY '** METER_NO         = ' PW-METER-NO             
C35066         DISPLAY '** REG_MEASURE_CD   = ' PW-REG-MEASURE-CD       
C35066         DISPLAY '** CODE_TIME_PERIOD = ' PW-CODE-TIME-PERIOD     
C35066         DISPLAY '** CODE_TOU_SEASN   = ' PW-CODE-TOU-SEASN       
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 7240-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
C35066*================================================================*        
C35066 7250-FETCH-ROUTE-REPORT.                                         
C35066*================================================================*        
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066          FETCH ROUTE_REPORT                                      
C35066           INTO :WS-REG-MEASURE-CD                                
C35066               ,:WS-LAST-REG-READ-DT                              
C35066               ,:WS-LAST-REG-READ-TM                              
C35066               ,:WS-TYPE-OF-RD-IND                                
C35066               ,:WS-READING-COND-CD                               
C36533               ,:WS-READING-CODE                                  
C35066     END-EXEC.                                                    

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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
C35066         CONTINUE                                                 
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
C35066         DISPLAY '** ABEND IN 7250-FETCH-ROUTE-REPORT   **'       
C35066         DISPLAY '*** SQLCODE = ' WS-ACTIVE-RETURN-CODE           
C35066         DISPLAY '** ACCOUNT_NO       = ' PW-ACCOUNT-NO           
C35066         DISPLAY '** REVENUE_MONTH    = ' PW-REVENUE-MONTH        
C35066         DISPLAY '** CODE_UTIL_TYPE   = ' PW-CODE-UTIL-TYPE       
C35066         DISPLAY '** IC_NO            = ' PW-IC-NO                
C35066         DISPLAY '** METER_NO         = ' PW-METER-NO             
C35066         DISPLAY '** REG_MEASURE_CD   = ' PW-REG-MEASURE-CD       
C35066         DISPLAY '** CODE_TIME_PERIOD = ' PW-CODE-TIME-PERIOD     
C35066         DISPLAY '** CODE_TOU_SEASN   = ' PW-CODE-TOU-SEASN       
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 7250-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
C35066*================================================================*        
C35066 7260-CLOSE-ROUTE-REPORT.                                         
C35066*================================================================*        
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066         CLOSE ROUTE_REPORT                                       
C35066     END-EXEC.                                                    

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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
C35066         CONTINUE                                                 
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
C35066         DISPLAY '** ABEND IN 7260-CLOSE-ROUTE-REPORT   **'       
C35066         DISPLAY '*** SQLCODE = ' WS-ACTIVE-RETURN-CODE           
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 7260-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
      ******************************************************************        
      * SELECT METER  DETAILS                                          *        
      ******************************************************************        
       7300-SELECT-MN.                                                  
      *                                                                         
           EXEC SQL                                                     
              SELECT ACCOUNT_NO                                         
                    ,CODE_UTIL_TYPE                                     
                    ,IC_NO                                              
                    ,MTR_REF_NO                                         
                    ,CODE_TIME_PERIOD                                   
                    ,METER_NO                                           
                    ,CODE_METER_STATUS                                  
                    ,EST_USAGE                                          
                    ,SPCL_MTR_CONDITION                                 
                    ,CODE_USAGE_TYPE                                    
                    ,CODE_USAGE_SOURCE                                  
                    ,REG_ID_NO                                          
                    ,CODE_NO_RD_REASON                                  
                    ,CODE_CRNT_REG_READ                                 
                    ,CODE_LAST_REG_READ                                 
                    ,LAST_REG_READ_DATE                                 
                    ,REPLACE(CONVERT(CHAR(8), LAST_REG_READ_TIME, 108), 
           ':', '.') LAST_REG_READ_TIME                                 
                    ,LAST_READ_VALUE                                    
                    ,NO_CONSEC_ESTIMATE                                 
                    ,NO_CONSEC_CRD_READ                                 
                    ,PROGRAM_ID                                         
                    ,CODE_DISCOUNT                                      
                    ,LAST_VALID_READ_DT                                 
                    ,REPLACE(CONVERT(CHAR(8), LAST_VALID_READ_TM, 108), 
           ':', '.') LAST_VALID_READ_TM                                 
                    ,LAST_VAL_RD_VALUE                                  
                    ,IDR_RECIPIENT_CD                                   
                    ,CODE_LAST_VALID_RD                                 
                    ,REMOTE_READ_IND                                    
                    ,DIGTL_MTR_TYPE                                     
                    ,CODE_MTR_RD_INST1                                  
                    ,CODE_MTR_RD_INST2                                  
                    ,CODE_MTR_RD_INST3                                  
                    ,MTR_READ_SOURCE_CD                                 
                    ,REGISTER_RD_SEQ                                    
                    ,DATE_MTR_INSTALL                                   
30989               ,METER_PRESSURE                                     
ACT068              ,CODE_DATA_PRESENT                                  
                INTO :MN-ACCOUNT-NO                                     
                    ,:MN-CODE-UTIL-TYPE                                 
                    ,:MN-IC-NO                                          
                    ,:MN-MTR-REF-NO                                     
                    ,:MN-CODE-TIME-PERIOD                               
                    ,:MN-METER-NO                                       
                    ,:MN-CODE-METER-STATUS                              
                    ,:MN-EST-USAGE                                      
                    ,:MN-SPCL-MTR-CONDITION                             
                    ,:MN-CODE-USAGE-TYPE                                
                    ,:MN-CODE-USAGE-SOURCE                              
                    ,:MN-REG-ID-NO                                      
                    ,:MN-CODE-NO-RD-REASON                              
                    ,:MN-CODE-CRNT-REG-READ                             
                    ,:MN-CODE-LAST-REG-READ                             
                    ,:MN-LAST-REG-READ-DATE :WS-NULL-1                  
                    ,:MN-LAST-REG-READ-TIME :WS-NULL-2                  
                    ,:MN-LAST-READ-VALUE                                
                    ,:MN-NO-CONSEC-ESTIMATE                             
                    ,:MN-NO-CONSEC-CRD-READ                             
                    ,:MN-PROGRAM-ID                                     
                    ,:MN-CODE-DISCOUNT                                  
                    ,:MN-LAST-VALID-READ-DT :WS-NULL-3                  
                    ,:MN-LAST-VALID-READ-TM :WS-NULL-4                  
                    ,:MN-LAST-VAL-RD-VALUE                              
                    ,:MN-IDR-RECIPIENT-CD                               
                    ,:MN-CODE-LAST-VALID-RD                             
                    ,:MN-REMOTE-READ-IND                                
                    ,:MN-DIGTL-MTR-TYPE                                 
                    ,:MN-CODE-MTR-RD-INST1                              
                    ,:MN-CODE-MTR-RD-INST2                              
                    ,:MN-CODE-MTR-RD-INST3                              
                    ,:MN-MTR-READ-SOURCE-CD                             
                    ,:MN-REGISTER-RD-SEQ                                
                    ,:MN-DATE-MTR-INSTALL                               
30989               ,:MN-METER-PRESSURE                                 
ACT068              ,:MN-CODE-DATA-PRESENT                              
                FROM CSS_MTRD_ENVRNMT WITH(READUNCOMMITTED)                     
               WHERE ACCOUNT_NO       =  :MN-ACCOUNT-NO                 
                 AND CODE_UTIL_TYPE   =  :MN-CODE-UTIL-TYPE             
                 AND METER_NO         =  :MN-METER-NO                   
                 AND IC_NO            =  :MN-IC-NO                      
                 AND MTR_REF_NO       =  :MN-MTR-REF-NO                 
                 AND CODE_USAGE_TYPE  =  :MN-CODE-USAGE-TYPE            
                 AND CODE_TIME_PERIOD =  :MN-CODE-TIME-PERIOD           
P00251           AND CODE_USAGE_ID    =  :MN-CODE-USAGE-ID              
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT ACCOUNT_NO                                                 
MFA-TR*             ,CODE_UTIL_TYPE                                             
MFA-TR*             ,IC_NO                                                      
MFA-TR*             ,MTR_REF_NO                                                 
MFA-TR*             ,CODE_TIME_PERIOD                                           
MFA-TR*             ,METER_NO                                                   
MFA-TR*             ,CODE_METER_STATUS                                          
MFA-TR*             ,EST_USAGE                                                  
MFA-TR*             ,SPCL_MTR_CONDITION                                         
MFA-TR*             ,CODE_USAGE_TYPE                                            
MFA-TR*             ,CODE_USAGE_SOURCE                                          
MFA-TR*             ,REG_ID_NO                                                  
MFA-TR*             ,CODE_NO_RD_REASON                                          
MFA-TR*             ,CODE_CRNT_REG_READ                                         
MFA-TR*             ,CODE_LAST_REG_READ                                         
MFA-TR*             ,LAST_REG_READ_DATE                                         
MFA-TR*             ,LAST_REG_READ_TIME                                         
MFA-TR*             ,LAST_READ_VALUE                                            
MFA-TR*             ,NO_CONSEC_ESTIMATE                                         
MFA-TR*             ,NO_CONSEC_CRD_READ                                         
MFA-TR*             ,PROGRAM_ID                                                 
MFA-TR*             ,CODE_DISCOUNT                                              
MFA-TR*             ,LAST_VALID_READ_DT                                         
MFA-TR*             ,LAST_VALID_READ_TM                                         
MFA-TR*             ,LAST_VAL_RD_VALUE                                          
MFA-TR*             ,IDR_RECIPIENT_CD                                           
MFA-TR*             ,CODE_LAST_VALID_RD                                         
MFA-TR*             ,REMOTE_READ_IND                                            
MFA-TR*             ,DIGTL_MTR_TYPE                                             
MFA-TR*             ,CODE_MTR_RD_INST1                                          
MFA-TR*             ,CODE_MTR_RD_INST2                                          
MFA-TR*             ,CODE_MTR_RD_INST3                                          
MFA-TR*             ,MTR_READ_SOURCE_CD                                         
MFA-TR*             ,REGISTER_RD_SEQ                                            
MFA-TR*             ,DATE_MTR_INSTALL                                           
MFA-TR*             ,METER_PRESSURE                                             
MFA-TR*             ,CODE_DATA_PRESENT                                          
MFA-TR*         INTO :MN-ACCOUNT-NO                                             
MFA-TR*             ,:MN-CODE-UTIL-TYPE                                         
MFA-TR*             ,:MN-IC-NO                                                  
MFA-TR*             ,:MN-MTR-REF-NO                                             
MFA-TR*             ,:MN-CODE-TIME-PERIOD                                       
MFA-TR*             ,:MN-METER-NO                                               
MFA-TR*             ,:MN-CODE-METER-STATUS                                      
MFA-TR*             ,:MN-EST-USAGE                                              
MFA-TR*             ,:MN-SPCL-MTR-CONDITION                                     
MFA-TR*             ,:MN-CODE-USAGE-TYPE                                        
MFA-TR*             ,:MN-CODE-USAGE-SOURCE                                      
MFA-TR*             ,:MN-REG-ID-NO                                              
MFA-TR*             ,:MN-CODE-NO-RD-REASON                                      
MFA-TR*             ,:MN-CODE-CRNT-REG-READ                                     
MFA-TR*             ,:MN-CODE-LAST-REG-READ                                     
MFA-TR*             ,:MN-LAST-REG-READ-DATE :WS-NULL-1                          
MFA-TR*             ,:MN-LAST-REG-READ-TIME :WS-NULL-2                          
MFA-TR*             ,:MN-LAST-READ-VALUE                                        
MFA-TR*             ,:MN-NO-CONSEC-ESTIMATE                                     
MFA-TR*             ,:MN-NO-CONSEC-CRD-READ                                     
MFA-TR*             ,:MN-PROGRAM-ID                                             
MFA-TR*             ,:MN-CODE-DISCOUNT                                          
MFA-TR*             ,:MN-LAST-VALID-READ-DT :WS-NULL-3                          
MFA-TR*             ,:MN-LAST-VALID-READ-TM :WS-NULL-4                          
MFA-TR*             ,:MN-LAST-VAL-RD-VALUE                                      
MFA-TR*             ,:MN-IDR-RECIPIENT-CD                                       
MFA-TR*             ,:MN-CODE-LAST-VALID-RD                                     
MFA-TR*             ,:MN-REMOTE-READ-IND                                        
MFA-TR*             ,:MN-DIGTL-MTR-TYPE                                         
MFA-TR*             ,:MN-CODE-MTR-RD-INST1                                      
MFA-TR*             ,:MN-CODE-MTR-RD-INST2                                      
MFA-TR*             ,:MN-CODE-MTR-RD-INST3                                      
MFA-TR*             ,:MN-MTR-READ-SOURCE-CD                                     
MFA-TR*             ,:MN-REGISTER-RD-SEQ                                        
MFA-TR*             ,:MN-DATE-MTR-INSTALL                                       
MFA-TR*             ,:MN-METER-PRESSURE                                         
MFA-TR*             ,:MN-CODE-DATA-PRESENT                                      
MFA-TR*         FROM CSS_MTRD_ENVRNMT                                           
MFA-TR*        WHERE ACCOUNT_NO       =  :MN-ACCOUNT-NO                         
MFA-TR*          AND CODE_UTIL_TYPE   =  :MN-CODE-UTIL-TYPE                     
MFA-TR*          AND METER_NO         =  :MN-METER-NO                           
MFA-TR*          AND IC_NO            =  :MN-IC-NO                              
MFA-TR*          AND MTR_REF_NO       =  :MN-MTR-REF-NO                         
MFA-TR*          AND CODE_USAGE_TYPE  =  :MN-CODE-USAGE-TYPE                    
MFA-TR*          AND CODE_TIME_PERIOD =  :MN-CODE-TIME-PERIOD                   
MFA-TR*          AND CODE_USAGE_ID    =  :MN-CODE-USAGE-ID                      
MFA-TR*        WITH UR                                                          
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7300       **'       
               DISPLAY '**      ACCOUNT-NO    = ' MN-ACCOUNT-NO         
               DISPLAY '**      METER-NO      = ' MN-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' MN-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' MN-IC-NO              
               DISPLAY '**      MTR-REF-NO    = ' MN-MTR-REF-NO         
               DISPLAY '**      USAGE TYPE    = ' MN-CODE-USAGE-TYPE    
               DISPLAY '**      TIME PERIOD   = ' MN-CODE-TIME-PERIOD   
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7300-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT REGISTER DETAILS                                        *        
      ******************************************************************        
       7310-SELECT-RG.                                                  
      *                                                                         
           EXEC SQL                                                     
              SELECT CODE_UTIL_TYPE                                     
                    ,IC_NO                                              
                    ,MTR_REF_NO                                         
                    ,REG_ID_NO                                          
                    ,METER_NO                                           
                    ,CODE_USAGE_TYPE                                    
                    ,CODE_USAGE_SOURCE                                  
                    ,CODE_TIME_PERIOD                                   
                    ,REGISTER_RD_SEQ                                    
                    ,CODE_REG_STATUS                                    
                    ,CODE_STATUS_REAS                                   
                    ,CODE_LAST_REG_READ                                 
                    ,LAST_REG_READ_DT                                   
                    ,REPLACE(CONVERT(CHAR(8), LAST_REG_READ_TM, 108), 
           ':', '.') LAST_REG_READ_TM                                   
                    ,LAST_READ_VALUE                                    
                    ,CODE_CRNT_REG_READ                                 
                    ,CODE_NO_RD_REASON                                  
                    ,CODE_LAST_VALID_RD                                 
                    ,REPLACE(CONVERT(CHAR(8), LAST_VALID_READ_TM, 108), 
           ':', '.') LAST_VALID_READ_TM                                 
                    ,LAST_VALID_READ_DT                                 
                    ,LAST_VAL_RD_VALUE                                  
                    ,REGISTER_RD_SEQ                                    
                INTO :RG-CODE-UTIL-TYPE                                 
                    ,:RG-IC-NO                                          
                    ,:RG-MTR-REF-NO                                     
                    ,:RG-REG-ID-NO                                      
                    ,:RG-METER-NO                                       
                    ,:RG-CODE-USAGE-TYPE                                
                    ,:RG-CODE-USAGE-SOURCE                              
                    ,:RG-CODE-TIME-PERIOD                               
                    ,:RG-REGISTER-RD-SEQ                                
                    ,:RG-CODE-REG-STATUS                                
                    ,:RG-CODE-STATUS-REAS                               
                    ,:RG-CODE-LAST-REG-READ                             
                    ,:RG-LAST-REG-READ-DT :WS-NULL-5                    
                    ,:RG-LAST-REG-READ-TM :WS-NULL-6                    
                    ,:RG-LAST-READ-VALUE                                
                    ,:RG-CODE-CRNT-REG-READ                             
                    ,:RG-CODE-NO-RD-REASON                              
                    ,:RG-CODE-LAST-VALID-RD                             
                    ,:RG-LAST-VALID-READ-TM :WS-NULL-7                  
                    ,:RG-LAST-VALID-READ-DT :WS-NULL-8                  
                    ,:RG-LAST-VAL-RD-VALUE                              
                    ,:RG-REGISTER-RD-SEQ                                
                FROM CSS_REGISTER_READ WITH(READUNCOMMITTED)                    
               WHERE ACCOUNT_NO        = :RG-ACCOUNT-NO                 
                 AND CODE_UTIL_TYPE    = :RG-CODE-UTIL-TYPE             
                 AND IC_NO             = :RG-IC-NO                      
                 AND MTR_REF_NO        = :RG-MTR-REF-NO                 
                 AND METER_NO          = :RG-METER-NO                   
                 AND CODE_USAGE_TYPE   = :RG-CODE-USAGE-TYPE            
                 AND CODE_TIME_PERIOD  = :RG-CODE-TIME-PERIOD           
P00251           AND CODE_USAGE_ID    =  :RG-CODE-USAGE-ID              
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT CODE_UTIL_TYPE                                             
MFA-TR*             ,IC_NO                                                      
MFA-TR*             ,MTR_REF_NO                                                 
MFA-TR*             ,REG_ID_NO                                                  
MFA-TR*             ,METER_NO                                                   
MFA-TR*             ,CODE_USAGE_TYPE                                            
MFA-TR*             ,CODE_USAGE_SOURCE                                          
MFA-TR*             ,CODE_TIME_PERIOD                                           
MFA-TR*             ,REGISTER_RD_SEQ                                            
MFA-TR*             ,CODE_REG_STATUS                                            
MFA-TR*             ,CODE_STATUS_REAS                                           
MFA-TR*             ,CODE_LAST_REG_READ                                         
MFA-TR*             ,LAST_REG_READ_DT                                           
MFA-TR*             ,LAST_REG_READ_TM                                           
MFA-TR*             ,LAST_READ_VALUE                                            
MFA-TR*             ,CODE_CRNT_REG_READ                                         
MFA-TR*             ,CODE_NO_RD_REASON                                          
MFA-TR*             ,CODE_LAST_VALID_RD                                         
MFA-TR*             ,LAST_VALID_READ_TM                                         
MFA-TR*             ,LAST_VALID_READ_DT                                         
MFA-TR*             ,LAST_VAL_RD_VALUE                                          
MFA-TR*             ,REGISTER_RD_SEQ                                            
MFA-TR*         INTO :RG-CODE-UTIL-TYPE                                         
MFA-TR*             ,:RG-IC-NO                                                  
MFA-TR*             ,:RG-MTR-REF-NO                                             
MFA-TR*             ,:RG-REG-ID-NO                                              
MFA-TR*             ,:RG-METER-NO                                               
MFA-TR*             ,:RG-CODE-USAGE-TYPE                                        
MFA-TR*             ,:RG-CODE-USAGE-SOURCE                                      
MFA-TR*             ,:RG-CODE-TIME-PERIOD                                       
MFA-TR*             ,:RG-REGISTER-RD-SEQ                                        
MFA-TR*             ,:RG-CODE-REG-STATUS                                        
MFA-TR*             ,:RG-CODE-STATUS-REAS                                       
MFA-TR*             ,:RG-CODE-LAST-REG-READ                                     
MFA-TR*             ,:RG-LAST-REG-READ-DT :WS-NULL-5                            
MFA-TR*             ,:RG-LAST-REG-READ-TM :WS-NULL-6                            
MFA-TR*             ,:RG-LAST-READ-VALUE                                        
MFA-TR*             ,:RG-CODE-CRNT-REG-READ                                     
MFA-TR*             ,:RG-CODE-NO-RD-REASON                                      
MFA-TR*             ,:RG-CODE-LAST-VALID-RD                                     
MFA-TR*             ,:RG-LAST-VALID-READ-TM :WS-NULL-7                          
MFA-TR*             ,:RG-LAST-VALID-READ-DT :WS-NULL-8                          
MFA-TR*             ,:RG-LAST-VAL-RD-VALUE                                      
MFA-TR*             ,:RG-REGISTER-RD-SEQ                                        
MFA-TR*         FROM CSS_REGISTER_READ                                          
MFA-TR*        WHERE ACCOUNT_NO        = :RG-ACCOUNT-NO                         
MFA-TR*          AND CODE_UTIL_TYPE    = :RG-CODE-UTIL-TYPE                     
MFA-TR*          AND IC_NO             = :RG-IC-NO                              
MFA-TR*          AND MTR_REF_NO        = :RG-MTR-REF-NO                         
MFA-TR*          AND METER_NO          = :RG-METER-NO                           
MFA-TR*          AND CODE_USAGE_TYPE   = :RG-CODE-USAGE-TYPE                    
MFA-TR*          AND CODE_TIME_PERIOD  = :RG-CODE-TIME-PERIOD                   
MFA-TR*          AND CODE_USAGE_ID    =  :RG-CODE-USAGE-ID                      
MFA-TR*        WITH UR                                                          
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7310       **'       
               DISPLAY '**      ACCOUNT-NO    = ' RG-ACCOUNT-NO         
               DISPLAY '**      METER-NO      = ' RG-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' RG-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' RG-IC-NO              
               DISPLAY '**      MTR-REF-NO    = ' RG-MTR-REF-NO         
               DISPLAY '**      USAGE TYPE    = ' RG-CODE-USAGE-TYPE    
               DISPLAY '**      TIME PERIOD   = ' RG-CODE-TIME-PERIOD   
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7310-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT METER CAP DETAILS                                       *        
      ******************************************************************        
       7320-SELECT-MTR-CAP.                                             
           EXEC SQL                                                     
               SELECT CONSTANT                                          
                     ,NO_READ_DIALS                                     
                     ,K_Q_LEAD_LAG_IND                                  
                     ,FULL_SCALE                                        
                 INTO :MC-CONSTANT                                      
                     ,:MC-NO-READ-DIALS                                 
                     ,:MC-K-Q-LEAD-LAG-IND                              
                     ,:MC-FULL-SCALE                                    
                 FROM CSS_MTR_CAP WITH(READUNCOMMITTED)                         
                WHERE CODE_UTIL_TYPE = :MC-CODE-UTIL-TYPE               
                  AND COMPANY_NO     = :MC-COMPANY-NO                   
                  AND METER_NO       = :MC-METER-NO                     
                  AND REG_ID_NO      = :MC-REG-ID-NO                    
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT CONSTANT                                                  
MFA-TR*              ,NO_READ_DIALS                                             
MFA-TR*              ,K_Q_LEAD_LAG_IND                                          
MFA-TR*              ,FULL_SCALE                                                
MFA-TR*          INTO :MC-CONSTANT                                              
MFA-TR*              ,:MC-NO-READ-DIALS                                         
MFA-TR*              ,:MC-K-Q-LEAD-LAG-IND                                      
MFA-TR*              ,:MC-FULL-SCALE                                            
MFA-TR*          FROM CSS_MTR_CAP                                               
MFA-TR*         WHERE CODE_UTIL_TYPE = :MC-CODE-UTIL-TYPE                       
MFA-TR*           AND COMPANY_NO     = :MC-COMPANY-NO                           
MFA-TR*           AND METER_NO       = :MC-METER-NO                             
MFA-TR*           AND REG_ID_NO      = :MC-REG-ID-NO                            
MFA-TR*         WITH UR                                                         
MFA-TR*        QUERYNO 7320                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7320       **'       
               DISPLAY '**      COMPANY-NO    = ' MC-COMPANY-NO         
               DISPLAY '**      METER-NO      = ' MC-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' MC-CODE-UTIL-TYPE     
               DISPLAY '**      REG-ID-NO     = ' MC-REG-ID-NO          
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7320-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT METER CONSTANT                                          *        
      ******************************************************************        
       7325-GET-MTR-CONSTANT.                                           
           EXEC SQL                                                     
               SELECT CONSTANT                                          
C31697               ,NO_READ_DIALS                                     
                 INTO :MC-CONSTANT                                      
C31697               ,:MC-NO-READ-DIALS                                 
                 FROM CSS_MTR_CAP WITH(READUNCOMMITTED)                         
                WHERE CODE_UTIL_TYPE = :MC-CODE-UTIL-TYPE               
                  AND COMPANY_NO     = :MC-COMPANY-NO                   
                  AND METER_NO       = :MC-METER-NO                     
                  AND CODE_CAP_TYPE  = :MC-CODE-CAP-TYPE                
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT CONSTANT                                                  
MFA-TR*              ,NO_READ_DIALS                                             
MFA-TR*          INTO :MC-CONSTANT                                              
MFA-TR*              ,:MC-NO-READ-DIALS                                         
MFA-TR*          FROM CSS_MTR_CAP                                               
MFA-TR*         WHERE CODE_UTIL_TYPE = :MC-CODE-UTIL-TYPE                       
MFA-TR*           AND COMPANY_NO     = :MC-COMPANY-NO                           
MFA-TR*           AND METER_NO       = :MC-METER-NO                             
MFA-TR*           AND CODE_CAP_TYPE  = :MC-CODE-CAP-TYPE                        
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7325                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7325       **'       
               DISPLAY '**      COMPANY-NO    = ' MC-COMPANY-NO         
               DISPLAY '**      METER-NO      = ' MC-METER-NO           
               DISPLAY '**      UTIL TYPE     = ' MC-CODE-UTIL-TYPE     
               DISPLAY '**      CODE-CAP-TYPE = ' MC-CODE-CAP-TYPE      
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7325-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * GET NUMBER OF DAYS                                             *        
      ******************************************************************        
       7330-GET-NO-DAYS.                                                
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066        SELECT
              CIS.DAYS( IIF(TRY_CONVERT(DATE, :WS-CURR-READ-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-CURR-READ-DATE
              ) <> 0) OR (LEN(:WS-CURR-READ-DATE
              ) <> 10), CIS.CHAR2DATE(:WS-CURR-READ-DATE
              ), CONVERT(DATE, :WS-CURR-READ-DATE) ) ) - CIS.DAYS( 
              IIF(TRY_CONVERT(DATE, :WS-PREV-READ-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-PREV-READ-DATE
              ) <> 0) OR (LEN(:WS-PREV-READ-DATE
              ) <> 10), CIS.CHAR2DATE(:WS-PREV-READ-DATE
              ), CONVERT(DATE, :WS-PREV-READ-DATE) ) )
            INTO
              :WS-NO-READ-DAYS  
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ029
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SET :WS-NO-READ-DAYS =                                            
MFA-TR*            DAYS(:WS-CURR-READ-DATE) - DAYS(:WS-PREV-READ-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

      *                                                                         
           MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7330       **'       
               DISPLAY '**      CURRENT RD DT = ' WS-CURR-READ-DATE     
               DISPLAY '**      PREVIOUS RD DT= ' WS-PREV-READ-DATE     
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7330-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SQL TO ADD A SECOND                                            *        
      ******************************************************************        
       7335-ADD-ONE-SEC.                                                
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066        SELECT
              REPLACE(CONVERT(CHAR(8), DATEADD( SECOND, 1, 
           CIS.CHAR2TIME(:IM-METER-READ-TM) ), 108), ':', '.')
            INTO
              :IM-METER-READ-TM                   
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ029
MFA-TR* MSQ044
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SET :IM-METER-READ-TM =                                           
MFA-TR*            TIME(:IM-METER-READ-TM) + 1 SECOND                           
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7335       **'       
               DISPLAY '**      METER RD TIME = ' IM-METER-READ-TM      
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7335-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SQL TO ADD A DAY                                               *        
      ******************************************************************        
       7350-ADD-ONE-DAY.                                                
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066        SELECT
              DATEADD( DAY, 1, IIF(TRY_CONVERT(DATE, :WS-DB2-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-DB2-DATE
              ) <> 0) OR (LEN(:WS-DB2-DATE) <> 10), CIS.CHAR2DATE(
                                                           :WS-DB2-DATE
              ), CONVERT(DATE, :WS-DB2-DATE) ) )
            INTO
              :WS-DB2-DATE                           
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ029
MFA-TR* MSQ044
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SET :WS-DB2-DATE =                                                
MFA-TR*            DATE(:WS-DB2-DATE) + 1 DAY                                   
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7350       **'       
               DISPLAY '**      DATE          = ' WS-DB2-DATE           
               DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7350-EXIT.                                                       
           EXIT.                                                        
PRJ914*                                                                         
PRJ914*================================================================*        
PRJ914 7360-SELECT-CUR-TIMESTAMP.                                       
PRJ914*================================================================*        
PRJ914                                                                  
PRJ914     EXEC SQL                                                     
PRJ914         SELECT
              REPLACE(REPLACE(CONVERT(CHAR(26), CIS.CURRENT$TIMESTAMP()
           , 121), ' ', '-'), ':', '.')
            INTO
              :WS-CURRENT-TIMESTMP             
PRJ914     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ028
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SET :WS-CURRENT-TIMESTMP = CURRENT TIMESTAMP                     
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

PRJ914                                                                  
PRJ914     MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE.      
PRJ914                                                                  
PRJ914     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
PRJ914        CONTINUE                                                  
PRJ914     ELSE                                                         
PRJ914         DISPLAY '****************************************'       
PRJ914         DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
PRJ914         DISPLAY '**      ABEND IN PARAGRAPH 7360       **'       
PRJ914         DISPLAY '**      TO GET CURRENT TIMESTAMP      **'       
PRJ914         DISPLAY '**        SQLCODE = ' WS-ACTIVE-RETURN-CODE     
PRJ914         DISPLAY '****************************************'       
PRJ914         PERFORM 9900-ABEND THRU 9900-EXIT                        
PRJ914     END-IF.                                                      
PRJ914                                                                  
PRJ914 7360-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
      ******************************************************************        
      * SELECT MIN/MAX VALUES FOR NON CONSUMPTION READS                *        
      ******************************************************************        
       7400-SELECT-MTR-RD-FMT.                                          
      *                                                                         
           EXEC SQL                                                     
               SELECT TOP(1) MIN_READ,
              MAX_READ                                          
                 INTO :OA-MIN-READ                                      
                     ,:OA-MAX-READ                                      
                 FROM CSS_MTR_RD_FMT WITH(READUNCOMMITTED)                      
                WHERE CODE_UTIL_TYPE     = :OA-CODE-UTIL-TYPE           
                  AND DIGTL_MTR_TYPE     = :OA-DIGTL-MTR-TYPE           
                  AND PROGRAM_ID         = :OA-PROGRAM-ID               
                  AND MTR_READ_SOURCE_CD = :OA-MTR-READ-SOURCE-CD       
                  AND REMOTE_READ_IND    = :OA-REMOTE-READ-IND          
                  AND CODE_USAGE_TYPE    = :OA-CODE-USAGE-TYPE          
                  AND CODE_TOU_SEASN     = :OA-CODE-TOU-SEASN           
                  AND CODE_TIME_PERIOD   = :OA-CODE-TIME-PERIOD         
P00251            AND CODE_USAGE_ID     IN ( :OA-CODE-USAGE-ID,         
P00251                                       :WS-OA-CODE-USAGE-ID )     
P00251                                       
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT MIN_READ                                                  
MFA-TR*              ,MAX_READ                                                  
MFA-TR*          INTO :OA-MIN-READ                                              
MFA-TR*              ,:OA-MAX-READ                                              
MFA-TR*          FROM CSS_MTR_RD_FMT                                            
MFA-TR*         WHERE CODE_UTIL_TYPE     = :OA-CODE-UTIL-TYPE                   
MFA-TR*           AND DIGTL_MTR_TYPE     = :OA-DIGTL-MTR-TYPE                   
MFA-TR*           AND PROGRAM_ID         = :OA-PROGRAM-ID                       
MFA-TR*           AND MTR_READ_SOURCE_CD = :OA-MTR-READ-SOURCE-CD               
MFA-TR*           AND REMOTE_READ_IND    = :OA-REMOTE-READ-IND                  
MFA-TR*           AND CODE_USAGE_TYPE    = :OA-CODE-USAGE-TYPE                  
MFA-TR*           AND CODE_TOU_SEASN     = :OA-CODE-TOU-SEASN                   
MFA-TR*           AND CODE_TIME_PERIOD   = :OA-CODE-TIME-PERIOD                 
MFA-TR*           AND CODE_USAGE_ID     IN ( :OA-CODE-USAGE-ID,                 
MFA-TR*                                      :WS-OA-CODE-USAGE-ID )             
MFA-TR*         FETCH FIRST ROW ONLY WITH UR                                    
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7400       **'           
               DISPLAY '**  CODE_UTIL_TYPE     = ' OA-CODE-UTIL-TYPE    
               DISPLAY '**  DIGTL_MTR_TYPE     = ' OA-DIGTL-MTR-TYPE    
               DISPLAY '**  PROGRAM_ID         = ' OA-PROGRAM-ID        
               DISPLAY '**  MTR_READ_SOURCE_CD = ' OA-MTR-READ-SOURCE-CD
               DISPLAY '**  REMOTE_READ_IND    = ' OA-REMOTE-READ-IND   
               DISPLAY '**  CODE_USAGE_TYPE    = ' OA-CODE-USAGE-TYPE   
               DISPLAY '**  CODE_TOU_SEASN     = ' OA-CODE-TOU-SEASN    
               DISPLAY '**  CODE_TIME_PERIOD   = ' OA-CODE-TIME-PERIOD  
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7400-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * SELECT FACTOR HIGH/LOW VALUES                                  *        
      ******************************************************************        
       7410-GET-FACTOR-HILO.                                            
           EXEC SQL                                                     
              SELECT MIN_POWER_FACTOR                                   
                    ,MAX_POWER_FACTOR                                   
                    ,MIN_LOAD_FACTOR                                    
                    ,MAX_LOAD_FACTOR                                    
                INTO :O9-MIN-POWER-FACTOR                               
                    ,:O9-MAX-POWER-FACTOR                               
                    ,:O9-MIN-LOAD-FACTOR                                
                    ,:O9-MAX-LOAD-FACTOR                                
                FROM CSS_RATE_HIGH_LOW WITH(READUNCOMMITTED)                    
               WHERE CODE_UTIL_TYPE = :O9-CODE-UTIL-TYPE                
                 AND RATE_PLAN_NO   = :O9-RATE-PLAN-NO                  
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT MIN_POWER_FACTOR                                           
MFA-TR*             ,MAX_POWER_FACTOR                                           
MFA-TR*             ,MIN_LOAD_FACTOR                                            
MFA-TR*             ,MAX_LOAD_FACTOR                                            
MFA-TR*         INTO :O9-MIN-POWER-FACTOR                                       
MFA-TR*             ,:O9-MAX-POWER-FACTOR                                       
MFA-TR*             ,:O9-MIN-LOAD-FACTOR                                        
MFA-TR*             ,:O9-MAX-LOAD-FACTOR                                        
MFA-TR*         FROM CSS_RATE_HIGH_LOW                                          
MFA-TR*        WHERE CODE_UTIL_TYPE = :O9-CODE-UTIL-TYPE                        
MFA-TR*          AND RATE_PLAN_NO   = :O9-RATE-PLAN-NO                          
MFA-TR*        WITH UR                                                          
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7410       **'           
               DISPLAY '**  CODE_UTIL_TYPE     = ' O9-CODE-UTIL-TYPE    
               DISPLAY '**  RATE-PLAN-NO       = ' O9-RATE-PLAN-NO      
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7410-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
P00246******************************************************************        
P00246* SUM UP NO OF DAYS FOR EXISTING CX ROWS FOR A PARTICULAR BILL_NO*        
P00246******************************************************************        
P00246 7415-SUM-EXISTING-CX.                                            
P00246*                                                                         
P00246     EXEC SQL                                                     
P00246         SELECT SUM(CX.NO_DAYS)                                   
P00246           INTO :WS-HOLD-CX-DAYS :WS-NULL-13                       
P00246           FROM CSS_CNSMPTN_HIST CX WITH(READUNCOMMITTED)                 
P00246          WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO            
P00246            AND CX.BILL_NO            = :CX-BILL-NO               
P00246            AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE        
P00246            AND CX.IC_NO              = :CX-IC-NO                 
P00246            AND CX.MTR_REF_NO         = :CX-MTR-REF-NO            
P00246            AND CX.REG_ID_NO          = :CX-REG-ID-NO             
P00246            AND CX.CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD      
P00246            AND CX.CODE_USAGE_TYPE    = :CX-CODE-USAGE-TYPE       
P00246            AND CX.CODE_USAGE_ID      = :CX-CODE-USAGE-ID         
P00246            AND CX.CODE_USAGE_SOURCE  = :CX-CODE-USAGE-SOURCE     
P00246            AND CX.BILL_ITEM_TIMESTMP IN                          
P00246               (SELECT BILL_ITEM_TIMESTMP                         
P00246                  FROM CSS_BILLING_DET BG WITH(READUNCOMMITTED)           
P00246                 WHERE BG.ACCOUNT_NO         = CX.ACCOUNT_NO      
P00246                   AND BG.BILL_NO            = CX.BILL_NO         
P00246                   AND BG.CODE_UTIL_TYPE     = CX.CODE_UTIL_TYPE  
P00246                   AND BG.IC_NO              = CX.IC_NO           
P00246                   AND BG.CODE_BILL_CALC     = 'A'                
P00246                   AND BG.CODE_BILL_ITM_TYPE = 'C'                
P00246                   AND BG.CODE_BILL_ITM_IND  = 'A'                
P00246                   AND BG.DATE_ORIG_BILL     IS NULL              
P00246                   AND BG.REV_MTH_ORIG_BILL  = 0)                 
P00246                                                           
A03352                                                      
P00246     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT SUM(CX.NO_DAYS)                                           
MFA-TR*          INTO :WS-HOLD-CX-DAYS:WS-NULL-13                               
MFA-TR*          FROM CSS_CNSMPTN_HIST CX                                       
MFA-TR*         WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO                    
MFA-TR*           AND CX.BILL_NO            = :CX-BILL-NO                       
MFA-TR*           AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE                
MFA-TR*           AND CX.IC_NO              = :CX-IC-NO                         
MFA-TR*           AND CX.MTR_REF_NO         = :CX-MTR-REF-NO                    
MFA-TR*           AND CX.REG_ID_NO          = :CX-REG-ID-NO                     
MFA-TR*           AND CX.CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD              
MFA-TR*           AND CX.CODE_USAGE_TYPE    = :CX-CODE-USAGE-TYPE               
MFA-TR*           AND CX.CODE_USAGE_ID      = :CX-CODE-USAGE-ID                 
MFA-TR*           AND CX.CODE_USAGE_SOURCE  = :CX-CODE-USAGE-SOURCE             
MFA-TR*           AND CX.BILL_ITEM_TIMESTMP IN                                  
MFA-TR*              (SELECT BILL_ITEM_TIMESTMP                                 
MFA-TR*                 FROM CSS_BILLING_DET BG                                 
MFA-TR*                WHERE BG.ACCOUNT_NO         = CX.ACCOUNT_NO              
MFA-TR*                  AND BG.BILL_NO            = CX.BILL_NO                 
MFA-TR*                  AND BG.CODE_UTIL_TYPE     = CX.CODE_UTIL_TYPE          
MFA-TR*                  AND BG.IC_NO              = CX.IC_NO                   
MFA-TR*                  AND BG.CODE_BILL_CALC     = 'A'                        
MFA-TR*                  AND BG.CODE_BILL_ITM_TYPE = 'C'                        
MFA-TR*                  AND BG.CODE_BILL_ITM_IND  = 'A'                        
MFA-TR*                  AND BG.DATE_ORIG_BILL     IS NULL                      
MFA-TR*                  AND BG.REV_MTH_ORIG_BILL  = 0)                         
MFA-TR*          WITH UR                                                        
MFA-TR*          QUERYNO 7415                                                   
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

P00246*                                                                         
P00246     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
P00246*                                                                         
P00246     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
P00246         IF  WS-NULL-13 < 0                                       
P00246             MOVE +0                 TO WS-HOLD-CX-DAYS           
P00246         ELSE                                                     
P00246             NEXT SENTENCE                                        
P00246         END-IF                                                   
P00246     ELSE                                                         
P00246         DISPLAY '****************************************'       
P00246         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
P00246         DISPLAY '**  ABEND IN PARAGRAPH 7415           **'       
P00246         DISPLAY '**  ACCOUNT-NO         = ' CX-ACCOUNT-NO        
P00246         DISPLAY '**  BILL_NO            = ' CX-BILL-NO           
P00246         DISPLAY '**  UTIL TYPE          = ' CX-CODE-UTIL-TYPE    
P00246         DISPLAY '**  IC-NO              = ' CX-IC-NO             
P00246         DISPLAY '**  BILL-ITEM-TIMESTMP = ' CX-BILL-ITEM-TIMESTMP
P00246         DISPLAY '**  MTR-REF-NO         = ' CX-MTR-REF-NO        
P00246         DISPLAY '**  REG-ID-NO          = ' CX-REG-ID-NO         
P00246         DISPLAY '**  TIME PERIOD        = ' CX-CODE-TIME-PERIOD  
P00246         DISPLAY '**  CODE_USAGE_TYP     = ' CX-CODE-USAGE-TYPE   
P00246         DISPLAY '**  CODE_USAGE_ID      = ' CX-CODE-USAGE-ID     
P00246         DISPLAY '**  METER-NO           = ' CX-METER-NO          
P00246         DISPLAY '**  SQLCODE            = ' WS-ACTIVE-RETURN-CODE
P00246         DISPLAY '****************************************'       
P00246         PERFORM 9900-ABEND THRU 9900-EXIT                        
P00246     END-IF.                                                      
P00246*                                                                         
P00246 7415-EXIT.                                                       
P00246     EXIT.                                                        
PRJ914*                                                                         
PRJ914*================================================================*        
PRJ914 7416-VERIFY-EXISTING-CX.                                         
PRJ914*================================================================*        
PRJ914*                                                                         
PRJ914     EXEC SQL                                                     
PRJ914         SELECT TOP(1) CX.BILL_NO,
              CX.IC_NO,
              CX.MTR_REF_NO,
              REPLACE(REPLACE(CONVERT(CHAR(26), CX.BILL_ITEM_TIMESTMP
           , 121), ' ', '-'), ':', '.') BILL_ITEM_TIMESTMP,
              CX.METER_READING,
              CX.DEMAND_READING,
              CX.NO_UNITS,
              CX.NO_DEMAND_UNITS                                
PRJ914           INTO :CX-BILL-NO                                       
PRJ914               ,:CX-IC-NO                                         
PRJ914               ,:CX-MTR-REF-NO                                    
PRJ914               ,:CX-BILL-ITEM-TIMESTMP                            
PRJ914               ,:CX-METER-READING                                 
PRJ914               ,:CX-DEMAND-READING                                
PRJ914               ,:CX-NO-UNITS                                      
PRJ914               ,:CX-NO-DEMAND-UNITS                               
PRJ914           FROM CSS_CNSMPTN_HIST CX WITH(READUNCOMMITTED)                 
PRJ914          WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO            
PRJ914            AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE        
PRJ914            AND CX.DATE_READ          = IIF(TRY_CONVERT(DATE, 
                                                          :CX-DATE-READ
              ) IS NULL OR (PATINDEX('%.%', :CX-DATE-READ
              ) <> 0) OR (LEN(:CX-DATE-READ) <> 10), CIS.CHAR2DATE(
                                                          :CX-DATE-READ
              ), CONVERT(DATE, :CX-DATE-READ) )             
PRJ914            AND CX.METER_NO           = :CX-METER-NO              
PRJ914            AND CX.CODE_TIME_PERIOD   = 0                         
PRJ914            AND CX.CODE_USAGE_TYPE    = 'B'                       
PRJ914            AND CX.CODE_USAGE_ID      = 'A'                       
PRJ914            AND CX.BILL_ITEM_TIMESTMP IN                          
PRJ914               (SELECT BILL_ITEM_TIMESTMP                         
PRJ914                  FROM CSS_BILLING_DET BG WITH(READUNCOMMITTED)           
PRJ914                 WHERE BG.ACCOUNT_NO         = CX.ACCOUNT_NO      
PRJ914                   AND BG.BILL_NO            = CX.BILL_NO         
PRJ914                   AND BG.CODE_UTIL_TYPE     = CX.CODE_UTIL_TYPE  
PRJ914                   AND BG.IC_NO              = CX.IC_NO           
PRJ914                   AND BG.CODE_BILL_CALC     = 'A'                
PRJ914                   AND BG.CODE_BILL_ITM_TYPE = 'C'                
PRJ914                   AND BG.CODE_BILL_ITM_IND  = 'A'                
PRJ914                   AND BG.DATE_ORIG_BILL     IS NULL              
PRJ914                   AND BG.REV_MTH_ORIG_BILL  = 0)                 
PRJ914                                              
PRJ914                                                           
PRJ914                                                      
PRJ914     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR* MSQ054
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT CX.BILL_NO                                                
MFA-TR*              ,CX.IC_NO                                                  
MFA-TR*              ,CX.MTR_REF_NO                                             
MFA-TR*              ,CX.BILL_ITEM_TIMESTMP                                     
MFA-TR*              ,CX.METER_READING                                          
MFA-TR*              ,CX.DEMAND_READING                                         
MFA-TR*              ,CX.NO_UNITS                                               
MFA-TR*              ,CX.NO_DEMAND_UNITS                                        
MFA-TR*          INTO :CX-BILL-NO                                               
MFA-TR*              ,:CX-IC-NO                                                 
MFA-TR*              ,:CX-MTR-REF-NO                                            
MFA-TR*              ,:CX-BILL-ITEM-TIMESTMP                                    
MFA-TR*              ,:CX-METER-READING                                         
MFA-TR*              ,:CX-DEMAND-READING                                        
MFA-TR*              ,:CX-NO-UNITS                                              
MFA-TR*              ,:CX-NO-DEMAND-UNITS                                       
MFA-TR*          FROM CSS_CNSMPTN_HIST CX                                       
MFA-TR*         WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO                    
MFA-TR*           AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE                
MFA-TR*           AND CX.DATE_READ          = :CX-DATE-READ                     
MFA-TR*           AND CX.METER_NO           = :CX-METER-NO                      
MFA-TR*           AND CX.CODE_TIME_PERIOD   = 0                                 
MFA-TR*           AND CX.CODE_USAGE_TYPE    = 'B'                               
MFA-TR*           AND CX.CODE_USAGE_ID      = 'A'                               
MFA-TR*           AND CX.BILL_ITEM_TIMESTMP IN                                  
MFA-TR*              (SELECT BILL_ITEM_TIMESTMP                                 
MFA-TR*                 FROM CSS_BILLING_DET BG                                 
MFA-TR*                WHERE BG.ACCOUNT_NO         = CX.ACCOUNT_NO              
MFA-TR*                  AND BG.BILL_NO            = CX.BILL_NO                 
MFA-TR*                  AND BG.CODE_UTIL_TYPE     = CX.CODE_UTIL_TYPE          
MFA-TR*                  AND BG.IC_NO              = CX.IC_NO                   
MFA-TR*                  AND BG.CODE_BILL_CALC     = 'A'                        
MFA-TR*                  AND BG.CODE_BILL_ITM_TYPE = 'C'                        
MFA-TR*                  AND BG.CODE_BILL_ITM_IND  = 'A'                        
MFA-TR*                  AND BG.DATE_ORIG_BILL     IS NULL                      
MFA-TR*                  AND BG.REV_MTH_ORIG_BILL  = 0)                         
MFA-TR*          FETCH FIRST ROW ONLY                                           
MFA-TR*          WITH UR                                                        
MFA-TR*          QUERYNO 7416                                                   
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

PRJ914*                                                                         
PRJ914     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
PRJ914*                                                                         
PRJ914     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
PRJ914        CONTINUE                                                  
PRJ914     ELSE                                                         
PRJ914         DISPLAY '****************************************'       
PRJ914         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
PRJ914         DISPLAY '**  ABEND IN PARAGRAPH 7416           **'       
PRJ914         DISPLAY '**  ACCOUNT-NO         = ' CX-ACCOUNT-NO        
PRJ914         DISPLAY '**  UTIL TYPE          = ' CX-CODE-UTIL-TYPE    
PRJ914         DISPLAY '**  DATE_READ          = ' CX-DATE-READ         
PRJ914         DISPLAY '**  METER_NO           = ' CX-METER-NO          
PRJ914         DISPLAY '**  TIME PERIOD        = ' CX-CODE-TIME-PERIOD  
PRJ914         DISPLAY '**  CODE_USAGE_TYP     = ' CX-CODE-USAGE-TYPE   
PRJ914         DISPLAY '**  CODE_USAGE_ID      = ' CX-CODE-USAGE-ID     
PRJ914         DISPLAY '**  SQLCODE            = ' WS-ACTIVE-RETURN-CODE
PRJ914         DISPLAY '****************************************'       
PRJ914         PERFORM 9900-ABEND THRU 9900-EXIT                        
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914 7416-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
PRJ914*                                                                         
PRJ914*================================================================*        
PRJ914 7418-GET-EXISTING-READ.                                          
PRJ914*================================================================*        
PRJ914*                                                                         
PRJ914     EXEC SQL                                                     
PRJ914         SELECT TOP(1) CX.ITEM_SEQ_NO,
              CX.REG_ID_NO,
              CX.MTR_REF_NO,
              CX.METER_READING,
              CX.DEMAND_READING,
              CX.NO_UNITS,
              CX.NO_DEMAND_UNITS,
              CX.CONSTANT                                       
PRJ914           INTO :CX-ITEM-SEQ-NO                                   
PRJ914               ,:CX-REG-ID-NO                                     
PRJ914               ,:CX-MTR-REF-NO                                    
PRJ914               ,:CX-METER-READING                                 
PRJ914               ,:CX-DEMAND-READING                                
PRJ914               ,:CX-NO-UNITS                                      
PRJ914               ,:CX-NO-DEMAND-UNITS                               
PRJ914               ,:CX-CONSTANT                                      
PRJ914           FROM CSS_CNSMPTN_HIST CX WITH(READUNCOMMITTED)                 
PRJ914          WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO            
PRJ914            AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE        
PRJ914            AND CX.BILL_NO            = :CX-BILL-NO               
PRJ914            AND CX.IC_NO              = :CX-IC-NO                 
PRJ914            AND CX.METER_NO           = :CX-METER-NO              
PRJ914            AND CX.DATE_READ          = IIF(TRY_CONVERT(DATE, 
                                                          :CX-DATE-READ
              ) IS NULL OR (PATINDEX('%.%', :CX-DATE-READ
              ) <> 0) OR (LEN(:CX-DATE-READ) <> 10), CIS.CHAR2DATE(
                                                          :CX-DATE-READ
              ), CONVERT(DATE, :CX-DATE-READ) )             
PRJ914            AND CX.CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD      
PRJ914            AND CX.CODE_USAGE_TYPE    = :CX-CODE-USAGE-TYPE       
PRJ914            AND CX.CODE_USAGE_ID      = :CX-CODE-USAGE-ID         
PRJ914            AND CX.CODE_TOU_SEASN   IN (:CX-CODE-TOU-SEASN        
PRJ914                                       ,:WS-CODE-TOU-SEASN)       
PRJ914            AND CX.BILL_ITEM_TIMESTMP = CIS.CHAR2TIMESTAMP(
                                                 :CX-BILL-ITEM-TIMESTMP
              )    
PRJ914                                              
PRJ914                                                           
PRJ914                                                      
PRJ914     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 CX.ITEM_SEQ_NO                                            
MFA-TR*              ,CX.REG_ID_NO                                              
MFA-TR*              ,CX.MTR_REF_NO                                             
MFA-TR*              ,CX.METER_READING                                          
MFA-TR*              ,CX.DEMAND_READING                                         
MFA-TR*              ,CX.NO_UNITS                                               
MFA-TR*              ,CX.NO_DEMAND_UNITS                                        
MFA-TR*              ,CX.CONSTANT                                               
MFA-TR*          INTO :CX-ITEM-SEQ-NO                                           
MFA-TR*              ,:CX-REG-ID-NO                                             
MFA-TR*              ,:CX-MTR-REF-NO                                            
MFA-TR*              ,:CX-METER-READING                                         
MFA-TR*              ,:CX-DEMAND-READING                                        
MFA-TR*              ,:CX-NO-UNITS                                              
MFA-TR*              ,:CX-NO-DEMAND-UNITS                                       
MFA-TR*              ,:CX-CONSTANT                                              
MFA-TR*          FROM CSS_CNSMPTN_HIST CX                                       
MFA-TR*         WHERE CX.ACCOUNT_NO         = :CX-ACCOUNT-NO                    
MFA-TR*           AND CX.CODE_UTIL_TYPE     = :CX-CODE-UTIL-TYPE                
MFA-TR*           AND CX.BILL_NO            = :CX-BILL-NO                       
MFA-TR*           AND CX.IC_NO              = :CX-IC-NO                         
MFA-TR*           AND CX.METER_NO           = :CX-METER-NO                      
MFA-TR*           AND CX.DATE_READ          = :CX-DATE-READ                     
MFA-TR*           AND CX.CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD              
MFA-TR*           AND CX.CODE_USAGE_TYPE    = :CX-CODE-USAGE-TYPE               
MFA-TR*           AND CX.CODE_USAGE_ID      = :CX-CODE-USAGE-ID                 
MFA-TR*           AND CX.CODE_TOU_SEASN   IN (:CX-CODE-TOU-SEASN                
MFA-TR*                                      ,:WS-CODE-TOU-SEASN)               
MFA-TR*           AND CX.BILL_ITEM_TIMESTMP = :CX-BILL-ITEM-TIMESTMP            
MFA-TR*          FETCH FIRST ROW ONLY                                           
MFA-TR*          WITH UR                                                        
MFA-TR*          QUERYNO 7418                                                   
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

PRJ914*                                                                         
PRJ914     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
PRJ914*                                                                         
PRJ914     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND  
PRJ914        CONTINUE                                                  
PRJ914     ELSE                                                         
PRJ914         DISPLAY '****************************************'       
PRJ914         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
PRJ914         DISPLAY '**  ABEND IN PARAGRAPH 7418           **'       
PRJ914         DISPLAY '**  ACCOUNT-NO         = ' CX-ACCOUNT-NO        
PRJ914         DISPLAY '**  UTIL TYPE          = ' CX-CODE-UTIL-TYPE    
PRJ914         DISPLAY '**  DATE_READ          = ' CX-DATE-READ         
PRJ914         DISPLAY '**  METER_NO           = ' CX-METER-NO          
PRJ914         DISPLAY '**  TIME PERIOD        = ' CX-CODE-TIME-PERIOD  
PRJ914         DISPLAY '**  CODE_USAGE_TYP     = ' CX-CODE-USAGE-TYPE   
PRJ914         DISPLAY '**  CODE_USAGE_ID      = ' CX-CODE-USAGE-ID     
PRJ914         DISPLAY '**  SQLCODE            = ' WS-ACTIVE-RETURN-CODE
PRJ914         DISPLAY '****************************************'       
PRJ914         PERFORM 9900-ABEND THRU 9900-EXIT                        
PRJ914     END-IF.                                                      
PRJ914*                                                                         
PRJ914 7418-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914*                                                                         
      ******************************************************************        
      * GET MAX SEQ-NO BEFORE INSERTING A ROW INTO CX                  *        
      ******************************************************************        
       7420-SELECT-MAX-CNSMPTN-HIST.                                    
      *                                                                         
           EXEC SQL                                                     
               SELECT COALESCE(MAX(ITEM_SEQ_NO), 0)                       
                 INTO :CX-ITEM-SEQ-NO                                   
                 FROM CSS_CNSMPTN_HIST WITH(READUNCOMMITTED)                    
                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                    
                  AND BILL_ITEM_TIMESTMP = CIS.CHAR2TIMESTAMP(
                                                 :CX-BILL-ITEM-TIMESTMP
              )       
                  AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD         
                  AND MTR_REF_NO         = :CX-MTR-REF-NO               
                  AND REG_ID_NO          = :CX-REG-ID-NO                
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ029
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT IFNULL(MAX(ITEM_SEQ_NO), 0)                               
MFA-TR*          INTO :CX-ITEM-SEQ-NO                                           
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*           AND BILL_ITEM_TIMESTMP = :CX-BILL-ITEM-TIMESTMP               
MFA-TR*           AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD                 
MFA-TR*           AND MTR_REF_NO         = :CX-MTR-REF-NO                       
MFA-TR*           AND REG_ID_NO          = :CX-REG-ID-NO                        
MFA-TR*         WITH UR                                                         
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7420       **'           
               DISPLAY '**      ACCOUNT-NO    = ' CX-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' CX-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' CX-IC-NO              
               DISPLAY '**      METER-NO      = ' CX-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' CX-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' CX-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' CX-CODE-TIME-PERIOD   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7420-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C31697******************************************************************        
ST    * CHECK WHETHER A READING IS POSTED DOUBLE                       *        
      ******************************************************************        
       7430-CHECK-FOR-DUP-READS.                                        
      *                                                                         
           EXEC SQL                                                     
               SELECT COALESCE(COUNT(*), 0)                               
                 INTO :WS-READ-COUNT                                    
                 FROM CSS_CNSMPTN_HIST WITH(READUNCOMMITTED)                    
                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                    
                  AND BILL_ITEM_TIMESTMP = CIS.CHAR2TIMESTAMP(
                                                 :CX-BILL-ITEM-TIMESTMP
              )       
                  AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD         
                  AND MTR_REF_NO         = :CX-MTR-REF-NO               
                  AND REG_ID_NO          = :CX-REG-ID-NO                
                  AND METER_NO           = :CX-METER-NO                 
                  AND DATE_READ          = IIF(TRY_CONVERT(DATE, 
                                                          :CX-DATE-READ
              ) IS NULL OR (PATINDEX('%.%', :CX-DATE-READ
              ) <> 0) OR (LEN(:CX-DATE-READ) <> 10), CIS.CHAR2DATE(
                                                          :CX-DATE-READ
              ), CONVERT(DATE, :CX-DATE-READ) )                
                  AND NO_DAYS            = :CX-NO-DAYS                  
                  AND CODE_TOU_SEASN     = :CX-CODE-TOU-SEASN           
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ029
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT IFNULL(COUNT(*), 0)                                       
MFA-TR*          INTO :WS-READ-COUNT                                            
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*           AND BILL_ITEM_TIMESTMP = :CX-BILL-ITEM-TIMESTMP               
MFA-TR*           AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD                 
MFA-TR*           AND MTR_REF_NO         = :CX-MTR-REF-NO                       
MFA-TR*           AND REG_ID_NO          = :CX-REG-ID-NO                        
MFA-TR*           AND METER_NO           = :CX-METER-NO                         
MFA-TR*           AND DATE_READ          = :CX-DATE-READ                        
MFA-TR*           AND NO_DAYS            = :CX-NO-DAYS                          
MFA-TR*           AND CODE_TOU_SEASN     = :CX-CODE-TOU-SEASN                   
MFA-TR*         WITH UR                                                         
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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7430       **'           
               DISPLAY '**      ACCOUNT-NO    = ' CX-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' CX-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' CX-IC-NO              
               DISPLAY '**      METER-NO      = ' CX-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' CX-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' CX-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' CX-CODE-TIME-PERIOD   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7430-EXIT.                                                       
END        EXIT.                                                        
C31697*                                                                         
      ******************************************************************        
      * OPEN CURSOR TO BROWSE THROUGH ALL IC'S                         *        
      ******************************************************************        
       7500-OPEN-UTIL-ENVRNMT.                                          
      *                                                                         
           EXEC SQL                                                     
               OPEN UTIL_ENVRNMT                                        
           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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7500        **'          
               DISPLAY '**      ACCOUNT-NO    = ' UT-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7500-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * FETCH CURSOR TO BROWSE THROUGH ALL IC'S                        *        
      ******************************************************************        
       7510-FETCH-UTIL-ENVRNMT.                                         
      *                                                                         
           EXEC SQL                                                     
                FETCH UTIL_ENVRNMT                                      
                 INTO :UT-ACCOUNT-NO                                    
                     ,:UT-CODE-UTIL-TYPE                                
                     ,:UT-IC-NO                                         
                     ,:UT-READ-CYCLE                                    
                     ,:UT-READ-ROUTE                                    
           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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7510        **'          
               DISPLAY '**      ACCOUNT-NO    = ' UT-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7510-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CLOSE CURSOR TO BROWSE THROUGH ALL IC'S                        *        
      ******************************************************************        
       7520-CLOSE-UTIL-ENVRNMT.                                         
      *                                                                         
           EXEC SQL                                                     
               CLOSE UTIL_ENVRNMT                                       
           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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7520        **'          
               DISPLAY '**      ACCOUNT-NO    = ' UT-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7520-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * COUNT NUMBER OF MN ROWS WITH READ CODE AWAITING/VERIFIED READ  *        
      ******************************************************************        
       7530-CNT-MN-NO-READS.                                            
      *                                                                         
           EXEC SQL                                                     
              SELECT COUNT(*)                                           
                INTO :WS-MN-AWAITING-RD-COUNT                           
                FROM CSS_MTRD_ENVRNMT WITH(READUNCOMMITTED)                     
               WHERE ACCOUNT_NO          = :MN-ACCOUNT-NO               
                 AND CODE_UTIL_TYPE      = :MN-CODE-UTIL-TYPE           
                 AND IC_NO               = :MN-IC-NO                    
                 AND CODE_METER_STATUS  <> 'K'                          
                 AND (CODE_CRNT_REG_READ = :MN-CODE-CRNT-REG-READ       
                  OR  CODE_CRNT_REG_READ = :WS-VERIFIED-READ            
                  OR  CODE_CRNT_REG_READ = :WS-NO-READ)                 
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT COUNT(*)                                                   
MFA-TR*         INTO :WS-MN-AWAITING-RD-COUNT                                   
MFA-TR*         FROM CSS_MTRD_ENVRNMT                                           
MFA-TR*        WHERE ACCOUNT_NO          = :MN-ACCOUNT-NO                       
MFA-TR*          AND CODE_UTIL_TYPE      = :MN-CODE-UTIL-TYPE                   
MFA-TR*          AND IC_NO               = :MN-IC-NO                            
MFA-TR*          AND CODE_METER_STATUS  <> 'K'                                  
MFA-TR*          AND (CODE_CRNT_REG_READ = :MN-CODE-CRNT-REG-READ               
MFA-TR*           OR  CODE_CRNT_REG_READ = :WS-VERIFIED-READ                    
MFA-TR*           OR  CODE_CRNT_REG_READ = :WS-NO-READ)                         
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7530                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7530        **'          
               DISPLAY '**      ACCOUNT-NO    = ' MN-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' MN-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' MN-IC-NO              
               DISPLAY '**      REG READ CODE = ' MN-CODE-CRNT-REG-READ 
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7530-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * COUNT NUMBER OF RG ROWS WITH READ CODE AWAITING/VERIFIED READ  *        
      ******************************************************************        
       7540-CNT-RG-NO-READS.                                            
      *                                                                         
           EXEC SQL                                                     
               SELECT COUNT(*)                                          
                 INTO :WS-RG-AWAITING-RD-COUNT                          
                 FROM CSS_REGISTER_READ WITH(READUNCOMMITTED)                   
                WHERE ACCOUNT_NO          = :RG-ACCOUNT-NO              
                  AND CODE_UTIL_TYPE      = :RG-CODE-UTIL-TYPE          
                  AND IC_NO               = :RG-IC-NO                   
                  AND CODE_REG_STATUS    <> 'K'                         
                  AND (CODE_CRNT_REG_READ = :RG-CODE-CRNT-REG-READ      
                   OR  CODE_CRNT_REG_READ = :WS-VERIFIED-READ           
                   OR  CODE_CRNT_REG_READ = :WS-NO-READ)                
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT COUNT(*)                                                  
MFA-TR*          INTO :WS-RG-AWAITING-RD-COUNT                                  
MFA-TR*          FROM CSS_REGISTER_READ                                         
MFA-TR*         WHERE ACCOUNT_NO          = :RG-ACCOUNT-NO                      
MFA-TR*           AND CODE_UTIL_TYPE      = :RG-CODE-UTIL-TYPE                  
MFA-TR*           AND IC_NO               = :RG-IC-NO                           
MFA-TR*           AND CODE_REG_STATUS    <> 'K'                                 
MFA-TR*           AND (CODE_CRNT_REG_READ = :RG-CODE-CRNT-REG-READ              
MFA-TR*            OR  CODE_CRNT_REG_READ = :WS-VERIFIED-READ                   
MFA-TR*            OR  CODE_CRNT_REG_READ = :WS-NO-READ)                        
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7540                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7540        **'          
               DISPLAY '**      ACCOUNT-NO    = ' RG-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' RG-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' RG-IC-NO              
               DISPLAY '**      REG READ CODE = ' RG-CODE-CRNT-REG-READ 
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7540-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *****************************************************************         
      * THIS SELECTS A ROW FROM CSS_RESTART TO CHECK WHETHER THE      *         
      * CURRENT RUN IS A REGULAR RUN OR A RESTART. IF A ROW IS PRESENT*         
      * FOR THIS PROGRAM IT IS A RERUN, THE PROCESS STARTS FROM THE   *         
      * ACCOUNT AND PROCESS WHICH IS STORED IN RESTART-DATA           *         
      *****************************************************************         
       7550-SELECT-RESTART-DATA.                                        
      *                                                                         
           EXEC SQL                                                     
               SELECT RESTART_DATA                                      
                 INTO :RF-RESTART-DATA                                  
                 FROM CSS_RESTART WITH(READUNCOMMITTED)                         
                WHERE NAME_PROGRAM   = :RF-NAME-PROGRAM                 
                  AND PARTITION_NO   = :RF-PARTITION-NO                 
                  AND DUP_CNTRL_NO   = :RF-DUP-CNTRL-NO                 
A03352                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT RESTART_DATA                                              
MFA-TR*          INTO :RF-RESTART-DATA                                          
MFA-TR*          FROM CSS_RESTART                                               
MFA-TR*         WHERE NAME_PROGRAM   = :RF-NAME-PROGRAM                         
MFA-TR*           AND PARTITION_NO   = :RF-PARTITION-NO                         
MFA-TR*           AND DUP_CNTRL_NO   = :RF-DUP-CNTRL-NO                         
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7550                                                    
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 7550       **'       
               DISPLAY '**      NAME_PROGRAM  = ' RF-NAME-PROGRAM       
               DISPLAY '**      PARTITION_NO  = ' RF-PARTITION-NO       
               DISPLAY '**      SQLCODE = ' WS-ACTIVE-RETURN-CODE       
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7550-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CHECK WHETHER ACCOUNT EXISTS IN OFF CYCLE TABLE                *        
      ******************************************************************        
       7560-CHECK-OFF-CYCLE.                                            
      *                                                                         
           EXEC SQL                                                     
              SELECT '1'                                                
                INTO :WS-OC-EXISTS                                      
                FROM CSS_OFF_CYCL_ACCT WITH(READUNCOMMITTED)                    
               WHERE ACCOUNT_NO         = :OC-ACCOUNT-NO                
                 AND CODE_BILL_OFF_CYCL = 'H'                           
C35066                                                           
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT '1'                                                        
MFA-TR*         INTO :WS-OC-EXISTS                                              
MFA-TR*         FROM CSS_OFF_CYCL_ACCT                                          
MFA-TR*        WHERE ACCOUNT_NO         = :OC-ACCOUNT-NO                        
MFA-TR*          AND CODE_BILL_OFF_CYCL = 'H'                                   
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7560                                                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7560        **'          
               DISPLAY '**      ACCOUNT-NO    = ' OC-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7560-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * CHECK WHEN THE CYCLE IS READY TO BILL                          *        
      ******************************************************************        
       7570-CHECK-BILL-DATE.                                            
      *                                                                         
           EXEC SQL                                                     
              SELECT TOP(1) 'Y'                                                
                INTO :WS-DELETE-OFFCYC                                  
                FROM  CSS_BILL_WINDOW WITH(READUNCOMMITTED)                     
               WHERE  BILL_CYCLE               = :BN-BILL-CYCLE         
                 AND  DATE_EXTRACT            >= IIF(TRY_CONVERT(DATE, 
                                                           :WS-RUN-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-RUN-DATE
              ) <> 0) OR (LEN(:WS-RUN-DATE) <> 10), CIS.CHAR2DATE(
                                                           :WS-RUN-DATE
              ), CONVERT(DATE, :WS-RUN-DATE) )           
                 AND  (DATEADD( DAY, -5, DATE_EXTRACT )) <  
              IIF(TRY_CONVERT(DATE, :WS-RUN-DATE
              ) IS NULL OR (PATINDEX('%.%', :WS-RUN-DATE
              ) <> 0) OR (LEN(:WS-RUN-DATE) <> 10), CIS.CHAR2DATE(
                                                           :WS-RUN-DATE
              ), CONVERT(DATE, :WS-RUN-DATE) )           
C35066                                       
A03352                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR* MSQ044
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT 'Y'                                                        
MFA-TR*         INTO :WS-DELETE-OFFCYC                                          
MFA-TR*         FROM  CSS_BILL_WINDOW                                           
MFA-TR*        WHERE  BILL_CYCLE               = :BN-BILL-CYCLE                 
MFA-TR*          AND  DATE_EXTRACT            >= :WS-RUN-DATE                   
MFA-TR*          AND  (DATE_EXTRACT - 5 DAYS) <  :WS-RUN-DATE                   
MFA-TR*        FETCH FIRST ROW ONLY WITH UR                                     
MFA-TR*        QUERYNO 7570                                                     
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 
                                                           OR WS-811    
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 7570        **'          
               DISPLAY '**      BILL CYCLE    = ' BN-BILL-CYCLE         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       7570-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      * 7620-START-FCSCA00 VSAM CTRL FILE     *                                 
           EXEC SQL                                                             
              INCLUDE CPD00039                                                  
           END-EXEC.                                                            
      *                                                                         
      *****************************************************************         
      *    CPD00038 INCLUDES:                                                   
      *        7600-START-FCSJC01                                               
      *        7610-READ-FCSJC01                                                
      *        7611-CLOSE                                                       
      *****************************************************************         
A00795*** REPLACES CPD00038 WITH CPDCA038                                       
A00795     EXEC SQL                                                             
A00795         INCLUDE CPDCA038                                                 
A00795     END-EXEC.                                                            
      *                                                                         
C33023*===============================================================*         
C33023 7650-SELECT-AGL-REV-MONTH.                                       
C33023*===============================================================*         
C33023*                                                                         
C33023     EXEC SQL                                                     
C35597          SELECT TOP(1) BN.REVENUE_MONTH                                 
C35597           INTO :WS-AGL-BN-REV-MONTH                              
C35597          FROM CSS_BILL_WINDOW BN WITH(READUNCOMMITTED)                   
C35597          WHERE BN.DATE_EXTRACT <= IIF(TRY_CONVERT(DATE, 
                                                       :BN-DATE-EXTRACT
              ) IS NULL OR (PATINDEX('%.%', :BN-DATE-EXTRACT
              ) <> 0) OR (LEN(:BN-DATE-EXTRACT) <> 10), CIS.CHAR2DATE(
                                                       :BN-DATE-EXTRACT
              ), CONVERT(DATE, :BN-DATE-EXTRACT) )               
C35597          ORDER BY BN.DATE_EXTRACT DESC                           
C35597                  ,BN.REVENUE_MONTH ASC                           
C35597                                            
C35597                                                           
A03352                                                      
C33023     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 BN.REVENUE_MONTH                                         
MFA-TR*          INTO :WS-AGL-BN-REV-MONTH                                      
MFA-TR*         FROM CSS_BILL_WINDOW BN                                         
MFA-TR*         WHERE BN.DATE_EXTRACT <= :BN-DATE-EXTRACT                       
MFA-TR*         ORDER BY BN.DATE_EXTRACT DESC                                   
MFA-TR*                 ,BN.REVENUE_MONTH ASC                                   
MFA-TR*         FETCH FIRST 1 ROW ONLY                                          
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7650                                                     
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

C33023*                                                                         
C33023     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C33023*                                                                         
C33023     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
C33023         CONTINUE                                                 
C33023     ELSE                                                         
C33023         DISPLAY '****************************************'       
C33023         DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
C33023         DISPLAY '**  ABEND IN PARAGRAPH 7650        **'          
C35597         DISPLAY '**  BN-DATE-EXTRACT = ' BN-DATE-EXTRACT         
C33023         DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
C33023         DISPLAY '****************************************'       
C33023         PERFORM 9900-ABEND THRU 9900-EXIT                        
C33023     END-IF.                                                      
C33023*                                                                         
C33023 7650-EXIT.                                                       
C33023     EXIT.                                                        
C33023*                                                                         
C33023*===============================================================*         
C35066 7660-CHECK-AGL-CURR-MONTH-CHRG.                                  
C33023*===============================================================*         
C33023                                                                  
C33023     EXEC SQL                                                     
C33023      SELECT FACTOR                                               
C33023            ,FIXED_FCTR_SEQ_NO                                    
C35597            ,DURATION_REMAIN_NO                                   
C33023      INTO  :FF-FACTOR                                            
C33023           ,:FF-FIXED-FCTR-SEQ-NO                                 
C35597           ,:FF-DURATION-REMAIN-NO :WS-NULL-11                    
C33023      FROM CSS_FIXED_FCTR WITH(READUNCOMMITTED)                           
C33023      WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                       
C33023        AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE                   
C33023        AND IC_NO          = :FF-IC-NO                            
C33023        AND FACTOR_ID      = :WS-AGL-FF-FACTOR-ID                 
C35066                                                           
A03352                                                      
C33023     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*     SELECT FACTOR                                                       
MFA-TR*           ,FIXED_FCTR_SEQ_NO                                            
MFA-TR*           ,DURATION_REMAIN_NO                                           
MFA-TR*     INTO  :FF-FACTOR                                                    
MFA-TR*          ,:FF-FIXED-FCTR-SEQ-NO                                         
MFA-TR*          ,:FF-DURATION-REMAIN-NO :WS-NULL-11                            
MFA-TR*     FROM CSS_FIXED_FCTR                                                 
MFA-TR*     WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                               
MFA-TR*       AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE                           
MFA-TR*       AND IC_NO          = :FF-IC-NO                                    
MFA-TR*       AND FACTOR_ID      = :WS-AGL-FF-FACTOR-ID                         
MFA-TR*       WITH UR                                                           
MFA-TR*       QUERYNO 7660                                                      
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

C33023     MOVE SQLCODE          TO WS-ACTIVE-RETURN-CODE               
C33023                                                                  
C35597     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C35597                              OR NOT-FOUND                        
C35597                              OR WS-811                           
C35597            NEXT SENTENCE                                         
C35597     ELSE                                                         
C33023         DISPLAY '***************************************'        
C33023         DISPLAY '**    PCSBW143 PROCESSING ERROR      **'        
C35066         DISPLAY '**     ABEND IN PARAGRAPH 7660       **'        
C35597         DISPLAY '** ACCOUNT_NO     = ' FF-ACCOUNT-NO             
C35597         DISPLAY '** CODE_UTIL_TYPE = ' FF-CODE-UTIL-TYPE         
C35597         DISPLAY '** FACTOR-ID      = ' WS-AGL-FF-FACTOR-ID       
C35597         DISPLAY '** IC_NO          = ' FF-IC-NO                  
C35597         DISPLAY '** SQLCODE        = ' WS-ACTIVE-RETURN-CODE     
C33023         DISPLAY '***************************************'        
C33023         PERFORM 9900-ABEND                                       
C33023            THRU 9900-EXIT                                        
C35597     END-IF                                                       
C33023     .                                                            
C35066 7660-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
P00246*===============================================================*         
P00246 7665-COUNT-AGL-CURR-MONTH-CHRG.                                  
P00246*===============================================================*         
P00246                                                                  
P00246     EXEC SQL                                                     
P00246         SELECT COALESCE(COUNT(*), 0)                               
P00246           INTO :WS-AGLMTCHRG-COUNT                               
P00246           FROM CSS_FIXED_FCTR WITH(READUNCOMMITTED)                      
P00246          WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                   
P00246            AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE               
P00246            AND IC_NO          = :FF-IC-NO                        
P00246            AND FACTOR_ID      = :WS-AGL-FF-FACTOR-ID             
P00246                                                           
A03352                                                      
P00246     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ029
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT IFNULL(COUNT(*), 0)                                       
MFA-TR*          INTO :WS-AGLMTCHRG-COUNT                                       
MFA-TR*          FROM CSS_FIXED_FCTR                                            
MFA-TR*         WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                           
MFA-TR*           AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE                       
MFA-TR*           AND IC_NO          = :FF-IC-NO                                
MFA-TR*           AND FACTOR_ID      = :WS-AGL-FF-FACTOR-ID                     
MFA-TR*          WITH UR                                                        
MFA-TR*         QUERYNO 7665                                                    
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

P00246                                                                  
P00246     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE         
P00246                                                                  
P00246     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00246        NEXT SENTENCE                                             
P00246     ELSE                                                         
P00246        DISPLAY '***************************************'         
P00246        DISPLAY '**    PCSBW143 PROCESSING ERROR      **'         
P00246        DISPLAY '**     ABEND IN PARAGRAPH 7665       **'         
P00246        DISPLAY '** ACCOUNT_NO     = ' FF-ACCOUNT-NO              
P00246        DISPLAY '** CODE_UTIL_TYPE = ' FF-CODE-UTIL-TYPE          
P00246        DISPLAY '** FACTOR-ID      = ' WS-AGL-FF-FACTOR-ID        
P00246        DISPLAY '** IC_NO          = ' FF-IC-NO                   
P00246        DISPLAY '** SQLCODE        = ' WS-ACTIVE-RETURN-CODE      
P00246        DISPLAY '***************************************'         
P00246        PERFORM 9900-ABEND       THRU 9900-EXIT                   
P00246     END-IF.                                                      
P00246                                                                  
P00246 7665-EXIT.                                                       
P00246     EXIT.                                                        
P00246***                                                                       
C33023*===============================================================*         
C35066 7670-GET-NEXT-FCTR-SEQ.                                          
C33023*===============================================================*         
C33023                                                                  
C33023     EXEC SQL                                                     
C33023          SELECT COALESCE(MAX(FIXED_FCTR_SEQ_NO), 0)                
C33023          INTO  :FF-FIXED-FCTR-SEQ-NO                             
C33023          FROM CSS_FIXED_FCTR WITH(READUNCOMMITTED)                       
C33023          WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                   
C33023            AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE               
C33023            AND IC_NO          = :FF-IC-NO                        
C35066                                                           
A03352                                                      
C33023     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ029
MFA-TR*    EXEC SQL                                                             
MFA-TR*         SELECT IFNULL(MAX(FIXED_FCTR_SEQ_NO), 0)                        
MFA-TR*         INTO  :FF-FIXED-FCTR-SEQ-NO                                     
MFA-TR*         FROM CSS_FIXED_FCTR                                             
MFA-TR*         WHERE ACCOUNT_NO     = :FF-ACCOUNT-NO                           
MFA-TR*           AND CODE_UTIL_TYPE = :FF-CODE-UTIL-TYPE                       
MFA-TR*           AND IC_NO          = :FF-IC-NO                                
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7670                                                    
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

C33023     MOVE SQLCODE         TO WS-ACTIVE-RETURN-CODE                
C33023     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C33023        ADD +1         TO FF-FIXED-FCTR-SEQ-NO                    
C33023     ELSE                                                         
C33023        DISPLAY '****************************************'        
C33023        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
C35066        DISPLAY '**      ABEND IN PARAGRAPH 7670       **'        
C33023        DISPLAY '**  ACCOUNT-NO = ' WS-AGL-ACCOUNT-NO             
C33023        DISPLAY '**  IC-NO      = ' FF-IC-NO                      
C33023        DISPLAY '**  UTIL TYPE  = ' FF-CODE-UTIL-TYPE             
C33023        DISPLAY '**  SQLCODE    = ' WS-ACTIVE-RETURN-CODE         
C33023        DISPLAY '****************************************'        
C33023        PERFORM 9900-ABEND                                        
C33023           THRU 9900-EXIT                                         
C33023     END-IF                                                       
C33023     .                                                            
C33023 7670-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
C35597*===============================================================*         
C35597 7680-GET-DEFLT-DURATION.                                         
C35597*===============================================================*         
C35597                                                                  
C35597     EXEC SQL                                                     
C35597          SELECT SF.DEFLT_DURATION_NO                             
C35597          INTO  :SF-DEFLT-DURATION-NO :WS-NULL-12                 
C35597          FROM CSS_SPCL_FCTR  SF WITH(READUNCOMMITTED)                    
C35597          WHERE SF.FACTOR_ID      = :SF-FACTOR-ID                 
C35597                                                           
A03352                                                      
C35597     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*         SELECT SF.DEFLT_DURATION_NO                                     
MFA-TR*         INTO  :SF-DEFLT-DURATION-NO :WS-NULL-12                         
MFA-TR*         FROM CSS_SPCL_FCTR  SF                                          
MFA-TR*         WHERE SF.FACTOR_ID      = :SF-FACTOR-ID                         
MFA-TR*         WITH UR                                                         
MFA-TR*         QUERYNO 7680                                                    
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

C35597     MOVE SQLCODE         TO WS-ACTIVE-RETURN-CODE                
C35597     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C35597        CONTINUE                                                  
C35597     ELSE                                                         
C35597        DISPLAY '****************************************'        
C35597        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
C35597        DISPLAY '**      ABEND IN PARAGRAPH 7680       **'        
C35597        DISPLAY '**  TABLE      =   CSS_SPCL_FCTR      **'        
C35597        DISPLAY '**  FACTOR ID  = ' SF-FACTOR-ID                  
C35597        DISPLAY '**  SQLCODE    = ' WS-ACTIVE-RETURN-CODE         
C35597        DISPLAY '****************************************'        
C35597        PERFORM 9900-ABEND                                        
C35597           THRU 9900-EXIT                                         
C35597     END-IF                                                       
C35597     .                                                            
C35597 7680-EXIT.                                                       
C35597     EXIT.                                                        
C35597***                                                                       
P00251                                                                  
P00251*===============================================================*         
P00251 7690-SELECT-RATE-COMP-ID.                                        
P00251*===============================================================*         
P00251                                                                  
P00251     EXEC SQL                                                     
P00251        SELECT TOP(1) J1.CMPNT_ID_CD                                    
P00251          INTO :J1-CMPNT-ID-CD                                    
P00251        FROM CSS_RATE_COMP_DEF J1 WITH(READUNCOMMITTED)                   
P00251        WHERE J1.RATE_PLAN_NO  = :J1-RATE-PLAN-NO                 
P00251        AND J1.CODE_UTIL_TYPE  = :J1-CODE-UTIL-TYPE               
P00251        ORDER BY J1.VERSION_NO_CNTRL DESC                         
P00251                                              
P00251                                                           
A03352                                                      
P00251     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT  J1.CMPNT_ID_CD                                            
MFA-TR*         INTO :J1-CMPNT-ID-CD                                            
MFA-TR*       FROM CSS_RATE_COMP_DEF J1                                         
MFA-TR*       WHERE J1.RATE_PLAN_NO  = :J1-RATE-PLAN-NO                         
MFA-TR*       AND J1.CODE_UTIL_TYPE  = :J1-CODE-UTIL-TYPE                       
MFA-TR*       ORDER BY J1.VERSION_NO_CNTRL DESC                                 
MFA-TR*       FETCH FIRST ROW ONLY                                              
MFA-TR*       WITH UR                                                           
MFA-TR*       QUERYNO 7690                                                      
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

P00251                                                                  
P00251     MOVE SQLCODE         TO WS-ACTIVE-RETURN-CODE.               
P00251                                                                  
P00251     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00251        CONTINUE                                                  
P00251     ELSE                                                         
P00251        DISPLAY '****************************************'        
P00251        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
P00251        DISPLAY '**      ABEND IN PARAGRAPH 7690       **'        
P00251        DISPLAY '**  TABLE      =   CSS_RATE_COMP_DEF  **'        
P00251        DISPLAY '**  RATE_PLAN_NO   = ' J1-RATE-PLAN-NO           
P00251        DISPLAY '**  CODE_UTIL_TYPE = ' J1-CODE-UTIL-TYPE         
P00251        DISPLAY '**  SQLCODE        = ' WS-ACTIVE-RETURN-CODE     
P00251        DISPLAY '****************************************'        
P00251        PERFORM 9900-ABEND                                        
P00251           THRU 9900-EXIT                                         
P00251     END-IF                                                       
P00251     .                                                            
P00251 7690-EXIT.                                                       
P00251     EXIT.                                                        
P00251***                                                                       
PRJ914*================================================================*        
PRJ914 7700-GET-CRED-LETTER-IND.                                        
PRJ914*================================================================*        
PRJ914*  GET CREDIT LETTER INDICATOR FROM CSS_SO_FINAL_BILL TABLE.     *        
PRJ914*----------------------------------------------------------------*        
PRJ914                                                                  
PRJ914     EXEC SQL                                                     
PRJ914        SELECT TOP(1) XD.CREDIT_LETTER_IND                              
PRJ914          INTO  :XD-CREDIT-LETTER-IND                             
PRJ914          FROM  CSS_SO_FINAL_BILL XD WITH(READUNCOMMITTED)                
PRJ914               ,CSS_SO_DATA VO WITH(READUNCOMMITTED)                      
PRJ914         WHERE  XD.SERV_ORDER_NO              = VO.SERV_ORDER_NO  
PRJ914           AND  (CIS.SUBSTR3(VO.ORDER_TYPE_CD,1,3) = 'OFF' OR          
PRJ914                 CIS.SUBSTR3(VO.ORDER_TYPE_CD,1,2) = 'CC')             
PRJ914           AND  VO.ORDER_STATE_CD             = 'Z'               
PRJ914           AND  VO.ACCOUNT_NO_PRIOR           = :OC-ACCOUNT-NO    
PRJ914         ORDER BY COMPLETED_DATETIME DESC                         
PRJ914                                       
PRJ914                                                      
PRJ914     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR* MSQ022
MFA-TR* MSQ029
MFA-TR*    EXEC SQL                                                             
MFA-TR*       SELECT  XD.CREDIT_LETTER_IND                                      
MFA-TR*         INTO  :XD-CREDIT-LETTER-IND                                     
MFA-TR*         FROM  CSS_SO_FINAL_BILL XD                                      
MFA-TR*              ,CSS_SO_DATA VO                                            
MFA-TR*        WHERE  XD.SERV_ORDER_NO              = VO.SERV_ORDER_NO          
MFA-TR*          AND  (SUBSTR(VO.ORDER_TYPE_CD,1,3) = 'OFF' OR                  
MFA-TR*                SUBSTR(VO.ORDER_TYPE_CD,1,2) = 'CC')                     
MFA-TR*          AND  VO.ORDER_STATE_CD             = 'Z'                       
MFA-TR*          AND  VO.ACCOUNT_NO_PRIOR           = :OC-ACCOUNT-NO            
MFA-TR*        ORDER BY COMPLETED_DATETIME DESC                                 
MFA-TR*        FETCH FIRST ROW ONLY WITH UR                                     
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

PRJ914                                                                  
PRJ914     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
PRJ914                                                                  
PRJ914     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
PRJ914        CONTINUE                                                  
PRJ914     ELSE                                                         
PRJ914        DISPLAY '***************************************'         
PRJ914        DISPLAY '**    PCSBW143 PROCESSING ERROR      **'         
PRJ914        DISPLAY '**     ABEND IN PARAGRAPH 7700       **'         
PRJ914        DISPLAY '** ACCOUNT_NO     = ' OC-ACCOUNT-NO              
PRJ914        DISPLAY '** ORDER_TYPE_CD  = CC OR OFF'                   
PRJ914        DISPLAY '** SQLCODE        = ' WS-ACTIVE-RETURN-CODE      
PRJ914        DISPLAY '***************************************'         
PRJ914        PERFORM 9900-ABEND       THRU 9900-EXIT                   
PRJ914     END-IF.                                                      
PRJ914                                                                  
PRJ914 7700-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914                                                                  
      **************************************************************            
      *        THIS INCLUDE INSERTS METER CONDITION CODES          *            
      *                    IN IRRGLR_MTR_RD                        *            
      **************************************************************            
      *                                                                         
       8100-INSERT-IRRGLR-MTR-RD.                                       
           EXEC SQL                                                     
               INSERT INTO CSS_IRRGLR_MTR_RD                            
                 (ACCOUNT_NO                                            
                 ,IC_NO                                                 
                 ,CODE_UTIL_TYPE                                        
                 ,METER_REF_NO                                          
                 ,METER_READ_DT                                         
                 ,METER_READ_TM                                         
                 ,METER_READER_ID                                       
                 ,IRRGLR_MTR_CD_1                                       
                 ,IRRGLR_MTR_CD_2                                       
                 ,MTR_RD_COMMENTS)                                      
               VALUES                                                   
                 (:IM-ACCOUNT-NO                                        
                 ,:IM-IC-NO                                             
                 ,:IM-CODE-UTIL-TYPE                                    
                 ,:IM-METER-REF-NO                                      
                 ,IIF(TRY_CONVERT(DATE, :IM-METER-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :IM-METER-READ-DT
              ) <> 0) OR (LEN(:IM-METER-READ-DT) <> 10), CIS.CHAR2DATE(
                                                      :IM-METER-READ-DT
              ), CONVERT(DATE, :IM-METER-READ-DT) )                            
                 ,CIS.CHAR2TIME(:IM-METER-READ-TM)                              
                 ,:IM-METER-READER-ID                                   
                 ,:IM-IRRGLR-MTR-CD-1                                   
                 ,:IM-IRRGLR-MTR-CD-2                                   
                 ,:IM-MTR-RD-COMMENTS)                                  
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        INSERT INTO CSS_IRRGLR_MTR_RD                                    
MFA-TR*          (ACCOUNT_NO                                                    
MFA-TR*          ,IC_NO                                                         
MFA-TR*          ,CODE_UTIL_TYPE                                                
MFA-TR*          ,METER_REF_NO                                                  
MFA-TR*          ,METER_READ_DT                                                 
MFA-TR*          ,METER_READ_TM                                                 
MFA-TR*          ,METER_READER_ID                                               
MFA-TR*          ,IRRGLR_MTR_CD_1                                               
MFA-TR*          ,IRRGLR_MTR_CD_2                                               
MFA-TR*          ,MTR_RD_COMMENTS)                                              
MFA-TR*        VALUES                                                           
MFA-TR*          (:IM-ACCOUNT-NO                                                
MFA-TR*          ,:IM-IC-NO                                                     
MFA-TR*          ,:IM-CODE-UTIL-TYPE                                            
MFA-TR*          ,:IM-METER-REF-NO                                              
MFA-TR*          ,:IM-METER-READ-DT                                             
MFA-TR*          ,:IM-METER-READ-TM                                             
MFA-TR*          ,:IM-METER-READER-ID                                           
MFA-TR*          ,:IM-IRRGLR-MTR-CD-1                                           
MFA-TR*          ,:IM-IRRGLR-MTR-CD-2                                           
MFA-TR*          ,:IM-MTR-RD-COMMENTS)                                          
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8100       **'           
               DISPLAY '**      ACCOUNT-NO    = ' IM-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' IM-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' IM-IC-NO              
               DISPLAY '**      MTR-REF-NO    = ' IM-METER-REF-NO       
               DISPLAY '**      READ DATE     = ' IM-METER-READ-DT      
               DISPLAY '**      READ TIME     = ' IM-METER-READ-DT      
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      *        THIS INCLUDE INSERTS METER INFORMATION              *            
      *                    IN ROUTE REPORT                         *            
      **************************************************************            
       8200-INSERT-ROUTE-REPORT.                                        
      *                                                                         
           EXEC SQL                                                     
               INSERT INTO CSS_ROUTE_REPORT                             
                 (ACCOUNT_NO                                            
                 ,CODE_UTIL_TYPE                                        
                 ,IC_NO                                                 
                 ,LAST_REG_READ_DT                                      
                 ,LAST_REG_READ_TM                                      
                 ,CODE_TIME_PERIOD                                      
                 ,CODE_TOU_SEASN                                        
                 ,LOCAL_OFFICE                                          
                 ,METER_NO                                              
                 ,METER_READER_ID                                       
                 ,READ_CYCLE                                            
                 ,READ_ROUTE                                            
                 ,READING_CODE                                          
                 ,READING_COND_CD                                       
                 ,REG_MEASURE_CD                                        
                 ,REGISTER_RD_SEQ                                       
                 ,REVENUE_MONTH                                         
                 ,TYPE_OF_RD_IND                                        
                 ,BILL_CYCLE                                            
                 ,METER_READING                                         
                 ,COMPANY_NO                                            
                 ,CODE_MAKE                                             
                 ,MTR_REF_NO                                            
                 ,CONSTANT                                              
                 ,MTR_READ_SOURCE_CD                                    
P00251           ,CODE_USAGE_TYPE                                       
P00251           ,CODE_USAGE_ID                                         
P00251           ,CODE_USAGE_SOURCE                                     
P00251           ,CNSMPTN_READ_FL                                       
P00251           ,INDEX_VALUE_CD                                        
P00251           ,READ_PROCESS_CD                                       
P00251           ,READ_STATUS_CD                                        
                 ,PREV_METER_READING)                                   
               VALUES                                                   
                 (:PW-ACCOUNT-NO                                        
                 ,:PW-CODE-UTIL-TYPE                                    
                 ,:PW-IC-NO                                             
C35066           ,IIF(TRY_CONVERT(DATE, :PW-LAST-REG-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :PW-LAST-REG-READ-DT
              ) <> 0) OR (LEN(:PW-LAST-REG-READ-DT
              ) <> 10), CIS.CHAR2DATE(:PW-LAST-REG-READ-DT
              ), CONVERT(DATE, :PW-LAST-REG-READ-DT) )                         
C35066           ,CIS.CHAR2TIME(:PW-LAST-REG-READ-TM)                           
                 ,:PW-CODE-TIME-PERIOD                                  
                 ,:PW-CODE-TOU-SEASN                                    
                 ,:PW-LOCAL-OFFICE                                      
                 ,:PW-METER-NO                                          
                 ,:PW-METER-READER-ID                                   
                 ,:PW-READ-CYCLE                                        
                 ,:PW-READ-ROUTE                                        
                 ,:PW-READING-CODE                                      
                 ,:PW-READING-COND-CD                                   
                 ,:PW-REG-MEASURE-CD                                    
                 ,:PW-REGISTER-RD-SEQ                                   
                 ,:PW-REVENUE-MONTH                                     
                 ,:PW-TYPE-OF-RD-IND                                    
                 ,:PW-BILL-CYCLE                                        
                 ,:PW-METER-READING                                     
                 ,:PW-COMPANY-NO                                        
                 ,:PW-CODE-MAKE                                         
                 ,:PW-MTR-REF-NO                                        
                 ,:PW-CONSTANT                                          
                 ,:PW-MTR-READ-SOURCE-CD                                
P00251           ,:PW-CODE-USAGE-TYPE                                   
P00251           ,:PW-CODE-USAGE-ID                                     
P00251           ,:PW-CODE-USAGE-SOURCE                                 
P00251           ,:PW-CNSMPTN-READ-FL                                   
P00251           ,:PW-INDEX-VALUE-CD                                    
P00251           ,:PW-READ-PROCESS-CD                                   
P00251           ,:PW-READ-STATUS-CD                                    
                 ,:PW-PREV-METER-READING)                               
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        INSERT INTO CSS_ROUTE_REPORT                                     
MFA-TR*          (ACCOUNT_NO                                                    
MFA-TR*          ,CODE_UTIL_TYPE                                                
MFA-TR*          ,IC_NO                                                         
MFA-TR*          ,LAST_REG_READ_DT                                              
MFA-TR*          ,LAST_REG_READ_TM                                              
MFA-TR*          ,CODE_TIME_PERIOD                                              
MFA-TR*          ,CODE_TOU_SEASN                                                
MFA-TR*          ,LOCAL_OFFICE                                                  
MFA-TR*          ,METER_NO                                                      
MFA-TR*          ,METER_READER_ID                                               
MFA-TR*          ,READ_CYCLE                                                    
MFA-TR*          ,READ_ROUTE                                                    
MFA-TR*          ,READING_CODE                                                  
MFA-TR*          ,READING_COND_CD                                               
MFA-TR*          ,REG_MEASURE_CD                                                
MFA-TR*          ,REGISTER_RD_SEQ                                               
MFA-TR*          ,REVENUE_MONTH                                                 
MFA-TR*          ,TYPE_OF_RD_IND                                                
MFA-TR*          ,BILL_CYCLE                                                    
MFA-TR*          ,METER_READING                                                 
MFA-TR*          ,COMPANY_NO                                                    
MFA-TR*          ,CODE_MAKE                                                     
MFA-TR*          ,MTR_REF_NO                                                    
MFA-TR*          ,CONSTANT                                                      
MFA-TR*          ,MTR_READ_SOURCE_CD                                            
MFA-TR*          ,CODE_USAGE_TYPE                                               
MFA-TR*          ,CODE_USAGE_ID                                                 
MFA-TR*          ,CODE_USAGE_SOURCE                                             
MFA-TR*          ,CNSMPTN_READ_FL                                               
MFA-TR*          ,INDEX_VALUE_CD                                                
MFA-TR*          ,READ_PROCESS_CD                                               
MFA-TR*          ,READ_STATUS_CD                                                
MFA-TR*          ,PREV_METER_READING)                                           
MFA-TR*        VALUES                                                           
MFA-TR*          (:PW-ACCOUNT-NO                                                
MFA-TR*          ,:PW-CODE-UTIL-TYPE                                            
MFA-TR*          ,:PW-IC-NO                                                     
MFA-TR*          ,:PW-LAST-REG-READ-DT                                          
MFA-TR*          ,:PW-LAST-REG-READ-TM                                          
MFA-TR*          ,:PW-CODE-TIME-PERIOD                                          
MFA-TR*          ,:PW-CODE-TOU-SEASN                                            
MFA-TR*          ,:PW-LOCAL-OFFICE                                              
MFA-TR*          ,:PW-METER-NO                                                  
MFA-TR*          ,:PW-METER-READER-ID                                           
MFA-TR*          ,:PW-READ-CYCLE                                                
MFA-TR*          ,:PW-READ-ROUTE                                                
MFA-TR*          ,:PW-READING-CODE                                              
MFA-TR*          ,:PW-READING-COND-CD                                           
MFA-TR*          ,:PW-REG-MEASURE-CD                                            
MFA-TR*          ,:PW-REGISTER-RD-SEQ                                           
MFA-TR*          ,:PW-REVENUE-MONTH                                             
MFA-TR*          ,:PW-TYPE-OF-RD-IND                                            
MFA-TR*          ,:PW-BILL-CYCLE                                                
MFA-TR*          ,:PW-METER-READING                                             
MFA-TR*          ,:PW-COMPANY-NO                                                
MFA-TR*          ,:PW-CODE-MAKE                                                 
MFA-TR*          ,:PW-MTR-REF-NO                                                
MFA-TR*          ,:PW-CONSTANT                                                  
MFA-TR*          ,:PW-MTR-READ-SOURCE-CD                                        
MFA-TR*          ,:PW-CODE-USAGE-TYPE                                           
MFA-TR*          ,:PW-CODE-USAGE-ID                                             
MFA-TR*          ,:PW-CODE-USAGE-SOURCE                                         
MFA-TR*          ,:PW-CNSMPTN-READ-FL                                           
MFA-TR*          ,:PW-INDEX-VALUE-CD                                            
MFA-TR*          ,:PW-READ-PROCESS-CD                                           
MFA-TR*          ,:PW-READ-STATUS-CD                                            
MFA-TR*          ,:PW-PREV-METER-READING)                                       
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8200       **'           
               DISPLAY '**      ACCOUNT-NO    = ' PW-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' PW-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' PW-IC-NO              
               DISPLAY '**      METER-NO      = ' PW-METER-NO           
               DISPLAY '**      REVENUE MONTH = ' PW-REVENUE-MONTH      
               DISPLAY '**      READ DATE     = ' PW-LAST-REG-READ-DT   
               DISPLAY '**      READ TIME     = ' PW-LAST-REG-READ-TM   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8200-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      *        THIS INCLUDE UPDATES METER INFORMATION              *            
      *                    IN ROUTE REPORT                         *            
      **************************************************************            
       8250-UPDATE-ROUTE-REPORT.                                        
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_ROUTE_REPORT                                  
                  SET LOCAL_OFFICE       = :PW-LOCAL-OFFICE             
                     ,METER_READER_ID    = :PW-METER-READER-ID          
                     ,READ_CYCLE         = :PW-READ-CYCLE               
                     ,READ_ROUTE         = :PW-READ-ROUTE               
                     ,READING_CODE       = :PW-READING-CODE             
                     ,READING_COND_CD    = :PW-READING-COND-CD          
                     ,REGISTER_RD_SEQ    = :PW-REGISTER-RD-SEQ          
                     ,TYPE_OF_RD_IND     = :PW-TYPE-OF-RD-IND           
                     ,BILL_CYCLE         = :PW-BILL-CYCLE               
                     ,METER_READING      = :PW-METER-READING            
                     ,COMPANY_NO         = :PW-COMPANY-NO               
                     ,MTR_REF_NO         = :PW-MTR-REF-NO               
                     ,CONSTANT           = :PW-CONSTANT                 
                     ,MTR_READ_SOURCE_CD = :PW-MTR-READ-SOURCE-CD       
                     ,PREV_METER_READING = :PW-PREV-METER-READING       
                WHERE ACCOUNT_NO       = :PW-ACCOUNT-NO                 
                  AND CODE_UTIL_TYPE   = :PW-CODE-UTIL-TYPE             
                  AND IC_NO            = :PW-IC-NO                      
                  AND LAST_REG_READ_DT = IIF(TRY_CONVERT(DATE, 
                                                   :PW-LAST-REG-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :PW-LAST-REG-READ-DT
              ) <> 0) OR (LEN(:PW-LAST-REG-READ-DT
              ) <> 10), CIS.CHAR2DATE(:PW-LAST-REG-READ-DT
              ), CONVERT(DATE, :PW-LAST-REG-READ-DT) )           
                  AND LAST_REG_READ_TM = CIS.CHAR2TIME(
                                                   :PW-LAST-REG-READ-TM
              )           
                  AND REVENUE_MONTH    = :PW-REVENUE-MONTH              
                  AND METER_NO         = :PW-METER-NO                   
                  AND REG_MEASURE_CD   = :PW-REG-MEASURE-CD             
                  AND CODE_TIME_PERIOD = :PW-CODE-TIME-PERIOD           
                  AND CODE_TOU_SEASN   = :PW-CODE-TOU-SEASN             
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ROUTE_REPORT                                          
MFA-TR*           SET LOCAL_OFFICE       = :PW-LOCAL-OFFICE                     
MFA-TR*              ,METER_READER_ID    = :PW-METER-READER-ID                  
MFA-TR*              ,READ_CYCLE         = :PW-READ-CYCLE                       
MFA-TR*              ,READ_ROUTE         = :PW-READ-ROUTE                       
MFA-TR*              ,READING_CODE       = :PW-READING-CODE                     
MFA-TR*              ,READING_COND_CD    = :PW-READING-COND-CD                  
MFA-TR*              ,REGISTER_RD_SEQ    = :PW-REGISTER-RD-SEQ                  
MFA-TR*              ,TYPE_OF_RD_IND     = :PW-TYPE-OF-RD-IND                   
MFA-TR*              ,BILL_CYCLE         = :PW-BILL-CYCLE                       
MFA-TR*              ,METER_READING      = :PW-METER-READING                    
MFA-TR*              ,COMPANY_NO         = :PW-COMPANY-NO                       
MFA-TR*              ,MTR_REF_NO         = :PW-MTR-REF-NO                       
MFA-TR*              ,CONSTANT           = :PW-CONSTANT                         
MFA-TR*              ,MTR_READ_SOURCE_CD = :PW-MTR-READ-SOURCE-CD               
MFA-TR*              ,PREV_METER_READING = :PW-PREV-METER-READING               
MFA-TR*         WHERE ACCOUNT_NO       = :PW-ACCOUNT-NO                         
MFA-TR*           AND CODE_UTIL_TYPE   = :PW-CODE-UTIL-TYPE                     
MFA-TR*           AND IC_NO            = :PW-IC-NO                              
MFA-TR*           AND LAST_REG_READ_DT = :PW-LAST-REG-READ-DT                   
MFA-TR*           AND LAST_REG_READ_TM = :PW-LAST-REG-READ-TM                   
MFA-TR*           AND REVENUE_MONTH    = :PW-REVENUE-MONTH                      
MFA-TR*           AND METER_NO         = :PW-METER-NO                           
MFA-TR*           AND REG_MEASURE_CD   = :PW-REG-MEASURE-CD                     
MFA-TR*           AND CODE_TIME_PERIOD = :PW-CODE-TIME-PERIOD                   
MFA-TR*           AND CODE_TOU_SEASN   = :PW-CODE-TOU-SEASN                     
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8250       **'           
               DISPLAY '**      ACCOUNT-NO    = ' PW-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' PW-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' PW-IC-NO              
               DISPLAY '**      METER-NO      = ' PW-METER-NO           
               DISPLAY '**      REVENUE MONTH = ' PW-REVENUE-MONTH      
               DISPLAY '**      READ DATE     = ' PW-LAST-REG-READ-DT   
               DISPLAY '**      READ TIME     = ' PW-LAST-REG-READ-TM   
               DISPLAY '**      TIME-PERIOD   = ' PW-CODE-TIME-PERIOD   
               DISPLAY '**      SEASN-CODE    = ' PW-CODE-TOU-SEASN     
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8250-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*==============================================================*          
C35066 8260-UPDATE-DUP-ROUTE-REPORT.                                    
C35066*==============================================================*          
C35066*                                                                         
C35066     EXEC SQL                                                     
C35066         UPDATE CSS_ROUTE_REPORT                                  
C35066            SET TYPE_OF_RD_IND   = :WS-UPD-TYPE-OF-RD-IND         
C35066          WHERE ACCOUNT_NO       = :PW-ACCOUNT-NO                 
C35066            AND REVENUE_MONTH    = :PW-REVENUE-MONTH              
C35066            AND CODE_UTIL_TYPE   = :PW-CODE-UTIL-TYPE             
C35066            AND IC_NO            = :PW-IC-NO                      
C35066            AND METER_NO         = :PW-METER-NO                   
C35066            AND REG_MEASURE_CD   = :WS-REG-MEASURE-CD             
C35066            AND CODE_TIME_PERIOD = :PW-CODE-TIME-PERIOD           
C35066            AND CODE_TOU_SEASN   = :PW-CODE-TOU-SEASN             
C35066            AND LAST_REG_READ_DT = IIF(TRY_CONVERT(DATE, 
                                                   :WS-LAST-REG-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :WS-LAST-REG-READ-DT
              ) <> 0) OR (LEN(:WS-LAST-REG-READ-DT
              ) <> 10), CIS.CHAR2DATE(:WS-LAST-REG-READ-DT
              ), CONVERT(DATE, :WS-LAST-REG-READ-DT) )           
C35066            AND LAST_REG_READ_TM = CIS.CHAR2TIME(
                                                   :WS-LAST-REG-READ-TM
              )           
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ROUTE_REPORT                                          
MFA-TR*           SET TYPE_OF_RD_IND   = :WS-UPD-TYPE-OF-RD-IND                 
MFA-TR*         WHERE ACCOUNT_NO       = :PW-ACCOUNT-NO                         
MFA-TR*           AND REVENUE_MONTH    = :PW-REVENUE-MONTH                      
MFA-TR*           AND CODE_UTIL_TYPE   = :PW-CODE-UTIL-TYPE                     
MFA-TR*           AND IC_NO            = :PW-IC-NO                              
MFA-TR*           AND METER_NO         = :PW-METER-NO                           
MFA-TR*           AND REG_MEASURE_CD   = :WS-REG-MEASURE-CD                     
MFA-TR*           AND CODE_TIME_PERIOD = :PW-CODE-TIME-PERIOD                   
MFA-TR*           AND CODE_TOU_SEASN   = :PW-CODE-TOU-SEASN                     
MFA-TR*           AND LAST_REG_READ_DT = :WS-LAST-REG-READ-DT                   
MFA-TR*           AND LAST_REG_READ_TM = :WS-LAST-REG-READ-TM                   
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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
C35066         CONTINUE                                                 
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
C35066         DISPLAY '**  ABEND IN PARAGRAPH 8260       **'           
C35066         DISPLAY '*** SQLCODE = ' WS-ACTIVE-RETURN-CODE           
C35066         DISPLAY '** ACCOUNT_NO       = ' PW-ACCOUNT-NO           
C35066         DISPLAY '** REVENUE_MONTH    = ' PW-REVENUE-MONTH        
C35066         DISPLAY '** CODE_UTIL_TYPE   = ' PW-CODE-UTIL-TYPE       
C35066         DISPLAY '** IC_NO            = ' PW-IC-NO                
C35066         DISPLAY '** METER_NO         = ' PW-METER-NO             
C35066         DISPLAY '** REG_MEASURE_CD   = ' PW-REG-MEASURE-CD       
C35066         DISPLAY '** CODE_TIME_PERIOD = ' PW-CODE-TIME-PERIOD     
C35066         DISPLAY '** CODE_TOU_SEASN   = ' PW-CODE-TOU-SEASN       
C35066         DISPLAY '** LAST_REG_READ_DT = ' WS-LAST-REG-READ-DT     
C35066         DISPLAY '** LAST_REG_READ_TM = ' WS-LAST-REG-READ-TM     
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 8260-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
      **************************************************************            
      *        THIS INCLUDE UPDATES THE MTRD_ENVRNMT               *            
      **************************************************************            
       8300-UPDATE-MTRD-ENVRNMT.                                        
      *                                                                         
           EXEC SQL                                                     
              UPDATE CSS_MTRD_ENVRNMT                                   
                 SET CODE_NO_RD_REASON    =  :MN-CODE-NO-RD-REASON      
                    ,CODE_LAST_REG_READ   =  :MN-CODE-LAST-REG-READ     
                    ,LAST_REG_READ_DATE   =  IIF(TRY_CONVERT(DATE, 
                                                :MN-LAST-REG-READ-DATE 
                                                             :WS-NULL-1
              ) IS NULL OR (PATINDEX('%.%', :MN-LAST-REG-READ-DATE 
                                                             :WS-NULL-1
              ) <> 0) OR (LEN(:MN-LAST-REG-READ-DATE :WS-NULL-1
              ) <> 10), CIS.CHAR2DATE(:MN-LAST-REG-READ-DATE :WS-NULL-1
              ), CONVERT(DATE, :MN-LAST-REG-READ-DATE :WS-NULL-1) )            
                    ,LAST_REG_READ_TIME   =  CIS.CHAR2TIME(
                                                :MN-LAST-REG-READ-TIME 
                                                           :WS-NULL-2)         
                    ,LAST_READ_VALUE      =  :MN-LAST-READ-VALUE        
                    ,LAST_VALID_READ_DT   =  IIF(TRY_CONVERT(DATE, 
                                                :MN-LAST-VALID-READ-DT 
                                                             :WS-NULL-3
              ) IS NULL OR (PATINDEX('%.%', :MN-LAST-VALID-READ-DT 
                                                             :WS-NULL-3
              ) <> 0) OR (LEN(:MN-LAST-VALID-READ-DT :WS-NULL-3
              ) <> 10), CIS.CHAR2DATE(:MN-LAST-VALID-READ-DT :WS-NULL-3
              ), CONVERT(DATE, :MN-LAST-VALID-READ-DT :WS-NULL-3) )            
                    ,LAST_VALID_READ_TM   =  CIS.CHAR2TIME(
                                                :MN-LAST-VALID-READ-TM 
                                                           :WS-NULL-4)         
                    ,LAST_VAL_RD_VALUE    =  :MN-LAST-VAL-RD-VALUE      
                    ,CODE_LAST_VALID_RD   =  :MN-CODE-LAST-VALID-RD     
                    ,NO_CONSEC_ESTIMATE   =  :MN-NO-CONSEC-ESTIMATE     
                    ,NO_CONSEC_CRD_READ   =  :MN-NO-CONSEC-CRD-READ     
                    ,CODE_CRNT_REG_READ   =  :MN-CODE-CRNT-REG-READ     
                    ,EST_USAGE            =  :MN-EST-USAGE              
                    ,LAST_UPDATE_TS       =  CIS.CURRENT$TIMESTAMP()          
               WHERE ACCOUNT_NO           =  :MN-ACCOUNT-NO             
                 AND CODE_UTIL_TYPE       =  :MN-CODE-UTIL-TYPE         
                 AND IC_NO                =  :MN-IC-NO                  
                 AND MTR_REF_NO           =  :MN-MTR-REF-NO             
                 AND METER_NO             =  :MN-METER-NO               
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_MTRD_ENVRNMT                                           
MFA-TR*          SET CODE_NO_RD_REASON    =  :MN-CODE-NO-RD-REASON              
MFA-TR*             ,CODE_LAST_REG_READ   =  :MN-CODE-LAST-REG-READ             
MFA-TR*             ,LAST_REG_READ_DATE   =  :MN-LAST-REG-READ-DATE             
MFA-TR*                                      :WS-NULL-1                         
MFA-TR*             ,LAST_REG_READ_TIME   =  :MN-LAST-REG-READ-TIME             
MFA-TR*                                      :WS-NULL-2                         
MFA-TR*             ,LAST_READ_VALUE      =  :MN-LAST-READ-VALUE                
MFA-TR*             ,LAST_VALID_READ_DT   =  :MN-LAST-VALID-READ-DT             
MFA-TR*                                      :WS-NULL-3                         
MFA-TR*             ,LAST_VALID_READ_TM   =  :MN-LAST-VALID-READ-TM             
MFA-TR*                                      :WS-NULL-4                         
MFA-TR*             ,LAST_VAL_RD_VALUE    =  :MN-LAST-VAL-RD-VALUE              
MFA-TR*             ,CODE_LAST_VALID_RD   =  :MN-CODE-LAST-VALID-RD             
MFA-TR*             ,NO_CONSEC_ESTIMATE   =  :MN-NO-CONSEC-ESTIMATE             
MFA-TR*             ,NO_CONSEC_CRD_READ   =  :MN-NO-CONSEC-CRD-READ             
MFA-TR*             ,CODE_CRNT_REG_READ   =  :MN-CODE-CRNT-REG-READ             
MFA-TR*             ,EST_USAGE            =  :MN-EST-USAGE                      
MFA-TR*             ,LAST_UPDATE_TS       =  CURRENT TIMESTAMP                  
MFA-TR*        WHERE ACCOUNT_NO           =  :MN-ACCOUNT-NO                     
MFA-TR*          AND CODE_UTIL_TYPE       =  :MN-CODE-UTIL-TYPE                 
MFA-TR*          AND IC_NO                =  :MN-IC-NO                          
MFA-TR*          AND MTR_REF_NO           =  :MN-MTR-REF-NO                     
MFA-TR*          AND METER_NO             =  :MN-METER-NO                       
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8300       **'           
               DISPLAY '**      ACCOUNT-NO    = ' MN-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' MN-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' MN-IC-NO              
               DISPLAY '**      METER-NO      = ' MN-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' MN-MTR-REF-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8300-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      *        THIS INCLUDE UPDATES THE REGISTER_READ              *            
      **************************************************************            
       8350-UPDATE-REGISTER-READ.                                       
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_REGISTER_READ                                 
                  SET CODE_CRNT_REG_READ   =  :RG-CODE-CRNT-REG-READ    
                     ,CODE_LAST_REG_READ   =  :RG-CODE-LAST-REG-READ    
                     ,CODE_NO_RD_REASON    =  :RG-CODE-NO-RD-REASON     
                     ,LAST_READ_VALUE      =  :RG-LAST-READ-VALUE       
                     ,LAST_REG_READ_DT     =  IIF(TRY_CONVERT(DATE, 
                                                   :RG-LAST-REG-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :RG-LAST-REG-READ-DT
              ) <> 0) OR (LEN(:RG-LAST-REG-READ-DT
              ) <> 10), CIS.CHAR2DATE(:RG-LAST-REG-READ-DT
              ), CONVERT(DATE, :RG-LAST-REG-READ-DT) )      
                     ,LAST_REG_READ_TM     =  CIS.CHAR2TIME(
                                                   :RG-LAST-REG-READ-TM
              )      
                     ,CODE_LAST_VALID_RD   =  :RG-CODE-LAST-VALID-RD    
                     ,LAST_VALID_READ_DT   =  IIF(TRY_CONVERT(DATE, 
                                                 :RG-LAST-VALID-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :RG-LAST-VALID-READ-DT
              ) <> 0) OR (LEN(:RG-LAST-VALID-READ-DT
              ) <> 10), CIS.CHAR2DATE(:RG-LAST-VALID-READ-DT
              ), CONVERT(DATE, :RG-LAST-VALID-READ-DT) )    
                     ,LAST_VALID_READ_TM   =  CIS.CHAR2TIME(
                                                 :RG-LAST-VALID-READ-TM
              )    
                     ,LAST_VAL_RD_VALUE    =  :RG-LAST-VAL-RD-VALUE     
                     ,LAST_UPDATE_TS       =  CIS.CURRENT$TIMESTAMP()         
                WHERE ACCOUNT_NO           =  :RG-ACCOUNT-NO            
                  AND CODE_UTIL_TYPE       =  :RG-CODE-UTIL-TYPE        
                  AND IC_NO                =  :RG-IC-NO                 
                  AND MTR_REF_NO           =  :RG-MTR-REF-NO            
                  AND REG_ID_NO            =  :RG-REG-ID-NO             
                  AND CODE_TIME_PERIOD     =  :RG-CODE-TIME-PERIOD      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_REGISTER_READ                                         
MFA-TR*           SET CODE_CRNT_REG_READ   =  :RG-CODE-CRNT-REG-READ            
MFA-TR*              ,CODE_LAST_REG_READ   =  :RG-CODE-LAST-REG-READ            
MFA-TR*              ,CODE_NO_RD_REASON    =  :RG-CODE-NO-RD-REASON             
MFA-TR*              ,LAST_READ_VALUE      =  :RG-LAST-READ-VALUE               
MFA-TR*              ,LAST_REG_READ_DT     =  :RG-LAST-REG-READ-DT              
MFA-TR*              ,LAST_REG_READ_TM     =  :RG-LAST-REG-READ-TM              
MFA-TR*              ,CODE_LAST_VALID_RD   =  :RG-CODE-LAST-VALID-RD            
MFA-TR*              ,LAST_VALID_READ_DT   =  :RG-LAST-VALID-READ-DT            
MFA-TR*              ,LAST_VALID_READ_TM   =  :RG-LAST-VALID-READ-TM            
MFA-TR*              ,LAST_VAL_RD_VALUE    =  :RG-LAST-VAL-RD-VALUE             
MFA-TR*              ,LAST_UPDATE_TS       =  CURRENT TIMESTAMP                 
MFA-TR*         WHERE ACCOUNT_NO           =  :RG-ACCOUNT-NO                    
MFA-TR*           AND CODE_UTIL_TYPE       =  :RG-CODE-UTIL-TYPE                
MFA-TR*           AND IC_NO                =  :RG-IC-NO                         
MFA-TR*           AND MTR_REF_NO           =  :RG-MTR-REF-NO                    
MFA-TR*           AND REG_ID_NO            =  :RG-REG-ID-NO                     
MFA-TR*           AND CODE_TIME_PERIOD     =  :RG-CODE-TIME-PERIOD              
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8350       **'           
               DISPLAY '**      ACCOUNT-NO    = ' RG-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' RG-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' RG-IC-NO              
               DISPLAY '**      METER-NO      = ' RG-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' RG-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' RG-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' RG-CODE-TIME-PERIOD   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8350-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      *        THIS INCLUDE UPDATES THE REGISTER_READ              *            
      **************************************************************            
       8360-UPDATE-RG-READ-CD.                                          
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_REGISTER_READ                                 
                  SET CODE_CRNT_REG_READ   =  :RG-CODE-CRNT-REG-READ    
                     ,LAST_UPDATE_TS       =  CIS.CURRENT$TIMESTAMP()         
                WHERE ACCOUNT_NO           =  :RG-ACCOUNT-NO            
                  AND CODE_UTIL_TYPE       =  :RG-CODE-UTIL-TYPE        
                  AND IC_NO                =  :RG-IC-NO                 
                  AND MTR_REF_NO           =  :RG-MTR-REF-NO            
                  AND REG_ID_NO            =  :RG-REG-ID-NO             
                  AND CODE_TIME_PERIOD     =  :RG-CODE-TIME-PERIOD      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_REGISTER_READ                                         
MFA-TR*           SET CODE_CRNT_REG_READ   =  :RG-CODE-CRNT-REG-READ            
MFA-TR*              ,LAST_UPDATE_TS       =  CURRENT TIMESTAMP                 
MFA-TR*         WHERE ACCOUNT_NO           =  :RG-ACCOUNT-NO                    
MFA-TR*           AND CODE_UTIL_TYPE       =  :RG-CODE-UTIL-TYPE                
MFA-TR*           AND IC_NO                =  :RG-IC-NO                         
MFA-TR*           AND MTR_REF_NO           =  :RG-MTR-REF-NO                    
MFA-TR*           AND REG_ID_NO            =  :RG-REG-ID-NO                     
MFA-TR*           AND CODE_TIME_PERIOD     =  :RG-CODE-TIME-PERIOD              
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8360       **'           
               DISPLAY '**      ACCOUNT-NO    = ' RG-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' RG-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' RG-IC-NO              
               DISPLAY '**      METER-NO      = ' RG-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' RG-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' RG-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' RG-CODE-TIME-PERIOD   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8360-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      *        THIS INCLUDE INSERTS READINGS                       *            
      *                    IN CONSUMPTION HISTORY                  *            
      **************************************************************            
      *                                                                         
       8400-ISRT-CNSMPTN-HIST.                                          
      *                                                                         
           EXEC SQL                                                     
                INSERT INTO CSS_CNSMPTN_HIST                            
                      (ACCOUNT_NO                                       
                      ,BILL_NO                                          
                      ,CODE_UTIL_TYPE                                   
                      ,IC_NO                                            
                      ,BILL_ITEM_TIMESTMP                               
                      ,CODE_TIME_PERIOD                                 
                      ,MTR_REF_NO                                       
                      ,CODE_USAGE_TYPE                                  
                      ,CODE_USAGE_ID                                    
                      ,CODE_USAGE_SOURCE                                
                      ,ITEM_SEQ_NO                                      
                      ,METER_NO                                         
                      ,REG_ID_NO                                        
                      ,DATE_READ                                        
                      ,CODE_METER_READ                                  
                      ,CODE_METER_NO_READ                               
                      ,METER_READING                                    
                      ,DEMAND_READING                                   
                      ,EMPLOYEE_NO                                      
                      ,NO_UNITS                                         
                      ,NO_DEMAND_UNITS                                  
                      ,NO_DAYS                                          
                      ,CODE_SOURCE_ID                                   
                      ,CODE_DEBIT_CREDIT                                
                      ,CODE_ITEM_STATUS                                 
                      ,CODE_DISCOUNT                                    
                      ,CONSTANT                                         
                      ,NO_DIALS                                         
                      ,CODE_TOU_SEASN                                   
                      ,COMPANY_NO                                       
                      ,MTR_READ_SOURCE_CD                               
                      ,DIGTL_MTR_TYPE                                   
                      ,EXCEPT_OVERRIDE_CD                               
                      ,REQUESTED_USAGE                                  
                      ,DIGTL_INTRL_MTR_NO                               
                      ,EXCL_DMD_RCHT_IND                                
                      ,BTU_FACTOR                                       
30989                 ,PCOMP_FCT)                                       
                VALUES                                                  
                      (:CX-ACCOUNT-NO                                   
                      ,:CX-BILL-NO                                      
                      ,:CX-CODE-UTIL-TYPE                               
                      ,:CX-IC-NO                                        
                      ,CIS.CHAR2TIMESTAMP(:CX-BILL-ITEM-TIMESTMP)               
                      ,:CX-CODE-TIME-PERIOD                             
                      ,:CX-MTR-REF-NO                                   
                      ,:CX-CODE-USAGE-TYPE                              
                      ,:CX-CODE-USAGE-ID                                
                      ,:CX-CODE-USAGE-SOURCE                            
                      ,:CX-ITEM-SEQ-NO                                  
                      ,:CX-METER-NO                                     
                      ,:CX-REG-ID-NO                                    
                      ,IIF(TRY_CONVERT(DATE, :CX-DATE-READ 
                                             :WS-CX-DATE-READ-NULL
              ) IS NULL OR (PATINDEX('%.%', :CX-DATE-READ 
                                                  :WS-CX-DATE-READ-NULL
              ) <> 0) OR (LEN(:CX-DATE-READ :WS-CX-DATE-READ-NULL
              ) <> 10), CIS.CHAR2DATE(:CX-DATE-READ 
                                                  :WS-CX-DATE-READ-NULL
              ), CONVERT(DATE, :CX-DATE-READ :WS-CX-DATE-READ-NULL) )          
                      ,:CX-CODE-METER-READ                              
                      ,:CX-CODE-METER-NO-READ                           
                      ,:CX-METER-READING                                
                      ,:CX-DEMAND-READING                               
                      ,:CX-EMPLOYEE-NO                                  
                      ,:CX-NO-UNITS                                     
                      ,:CX-NO-DEMAND-UNITS                              
                      ,:CX-NO-DAYS                                      
                      ,:CX-CODE-SOURCE-ID                               
                      ,:CX-CODE-DEBIT-CREDIT                            
                      ,:CX-CODE-ITEM-STATUS                             
                      ,:CX-CODE-DISCOUNT                                
                      ,:CX-CONSTANT                                     
                      ,:CX-NO-DIALS                                     
                      ,:CX-CODE-TOU-SEASN                               
                      ,:CX-COMPANY-NO                                   
                      ,:CX-MTR-READ-SOURCE-CD                           
                      ,:CX-DIGTL-MTR-TYPE                               
                      ,:CX-EXCEPT-OVERRIDE-CD                           
                      ,:CX-REQUESTED-USAGE                              
                      ,:CX-DIGTL-INTRL-MTR-NO                           
                      ,:CX-EXCL-DMD-RCHT-IND                            
                      ,:CX-BTU-FACTOR                                   
30989                 ,:CX-PCOMP-FCT)                                   
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*         INSERT INTO CSS_CNSMPTN_HIST                                    
MFA-TR*               (ACCOUNT_NO                                               
MFA-TR*               ,BILL_NO                                                  
MFA-TR*               ,CODE_UTIL_TYPE                                           
MFA-TR*               ,IC_NO                                                    
MFA-TR*               ,BILL_ITEM_TIMESTMP                                       
MFA-TR*               ,CODE_TIME_PERIOD                                         
MFA-TR*               ,MTR_REF_NO                                               
MFA-TR*               ,CODE_USAGE_TYPE                                          
MFA-TR*               ,CODE_USAGE_ID                                            
MFA-TR*               ,CODE_USAGE_SOURCE                                        
MFA-TR*               ,ITEM_SEQ_NO                                              
MFA-TR*               ,METER_NO                                                 
MFA-TR*               ,REG_ID_NO                                                
MFA-TR*               ,DATE_READ                                                
MFA-TR*               ,CODE_METER_READ                                          
MFA-TR*               ,CODE_METER_NO_READ                                       
MFA-TR*               ,METER_READING                                            
MFA-TR*               ,DEMAND_READING                                           
MFA-TR*               ,EMPLOYEE_NO                                              
MFA-TR*               ,NO_UNITS                                                 
MFA-TR*               ,NO_DEMAND_UNITS                                          
MFA-TR*               ,NO_DAYS                                                  
MFA-TR*               ,CODE_SOURCE_ID                                           
MFA-TR*               ,CODE_DEBIT_CREDIT                                        
MFA-TR*               ,CODE_ITEM_STATUS                                         
MFA-TR*               ,CODE_DISCOUNT                                            
MFA-TR*               ,CONSTANT                                                 
MFA-TR*               ,NO_DIALS                                                 
MFA-TR*               ,CODE_TOU_SEASN                                           
MFA-TR*               ,COMPANY_NO                                               
MFA-TR*               ,MTR_READ_SOURCE_CD                                       
MFA-TR*               ,DIGTL_MTR_TYPE                                           
MFA-TR*               ,EXCEPT_OVERRIDE_CD                                       
MFA-TR*               ,REQUESTED_USAGE                                          
MFA-TR*               ,DIGTL_INTRL_MTR_NO                                       
MFA-TR*               ,EXCL_DMD_RCHT_IND                                        
MFA-TR*               ,BTU_FACTOR                                               
MFA-TR*               ,PCOMP_FCT)                                               
MFA-TR*         VALUES                                                          
MFA-TR*               (:CX-ACCOUNT-NO                                           
MFA-TR*               ,:CX-BILL-NO                                              
MFA-TR*               ,:CX-CODE-UTIL-TYPE                                       
MFA-TR*               ,:CX-IC-NO                                                
MFA-TR*               ,:CX-BILL-ITEM-TIMESTMP                                   
MFA-TR*               ,:CX-CODE-TIME-PERIOD                                     
MFA-TR*               ,:CX-MTR-REF-NO                                           
MFA-TR*               ,:CX-CODE-USAGE-TYPE                                      
MFA-TR*               ,:CX-CODE-USAGE-ID                                        
MFA-TR*               ,:CX-CODE-USAGE-SOURCE                                    
MFA-TR*               ,:CX-ITEM-SEQ-NO                                          
MFA-TR*               ,:CX-METER-NO                                             
MFA-TR*               ,:CX-REG-ID-NO                                            
MFA-TR*               ,:CX-DATE-READ:WS-CX-DATE-READ-NULL                       
MFA-TR*               ,:CX-CODE-METER-READ                                      
MFA-TR*               ,:CX-CODE-METER-NO-READ                                   
MFA-TR*               ,:CX-METER-READING                                        
MFA-TR*               ,:CX-DEMAND-READING                                       
MFA-TR*               ,:CX-EMPLOYEE-NO                                          
MFA-TR*               ,:CX-NO-UNITS                                             
MFA-TR*               ,:CX-NO-DEMAND-UNITS                                      
MFA-TR*               ,:CX-NO-DAYS                                              
MFA-TR*               ,:CX-CODE-SOURCE-ID                                       
MFA-TR*               ,:CX-CODE-DEBIT-CREDIT                                    
MFA-TR*               ,:CX-CODE-ITEM-STATUS                                     
MFA-TR*               ,:CX-CODE-DISCOUNT                                        
MFA-TR*               ,:CX-CONSTANT                                             
MFA-TR*               ,:CX-NO-DIALS                                             
MFA-TR*               ,:CX-CODE-TOU-SEASN                                       
MFA-TR*               ,:CX-COMPANY-NO                                           
MFA-TR*               ,:CX-MTR-READ-SOURCE-CD                                   
MFA-TR*               ,:CX-DIGTL-MTR-TYPE                                       
MFA-TR*               ,:CX-EXCEPT-OVERRIDE-CD                                   
MFA-TR*               ,:CX-REQUESTED-USAGE                                      
MFA-TR*               ,:CX-DIGTL-INTRL-MTR-NO                                   
MFA-TR*               ,:CX-EXCL-DMD-RCHT-IND                                    
MFA-TR*               ,:CX-BTU-FACTOR                                           
MFA-TR*               ,:CX-PCOMP-FCT)                                           
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8400       **'           
               DISPLAY '**      ACCOUNT-NO    = ' CX-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' CX-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' CX-IC-NO              
               DISPLAY '**      METER-NO      = ' CX-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' CX-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' CX-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' CX-CODE-TIME-PERIOD   
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8400-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      *================================================================*        
       8410-UPDATE-CX-HIST.                                             
      *================================================================*        
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_CNSMPTN_HIST                                   
                 SET NO_DEMAND_UNITS    = :CX-NO-DEMAND-UNITS           
                    ,DEMAND_READING     = :CX-DEMAND-READING            
                    ,CONSTANT           = :CX-CONSTANT                  
               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                     
                 AND BILL_ITEM_TIMESTMP = CIS.CHAR2TIMESTAMP(
                                                 :CX-BILL-ITEM-TIMESTMP
              )        
                 AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD          
                 AND MTR_REF_NO         = :CX-MTR-REF-NO                
                 AND ITEM_SEQ_NO        = :CX-ITEM-SEQ-NO               
                 AND REG_ID_NO          = :CX-REG-ID-NO                 
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_CNSMPTN_HIST                                           
MFA-TR*          SET NO_DEMAND_UNITS    = :CX-NO-DEMAND-UNITS                   
MFA-TR*             ,DEMAND_READING     = :CX-DEMAND-READING                    
MFA-TR*             ,CONSTANT           = :CX-CONSTANT                          
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*          AND BILL_ITEM_TIMESTMP = :CX-BILL-ITEM-TIMESTMP                
MFA-TR*          AND CODE_TIME_PERIOD   = :CX-CODE-TIME-PERIOD                  
MFA-TR*          AND MTR_REF_NO         = :CX-MTR-REF-NO                        
MFA-TR*          AND ITEM_SEQ_NO        = :CX-ITEM-SEQ-NO                       
MFA-TR*          AND REG_ID_NO          = :CX-REG-ID-NO                         
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               
              CONTINUE                                                  
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8410       **'           
               DISPLAY '**      ACCOUNT-NO    = ' CX-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' CX-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' CX-IC-NO              
               DISPLAY '**      METER-NO      = ' CX-METER-NO           
               DISPLAY '**      MTR-REF-NO    = ' CX-MTR-REF-NO         
               DISPLAY '**      REG-ID-NO     = ' CX-REG-ID-NO          
               DISPLAY '**      TIME PERIOD   = ' CX-CODE-TIME-PERIOD   
               DISPLAY '**       SQLCODE = ' WS-ACTIVE-RETURN-CODE      
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
                                                                        
       8410-EXIT.                                                       
           EXIT.                                                        
      **************************************************************            
      * UPDATE BTU-FACTOR, IF IT IS PROVIDED.                      *            
      **************************************************************            
       8500-UPDATE-BILLING-DET.                                         
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_BILLING_DET                                   
                  SET BTU_FACTOR         = :BG-BTU-FACTOR               
                WHERE ACCOUNT_NO         = :BG-ACCOUNT-NO               
                  AND BILL_NO            = :BG-BILL-NO                  
                  AND CODE_UTIL_TYPE     = :BG-CODE-UTIL-TYPE           
                  AND IC_NO              = :BG-IC-NO                    
                  AND BILL_ITEM_TIMESTMP = CIS.CHAR2TIMESTAMP(
                                                 :BG-BILL-ITEM-TIMESTMP
              )       
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_BILLING_DET                                           
MFA-TR*           SET BTU_FACTOR         = :BG-BTU-FACTOR                       
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*           AND IC_NO              = :BG-IC-NO                            
MFA-TR*           AND BILL_ITEM_TIMESTMP = :BG-BILL-ITEM-TIMESTMP               
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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8500       **'           
               DISPLAY '**      ACCOUNT-NO    = ' BG-ACCOUNT-NO         
               DISPLAY '**      UTIL TYPE     = ' BG-CODE-UTIL-TYPE     
               DISPLAY '**      IC-NO         = ' BG-IC-NO              
               DISPLAY '**      BILL-NO       = ' BG-BILL-NO            
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8500-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      **************************************************************            
      * UPDATE CODE-ACCT-BILLED                                    *            
      **************************************************************            
       8560-UPDATE-ACCOUNT.                                             
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_ACCOUNT                                       
                  SET CODE_ACCT_BILLED = :AT-CODE-ACCT-BILLED           
                WHERE ACCOUNT_NO       = :AT-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 EQUAL SUCCESSFUL-CALL              
               NEXT SENTENCE                                            
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8560       **'           
               DISPLAY '**      ACCOUNT-NO    = ' AT-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8560-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
P00246**************************************************************            
P00246* UPDATE EXEMPT CODES ON ACCOUNT TABLE                       *            
P00246**************************************************************            
P00246 8570-UPDT-AT-XMT-CODES.                                          
P00246*                                                                         
P00246     EXEC SQL                                                     
P00246         UPDATE CSS_ACCOUNT                                       
P00246            SET CODE_LPC_XMT     = :AT-CODE-LPC-XMT               
P00246               ,NOTICE_EXEMPT_CD = :AT-NOTICE-EXEMPT-CD           
P00246               ,CODE_DISC_OK     = :AT-CODE-DISC-OK               
P00246               ,IVR_EXEMPT_CD    = :AT-IVR-EXEMPT-CD              
P00246          WHERE ACCOUNT_NO       = :AT-ACCOUNT-NO                 
P00246     END-EXEC.                                                    

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

P00246*                                                                         
P00246     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
P00246*                                                                         
P00246     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL              
P00246         NEXT SENTENCE                                            
P00246     ELSE                                                         
P00246         DISPLAY '****************************************'       
P00246         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
P00246         DISPLAY '**  ABEND IN PARAGRAPH 8570           **'       
P00246         DISPLAY '**      ACCOUNT-NO    = ' AT-ACCOUNT-NO         
P00246         DISPLAY '**        SQLCODE     = ' WS-ACTIVE-RETURN-CODE 
P00246         DISPLAY '****************************************'       
P00246         PERFORM 9900-ABEND THRU 9900-EXIT                        
P00246     END-IF.                                                      
P00246*                                                                         
P00246 8570-EXIT.                                                       
P00246     EXIT.                                                        
P00246*                                                                         
      **************************************************************            
      * DELETE ACCOUNT FROM OFF CYCLE TABLE                        *            
      **************************************************************            
       8600-DELETE-OFF-CYCLE.                                           
      *                                                                         
           EXEC SQL                                                     
                DELETE                                                  
                FROM CSS_OFF_CYCL_ACCT                                  
               WHERE ACCOUNT_NO   = :OC-ACCOUNT-NO                      
                 AND CODE_BILL_OFF_CYCL = 'H'                           
           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                                                         
               DISPLAY '****************************************'       
               DISPLAY '**  PCSBW143 PROCESSING ERROR      **'          
               DISPLAY '**  ABEND IN PARAGRAPH 8600       **'           
               DISPLAY '**      ACCOUNT-NO    = ' OC-ACCOUNT-NO         
               DISPLAY '**             SQLCODE = ' WS-ACTIVE-RETURN-CODE
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8600-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
C35066*================================================================*        
C35066 8610-DELETE-ROUTE-REPORT.                                        
C35066*================================================================*        
C35066*----------------------------------------------------------------*        
C35066*    DELETE PRIOR SUPERVISOR ESTIMATES IN ROUTE_REPORT           *        
C35066*----------------------------------------------------------------*        
C35066     EXEC SQL                                                     
C35066          DELETE                                                  
C35066          FROM CSS_ROUTE_REPORT                                   
C35066         WHERE ACCOUNT_NO        = :PW-ACCOUNT-NO                 
C35066           AND REVENUE_MONTH     = :PW-REVENUE-MONTH              
C35066           AND CODE_UTIL_TYPE    = :PW-CODE-UTIL-TYPE             
C35066           AND IC_NO             = :PW-IC-NO                      
C35066           AND METER_NO          = :PW-METER-NO                   
C35066           AND REG_MEASURE_CD    = :WS-REG-MEASURE-CD             
C35066           AND CODE_TIME_PERIOD  = :PW-CODE-TIME-PERIOD           
C35066           AND CODE_TOU_SEASN    = :PW-CODE-TOU-SEASN             
C35066           AND LAST_REG_READ_DT  = IIF(TRY_CONVERT(DATE, 
                                                   :WS-LAST-REG-READ-DT
              ) IS NULL OR (PATINDEX('%.%', :WS-LAST-REG-READ-DT
              ) <> 0) OR (LEN(:WS-LAST-REG-READ-DT
              ) <> 10), CIS.CHAR2DATE(:WS-LAST-REG-READ-DT
              ), CONVERT(DATE, :WS-LAST-REG-READ-DT) )           
C35066           AND LAST_REG_READ_TM  = CIS.CHAR2TIME(
                                                   :WS-LAST-REG-READ-TM
              )           
C35066           AND TYPE_OF_RD_IND    = :WS-UPD-TYPE-OF-RD-IND         
C35066     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*         DELETE                                                          
MFA-TR*         FROM CSS_ROUTE_REPORT                                           
MFA-TR*        WHERE ACCOUNT_NO        = :PW-ACCOUNT-NO                         
MFA-TR*          AND REVENUE_MONTH     = :PW-REVENUE-MONTH                      
MFA-TR*          AND CODE_UTIL_TYPE    = :PW-CODE-UTIL-TYPE                     
MFA-TR*          AND IC_NO             = :PW-IC-NO                              
MFA-TR*          AND METER_NO          = :PW-METER-NO                           
MFA-TR*          AND REG_MEASURE_CD    = :WS-REG-MEASURE-CD                     
MFA-TR*          AND CODE_TIME_PERIOD  = :PW-CODE-TIME-PERIOD                   
MFA-TR*          AND CODE_TOU_SEASN    = :PW-CODE-TOU-SEASN                     
MFA-TR*          AND LAST_REG_READ_DT  = :WS-LAST-REG-READ-DT                   
MFA-TR*          AND LAST_REG_READ_TM  = :WS-LAST-REG-READ-TM                   
MFA-TR*          AND TYPE_OF_RD_IND    = :WS-UPD-TYPE-OF-RD-IND                 
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

C35066*                                                                         
C35066     MOVE SQLCODE                    TO WS-ACTIVE-RETURN-CODE.    
C35066*                                                                         
C35066     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
C35066         CONTINUE                                                 
C35066     ELSE                                                         
C35066         DISPLAY '****************************************'       
C35066         DISPLAY '**  PCSBW143 PROCESSING ERROR         **'       
C35066         DISPLAY '**  ABEND IN 8610-DELETE-ROUTE-REPORT **'       
C35066         DISPLAY '*** SQLCODE = ' WS-ACTIVE-RETURN-CODE           
C35066         DISPLAY '** ACCOUNT_NO       = ' PW-ACCOUNT-NO           
C35066         DISPLAY '** REVENUE_MONTH    = ' PW-REVENUE-MONTH        
C35066         DISPLAY '** CODE_UTIL_TYPE   = ' PW-CODE-UTIL-TYPE       
C35066         DISPLAY '** IC_NO            = ' PW-IC-NO                
C35066         DISPLAY '** METER_NO         = ' PW-METER-NO             
C35066         DISPLAY '** REG_MEASURE_CD   = ' PW-REG-MEASURE-CD       
C35066         DISPLAY '** CODE_TIME_PERIOD = ' PW-CODE-TIME-PERIOD     
C35066         DISPLAY '** CODE_TOU_SEASN   = ' PW-CODE-TOU-SEASN       
C35066         DISPLAY '** LAST_REG_READ_DT = ' PW-LAST-REG-READ-DT     
C35066         DISPLAY '** LAST_REG_READ_TM = ' PW-LAST-REG-READ-TM     
C35066         DISPLAY '****************************************'       
C35066         PERFORM 9900-ABEND THRU 9900-EXIT                        
C35066     END-IF.                                                      
C35066*                                                                         
C35066 8610-EXIT.                                                       
C35066     EXIT.                                                        
C35066*                                                                         
C33023*===============================================================*         
C35066 8620-UPDATE-AGL-FACTOR.                                          
C33023*===============================================================*         
C33023                                                                  
C33023     EXEC SQL                                                     
C33023      UPDATE CSS_FIXED_FCTR                                       
C35597        SET FACTOR             = :FF-FACTOR                       
C35597           ,DURATION_REMAIN_NO = :FF-DURATION-REMAIN-NO           
C33023           ,EFF_DATE_TO        = IIF(TRY_CONVERT(DATE, 
                                                        :FF-EFF-DATE-TO
              ) IS NULL OR (PATINDEX('%.%', :FF-EFF-DATE-TO
              ) <> 0) OR (LEN(:FF-EFF-DATE-TO) <> 10), CIS.CHAR2DATE(
                                                        :FF-EFF-DATE-TO
              ), CONVERT(DATE, :FF-EFF-DATE-TO) )                  
C33023           ,LAST_UPDATE_TS = CIS.CURRENT$TIMESTAMP()                    
C33023      WHERE ACCOUNT_NO        = :FF-ACCOUNT-NO                    
C33023        AND CODE_UTIL_TYPE    = :FF-CODE-UTIL-TYPE                
C33023        AND IC_NO             = :FF-IC-NO                         
C33023        AND FIXED_FCTR_SEQ_NO = :FF-FIXED-FCTR-SEQ-NO             
C33023        AND FACTOR_ID         = :WS-AGL-FF-FACTOR-ID              
C33023                                                                  
C33023     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*     UPDATE CSS_FIXED_FCTR                                               
MFA-TR*       SET FACTOR             = :FF-FACTOR                               
MFA-TR*          ,DURATION_REMAIN_NO = :FF-DURATION-REMAIN-NO                   
MFA-TR*          ,EFF_DATE_TO        = :FF-EFF-DATE-TO                          
MFA-TR*          ,LAST_UPDATE_TS = CURRENT TIMESTAMP                            
MFA-TR*     WHERE ACCOUNT_NO        = :FF-ACCOUNT-NO                            
MFA-TR*       AND CODE_UTIL_TYPE    = :FF-CODE-UTIL-TYPE                        
MFA-TR*       AND IC_NO             = :FF-IC-NO                                 
MFA-TR*       AND FIXED_FCTR_SEQ_NO = :FF-FIXED-FCTR-SEQ-NO                     
MFA-TR*       AND FACTOR_ID         = :WS-AGL-FF-FACTOR-ID                      
MFA-TR*                                                                         
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

C33023     MOVE SQLCODE          TO WS-ACTIVE-RETURN-CODE               
C33023                                                                  
C33023     EVALUATE WS-ACTIVE-RETURN-CODE                               
C33023       WHEN SUCCESSFUL-CALL                                       
C33023            CONTINUE                                              
C33023       WHEN OTHER                                                 
C33023         DISPLAY '***************************************'        
C33023         DISPLAY '**    PCSBW143 PROCESSING ERROR      **'        
C35066         DISPLAY '**     ABEND IN PARAGRAPH 8620       **'        
C33023         DISPLAY '** ACCOUNT_NO = ' WS-AGL-ACCOUNT-NO             
C33023         DISPLAY '** CODE_UTIL_TYPE =' FF-CODE-UTIL-TYPE          
C35597         DISPLAY '** IC NO     = ' FF-IC-NO                       
C33023         DISPLAY '** FACTOR-ID = ' WS-AGL-FF-FACTOR-ID            
C35597         DISPLAY '** FACTOR    = ' FF-FACTOR                      
C35597         DISPLAY '** FIXED FCTR SEQ NO = ' FF-FIXED-FCTR-SEQ-NO   
C33023         DISPLAY '** DURATION-REMAIN-NO = ' FF-DURATION-REMAIN-NO 
C33023         DISPLAY '** EFF_DATE_TO   = ' FF-EFF-DATE-TO             
C33023         DISPLAY '** SQLCODE    = ' WS-ACTIVE-RETURN-CODE         
C33023         DISPLAY '***************************************'        
C33023         PERFORM 9900-ABEND                                       
C33023            THRU 9900-EXIT                                        
C33023     END-EVALUATE                                                 
C33023     .                                                            
C35066 8620-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
C33023*===============================================================*         
C35066 8630-INSERT-AGL-FACTOR.                                          
C33023*===============================================================*         
C33023                                                                  
C33023     EXEC SQL                                                     
C33023         INSERT INTO CSS_FIXED_FCTR                               
C33023               ( ACCOUNT_NO                                       
C33023                ,CODE_UTIL_TYPE                                   
C33023                ,IC_NO                                            
C33023                ,FIXED_FCTR_SEQ_NO                                
C33023                ,FACTOR_ID                                        
C33023                ,EFF_DATE_FROM                                    
C33023                ,CMPNT_ID_CD                                      
C33023                ,CODE_SEASON                                      
C33023                ,INSTR_USE_TYPE_CD                                
C33023                ,CODE_TIME_PERIOD                                 
C33023                ,EFF_DATE_TO                                      
C33023                ,FIXED_FCTR_TYP_CD                                
C33023                ,FACTOR                                           
C33023                ,FAC_CHRG_BASE_AM                                 
C35597                ,DURATION_REMAIN_NO                               
C33023                ,LAST_UPDATE_TS )                                 
C33023         VALUES                                                   
C33023               ( :FF-ACCOUNT-NO                                   
C33023                ,:FF-CODE-UTIL-TYPE                               
C33023                ,:FF-IC-NO                                        
C33023                ,:FF-FIXED-FCTR-SEQ-NO                            
C33023                ,:FF-FACTOR-ID                                    
C33023                ,IIF(TRY_CONVERT(DATE, :FF-EFF-DATE-FROM
              ) IS NULL OR (PATINDEX('%.%', :FF-EFF-DATE-FROM
              ) <> 0) OR (LEN(:FF-EFF-DATE-FROM) <> 10), CIS.CHAR2DATE(
                                                      :FF-EFF-DATE-FROM
              ), CONVERT(DATE, :FF-EFF-DATE-FROM) )                            
C33023                ,:FF-CMPNT-ID-CD                                  
C33023                ,:FF-CODE-SEASON                                  
C33023                ,:FF-INSTR-USE-TYPE-CD                            
C33023                ,:FF-CODE-TIME-PERIOD                             
C33023                ,IIF(TRY_CONVERT(DATE, :FF-EFF-DATE-TO
              ) IS NULL OR (PATINDEX('%.%', :FF-EFF-DATE-TO
              ) <> 0) OR (LEN(:FF-EFF-DATE-TO) <> 10), CIS.CHAR2DATE(
                                                        :FF-EFF-DATE-TO
              ), CONVERT(DATE, :FF-EFF-DATE-TO) )                              
C33023                ,:FF-FIXED-FCTR-TYP-CD                            
C33023                ,:FF-FACTOR                                       
C33023                ,:FF-FAC-CHRG-BASE-AM                             
C35597                ,:FF-DURATION-REMAIN-NO                           
C33023                , CIS.CURRENT$TIMESTAMP() )                             
C33023     END-EXEC                                                     

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*        INSERT INTO CSS_FIXED_FCTR                                       
MFA-TR*              ( ACCOUNT_NO                                               
MFA-TR*               ,CODE_UTIL_TYPE                                           
MFA-TR*               ,IC_NO                                                    
MFA-TR*               ,FIXED_FCTR_SEQ_NO                                        
MFA-TR*               ,FACTOR_ID                                                
MFA-TR*               ,EFF_DATE_FROM                                            
MFA-TR*               ,CMPNT_ID_CD                                              
MFA-TR*               ,CODE_SEASON                                              
MFA-TR*               ,INSTR_USE_TYPE_CD                                        
MFA-TR*               ,CODE_TIME_PERIOD                                         
MFA-TR*               ,EFF_DATE_TO                                              
MFA-TR*               ,FIXED_FCTR_TYP_CD                                        
MFA-TR*               ,FACTOR                                                   
MFA-TR*               ,FAC_CHRG_BASE_AM                                         
MFA-TR*               ,DURATION_REMAIN_NO                                       
MFA-TR*               ,LAST_UPDATE_TS )                                         
MFA-TR*        VALUES                                                           
MFA-TR*              ( :FF-ACCOUNT-NO                                           
MFA-TR*               ,:FF-CODE-UTIL-TYPE                                       
MFA-TR*               ,:FF-IC-NO                                                
MFA-TR*               ,:FF-FIXED-FCTR-SEQ-NO                                    
MFA-TR*               ,:FF-FACTOR-ID                                            
MFA-TR*               ,:FF-EFF-DATE-FROM                                        
MFA-TR*               ,:FF-CMPNT-ID-CD                                          
MFA-TR*               ,:FF-CODE-SEASON                                          
MFA-TR*               ,:FF-INSTR-USE-TYPE-CD                                    
MFA-TR*               ,:FF-CODE-TIME-PERIOD                                     
MFA-TR*               ,:FF-EFF-DATE-TO                                          
MFA-TR*               ,:FF-FIXED-FCTR-TYP-CD                                    
MFA-TR*               ,:FF-FACTOR                                               
MFA-TR*               ,:FF-FAC-CHRG-BASE-AM                                     
MFA-TR*               ,:FF-DURATION-REMAIN-NO                                   
MFA-TR*               , CURRENT TIMESTAMP )                                     
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

C33023                                                                  
C33023     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE         
C33023     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C33023        CONTINUE                                                  
C33023     ELSE                                                         
C33023        DISPLAY '****************************************'        
C33023        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
C35066        DISPLAY '**      ABEND IN PARAGRAPH 8630       **'        
C33023        DISPLAY '**  ACCOUNT-NO = ' WS-AGL-ACCOUNT-NO             
C33023        DISPLAY '**  IC-NO      = ' FF-IC-NO                      
C33023        DISPLAY '**  UTIL TYPE  = ' FF-CODE-UTIL-TYPE             
C33023        DISPLAY '**  SEQ-NO     = ' FF-FIXED-FCTR-SEQ-NO          
C33023        DISPLAY '**  SQLCODE    = ' WS-ACTIVE-RETURN-CODE         
C33023        DISPLAY '****************************************'        
C33023        PERFORM 9900-ABEND                                        
C33023           THRU 9900-EXIT                                         
C33023     END-IF.                                                      
C33023                                                                  
C35066 8630-EXIT.                                                       
C33023     EXIT.                                                        
C33023***                                                                       
PRJ914*================================================================*        
PRJ914 8635-INSERT-OFF-CYCL-ACCT.                                       
PRJ914*================================================================*        
PRJ914                                                                  
PRJ914     EXEC SQL                                                     
PRJ914         INSERT INTO CSS_OFF_CYCL_ACCT                            
PRJ914                 (ACCOUNT_NO                                      
PRJ914                 ,CODE_BILL_OFF_CYCL                              
PRJ914                 ,CUSTOMER_NO                                     
PRJ914                 ,CREDIT_LETTER_IND)                              
PRJ914              VALUES                                              
PRJ914                 (:OC-ACCOUNT-NO                                  
PRJ914                 ,:OC-CODE-BILL-OFF-CYCL                          
PRJ914                 ,:OC-CUSTOMER-NO                                 
PRJ914                 ,:OC-CREDIT-LETTER-IND)                          
PRJ914     END-EXEC.                                                    

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

PRJ914                                                                  
PRJ914     MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE.                       
PRJ914                                                                  
PRJ914     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR -803           
PRJ914        CONTINUE                                                  
PRJ914     ELSE                                                         
PRJ914        DISPLAY '****************************************'        
PRJ914        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
PRJ914        DISPLAY '**      ABEND IN PARAGRAPH 8635       **'        
PRJ914        DISPLAY '**  ACCOUNT_NO'         OC-ACCOUNT-NO            
PRJ914        DISPLAY '**  CODE_BILL_OFF_CYCL' OC-CODE-BILL-OFF-CYCL    
PRJ914        DISPLAY '**  CUSTOMER_NO'        OC-CUSTOMER-NO           
PRJ914        DISPLAY '**  SQLCODE        = ' WS-ACTIVE-RETURN-CODE     
PRJ914        DISPLAY '****************************************'        
PRJ914        PERFORM 9900-ABEND   THRU 9900-EXIT                       
PRJ914     END-IF.                                                      
PRJ914                                                                  
PRJ914 8635-EXIT.                                                       
PRJ914     EXIT.                                                        
PRJ914                                                                  
      *****************************************************************         
P00246*                                                               *         
P00246* 8640-DEL-EXPIRED-AGLMTCHRG.                                   *         
P00246*****************************************************************         
P00246 8640-DEL-EXPIRED-AGLMTCHRG.                                      
P00246                                                                  
P00246     EXEC SQL                                                     
P00246        DELETE FROM CSS_FIXED_FCTR                                
P00246         WHERE ACCOUNT_NO         = :FF-ACCOUNT-NO                
P00246           AND FACTOR_ID          = :WS-AGL-FF-FACTOR-ID          
P00246           AND DURATION_REMAIN_NO = 0                             
P00246     END-EXEC.                                                    

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

P00246                                                                  
P00246     MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE       
P00246                                                                  
P00246     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
P00246        CONTINUE                                                  
P00246     ELSE                                                         
P00246        DISPLAY '****************************************'        
P00246        DISPLAY '**     PCSBW143 PROCESSING ERROR      **'        
P00246        DISPLAY '**      ABEND IN PARAGRAPH 8640       **'        
P00246        DISPLAY '**  ACCOUNT-NO = ' FF-ACCOUNT-NO                 
P00246        DISPLAY '**  FACTOR_ID  = ' WS-AGL-FF-FACTOR-ID           
P00246        DISPLAY '**  SQLCODE    = ' WS-ACTIVE-RETURN-CODE         
P00246        DISPLAY '****************************************'        
P00246        PERFORM 9900-ABEND         THRU 9900-EXIT                 
P00246     END-IF.                                                      
P00246                                                                  
P00246 8640-EXIT.                                                       
P00246     EXIT.                                                        
P00246                                                                  
      ******************************************************************        
      * 8893-RESET-RESTART-REQ-PARM                                    *        
      ******************************************************************        
           EXEC SQL                                                             
               INCLUDE CPD00029                                                 
           END-EXEC.                                                            
      *                                                                         
      *****************************                                             
      *  8895-INSERT-WORK-QUEUE  **                                             
      *****************************                                             
ACT015 8895-INSERT-WORK-QUEUE.                                          
      *                                                                         
ACT015     CALL SCSCB077 USING CWS00077-FIELDS,                         
ACT015                         ABEND-FILE,                              
ACT015                         RS-RETURN-CODE.                          
ACT015                                                                  
ACT015     MOVE RS-RETURN-CODE     TO WS-ACTIVE-RETURN-CODE.            
ACT015                                                                  
ACT015     IF ABEND-FUNCTION > SPACES OR RS-RETURN-CODE NOT = 0         
ACT015        MOVE WS-PGRMNAME     TO ABEND-PROGRAM                     
ACT015        DISPLAY '8895-INSERT-WORK-QUEUE'                          
ACT015        DISPLAY 'CALL SCSCB077         '                          
ACT015        DISPLAY 'ACCOUNT-NO      ' WS-77-ACCOUNT-NO               
ACT015        DISPLAY 'METER-NO        ' E-FBW06-METER-NO               
ACT015        DISPLAY 'COMMENTS        ' WS-77-COMMENTS                 
ACT015        DISPLAY 'SQL RETURN CODE ' WS-ACTIVE-RETURN-CODE          
ACT015        PERFORM 9900-ABEND    THRU 9900-EXIT                      
ACT015     END-IF.                                                      
ACT015                                                                  
ACT015 8895-EXIT.                                                       
ACT015     EXIT.                                                        
                                                                        
      *                                                                         
      ******************************************************************        
      * UPDATES A ROW IN CSS_RESTART BEFORE EVERY COMMIT               *        
      ******************************************************************        
       8896-UPDATE-RESTART.                                             
      *                                                                         
           EXEC SQL                                                     
               UPDATE CSS_RESTART                                       
                  SET RESTART_DATA = :RF-RESTART-DATA                   
                WHERE NAME_PROGRAM = :RF-NAME-PROGRAM                   
                  AND PARTITION_NO = :RF-PARTITION-NO                   
                  AND DUP_CNTRL_NO = :RF-DUP-CNTRL-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 EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               CONTINUE                                                 
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 8896       **'       
               DISPLAY '**      NAME_PROGRAM  = ' RF-NAME-PROGRAM       
               DISPLAY '**      PARTITION_NO  = ' RF-PARTITION-NO       
               DISPLAY '**      SQLCODE = ' WS-ACTIVE-RETURN-CODE       
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8896-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * INSERTS A ROW INTO CSS_RESTART WHEN THERE IS NO ROW FOR PROGRAM*        
      * PCSBW143 IN CSS_RESTART                                        *        
      ******************************************************************        
       8897-INSERT-RESTART.                                             
      *                                                                         
           EXEC SQL                                                     
               INSERT INTO CSS_RESTART                                  
                   (NAME_PROGRAM                                        
                   ,PARTITION_NO                                        
                   ,DUP_CNTRL_NO                                        
                   ,RESTART_DATA)                                       
               VALUES                                                   
                   (:RF-NAME-PROGRAM                                    
                   ,:RF-PARTITION-NO                                    
                   ,:RF-DUP-CNTRL-NO                                    
                   ,:RF-RESTART-DATA)                                   
           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              
               CONTINUE                                                 
           ELSE                                                         
               DISPLAY '****************************************'       
               DISPLAY '**     PCSBW143 PROCESSING ERROR      **'       
               DISPLAY '**      ABEND IN PARAGRAPH 8897       **'       
               DISPLAY '**      NAME_PROGRAM  = ' RF-NAME-PROGRAM       
               DISPLAY '**      PARTITION_NO  = ' RF-PARTITION-NO       
               DISPLAY '**      SQLCODE = ' WS-ACTIVE-RETURN-CODE       
               DISPLAY '****************************************'       
               PERFORM 9900-ABEND THRU 9900-EXIT                        
           END-IF.                                                      
      *                                                                         
       8897-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * THIS PROCESS UPDATES/INSERTS THE RESTART DATA INTO CSS_RESTART *        
      * AND SAVES THE CHANGES TO DATABASE TILL THIS POINT              *        
      ******************************************************************        
       8898-ISSUE-CHKP.                                                 
      *                                                                         
           IF  WS-CHKP-LUW-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS      
                 AND WS-CHKP-UPD-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS
               GO TO 8898-EXIT                                          
           END-IF.                                                      
      *                                                                         
           ADD 1                           TO WS-CHKP-SEQ-NO.           
           MOVE WS-CHKP-SEQ-NO             TO WS-RESTART-CHKP-SEQ-NO.   
           MOVE WS-FBW06-REC-CNTR          TO WS-RESTART-RECORD-NO.     
           MOVE WS-COUNT-ACCT              TO WS-RESTART-COUNT-ACCT     
           MOVE WS-COUNT-METER             TO WS-RESTART-COUNT-METER    
           MOVE WS-COUNT-KWH               TO WS-RESTART-COUNT-KWH      
           MOVE WS-COUNT-GAS               TO WS-RESTART-COUNT-GAS      
           MOVE WS-COUNT-UNC               TO WS-RESTART-COUNT-UNC      
           MOVE WS-COUNT-INT               TO WS-RESTART-COUNT-INT      
           MOVE WS-COUNT-KW                TO WS-RESTART-COUNT-KW       
           MOVE WS-COUNT-KVA               TO WS-RESTART-COUNT-KVA      
           MOVE WS-COUNT-SURVEY            TO WS-RESTART-COUNT-SURVEY   
           MOVE WS-COUNT-NOT-READ          TO WS-RESTART-COUNT-NOT-READ 
           MOVE WS-HIGH-LOW-FAIL           TO WS-RESTART-HIGH-LOW-FAIL  
           MOVE E-FBW06-RECORD-KEY         TO WS-RESTART-REC-KEY.       
           MOVE WS-NO-OF-REJECT            TO WS-RESTART-NO-OF-REJECT.  
      *                                                                         
           PERFORM 8899-WRITE-RSDDR THRU 8899-EXIT.                     
           EXEC SQL                                                             
               INCLUDE CPD00047                                                 
           END-EXEC.                                                            
      *                                                                         
           DISPLAY 'COMMIT POINT # ' WS-CHKP-SEQ-NO ' TAKEN. '          
                   'LAST ACCOUNT PROCESSED = ' WS-PREV-ACCT-NO          
           MOVE ZERO                       TO WS-CHKP-UPD-COUNTER       
                                              WS-CHKP-LUW-COUNTER.      
      *                                                                         
       8898-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      * POPULATES THE RESTART-DATA BEFORE IT IS STORED IN CSS_RESTART  *        
      * AND UPDATES/INSERTS THE RESTART-DATA IN CSS_RESTART            *        
      ******************************************************************        
       8899-WRITE-RSDDR.                                                
      *                                                                         
           MOVE WS-PART-NO                 TO RF-PARTITION-NO.          
           MOVE PROGRAM-NAME               TO RF-NAME-PROGRAM.          
           MOVE 1                          TO RF-DUP-CNTRL-NO.          
           MOVE WS-RESTART-DATA            TO RF-RESTART-DATA-TEXT.     
           MOVE WS-RESTART-DATA-LENGTH     TO RF-RESTART-DATA-LEN.      
           PERFORM 8896-UPDATE-RESTART THRU 8896-EXIT.                  
      *                                                                         
           IF  WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND                    
               PERFORM 8897-INSERT-RESTART THRU 8897-EXIT               
           END-IF.                                                      
      *                                                                         
       8899-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ******************************************************************        
      *   8940-DISPLAY-COUNTERS                                                 
      ******************************************************************        
       8940-DISPLAY-COUNTERS.                                           
           DISPLAY ' '                                                  
           DISPLAY '****************************************'           
           DISPLAY '*********** PCSBW143 COUNTERS **********'           
           DISPLAY 'ACCOUNTS PROCESSED     = ',  WS-COUNT-ACCT          
           DISPLAY 'METERS PROCESSED       = ',  WS-COUNT-METER         
           DISPLAY 'CCF READINGS POSTED    = ',  WS-COUNT-GAS           
           DISPLAY 'UNC READINGS POSTED    = ',  WS-COUNT-UNC           
           DISPLAY 'INT READINGS POSTED    = ',  WS-COUNT-INT           
           DISPLAY 'KWH READINGS POSTED    = ',  WS-COUNT-KWH           
           DISPLAY 'KVA READINGS POSTED    = ',  WS-COUNT-KVA           
           DISPLAY 'KW  READINGS POSTED    = ',  WS-COUNT-KW            
           DISPLAY 'SURVEY RECORDS         = ',  WS-COUNT-SURVEY        
           DISPLAY 'REGISTERS NOT READ     = ',  WS-COUNT-NOT-READ      
           DISPLAY 'HIGH LOW CHECK FAIL    = ',  WS-HIGH-LOW-FAIL.      
           DISPLAY '****************************************'.          
       8940-EXIT.                                                       
           EXIT.                                                        
      *                                                                *        
P00246******************************************************************        
P00246* 9000-SEND-ERROR-RESULT. REQUIRED BY THE CPD00067 COPYBOOK.     *        
P00246******************************************************************        
P00246 9000-SEND-ERROR-RESULT.                                          
P00246                                                                  
P00246     GO TO 9000-EXIT.                                             
P00246*                                                                         
      ******************************************************************        
      * CLOSE ALL INPUT/OUTPUT FILES                                   *        
      ******************************************************************        
       9000-TERMINATE.                                                  
           CLOSE FCSBW06-FILE.                                          
       9000-EXIT.                                                       
           EXIT.                                                        
      *                                                                *        
      ******************************************************************        
      *   PROCESS ABENDS                                                        
      ******************************************************************        
       COPY CPD0023B.                                                           
      *                                                                *        
P00246******************************************************************        
P00246* ROUTINE ADDED FOR CPD00067 COPYBOOK.                           *        
P00246******************************************************************        
P00246 9900-SQL-ERROR-ROUTINE.                                          
P00246*                                                                         
P00246     MOVE SQLCODE                TO RS-RETURN-CODE-DISP.          
P00246     DISPLAY '**********************************************'.    
P00246     DISPLAY '*****     9900-SQL-ERROR-ROUTINE        ******'.    
P00246     DISPLAY '**********************************************'.    
P00246     DISPLAY 'SQLCODE = ' RS-RETURN-CODE-DISP.                    
P00246     DISPLAY ABEND-RECORD-1-DATA                                  
P00246     DISPLAY ABEND-RECORD-2-DATA                                  
P00246     DISPLAY ABEND-RECORD-3-DATA                                  
P00246     DISPLAY '**********************************************'.    
P00246                                                                  
      ******************************************************************        
      *   9900-ABEND                                                            
      ******************************************************************        
           EXEC SQL                                                             
               INCLUDE CPD09900                                                 
           END-EXEC.                                                            
