       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.     PCSBW121.                                        
       AUTHOR.         ANNA RUSSELL.                                    
       DATE-WRITTEN.   JAN 1995.                                        
      ****************************************************************          
      ********            CUSTOMER SERVICE SYSTEM             ********          
      ********                      DB2                       ********          
      ****************************************************************          
      **                                                            **          
      **              PROGRAM  MODIFICATION  LOG                    **          
      **                                                            **          
      **    DATE    INITIALS     REASON                             **          
      **  --------  --------     ---------------------------------- **          
      **  01/24/95    AR         NEW PROGRAM USING COPY OF PCSCA134.**          
DC    **  06/30/95    DC         CHECKED FOR AUTOMATIC BANK DRAFT   **          
DC    **                         CYCLES WHEN BILLING CYCLE CHANGES. **          
      **  04/03/96    DW         UNCOMMENT WORK QUEUE CD - TPR 2296.**          
      **  05/16/96    CS         ADD LOGIC TO WRITE A RECORD TO FILE**          
      **                         FCSRP000 WHEN BANK DRAFT CYCLE IS  **          
      **                         CHANGED TO PRODUCE LETTER PCSLTR19 **          
      **  06/12/96   MANOJ       TPR 4271                           **          
      **                         ADDED LOGIC TO ALLOW CHANGING READ **          
      **                         CYCLES FORM A NUMBER GREATER THAN  **          
      **                         15 TO A NUMBER LESS THAN 5.        **          
TP4657**  06/26/96    LMB        ADD TBATMISC FOR CPD00074.         **          
TP4989**  07/20/96    ELJ        CATEGORY_ID AND COMMENTS OF THE    **          
      **                         CSS_WQ_ITEM_mf TABLE ARE BEING     **          
      **                         UPDATED WITH THE WRONG VALUES.     **          
PCR270**  07/24/96    JBW        ADDED DELIVERY POINT CODE FOR      **          
PCR270**                         BARCODING PURPOSES. ALSO REMOVED   **          
PCR270**                         FRAMING CHARACTER AND CHECK DIGIT  **          
PCR270**                         BY TAKING OUT WS-FORMATTED-ZIP-CODE**          
PCR270**                         FIELD.                             **          
TP5109**  08/08/96    CSG        ADD CPD0023B TO USE WITH CPD00074. **          
TP5212**  08/26/96    ELJ        INCREASED THE SIZES OF             **          
      **                         WS-JRNL-NEW-SEQ AND WS-JRNL-OLD-SEQ**          
      **                         TO PIC 9(9).                       **          
TP5228**  09/03/96   ELJ         CONSOLIDATE WORK QUEUE PROCESSING  **          
      **                         FOR BATCH AND CICS PROGRAMS.       **          
      **  01/29/97    MAD        FIXED WS-FCA32-STATUS WHICH WAS    **          
      **                         ADDED DURING THE LATEST SYSTEM     **          
      **                         BUILD.                             **          
T16020**  04/20/98    TDK        CORRECTED WQ CATEGORY NUMBER VALUE.**          
T17765**  09/14/98    AAT        REMOVED ACCEPT DATE LOGIC AND      **          
      **                         REPLACED WITH CALL TO 6240-GET-    **          
      **                         FCA00-COMMON-DATE.                 **          
T18480**  12/29/98    CBSI       MISC. CHANGES MADE WHILE WRITING   **          
      **                         THE PROGRAM FOR EXTRACTING ROUTE   **          
      **                         DETAILS.                           **          
T21445**  01/12/00    RGB        CODE CHANGED TO DISPLAY MAXIMUM    **          
      **                         INFORMATION DURING ABEND.          **          
T21498**  01/24/00    SREENI     CODE CHANGED TO ALLOW CYCLE CHANGE **          
      **                         ONLY IF ABS(DIFFERENCE) <= 5.      **          
T21711**  02/24/00    SREENI     CHANGES MADE TO SET THE DRAFT CYCLE**          
      **                         CORRECTLY.                         **          
T22475**  07/11/00    SFH        INITIALIZED NEW FIELDS ADDED TO    **          
      **                         COPYBOOK FIORP000.                 **          
T22926**  10/03/00    VIJAY      CHANGES MADE TO PRINT NOTICE LETTER**          
      **                         WITH CORRECT CYCLE OPEN DATES      **          
      **                         WHENEVER THERE IS A CHANGE IN DRAFT**          
      **                         CYCLE BECAUSE OF RESEQUENCING. **              
T23532**  01/25/01    SMOSES     CHANGES MADE TO UPDATE CSS_PREMISE **          
      **                         TABLE, LOCAL-OFFICE TO EQUAL       **          
      **                         THE LOCAL-OFFICE OF THE REROUTE    **          
      **                         INPUT FILE IF NOT EQUAL.           **          
T23549**  03/22/01    JS83520    EPAY ACCOUNTS WILL NOT BE PROCESSED**          
T23549**                         FROM CSS_BANK_EFT TABLE            **          
T26307**  04/23/01    COVANSYS   IMPLEMENTED COMMIT LOGIC TO REDUCE **          
T26307**              CHENNAI    LOCK LEVELS IN THE PROGRAM         **          
      **                                                            **          
30592 **   5/12/04    RF10596    ON A CYCLE CHANGE PUT ALL CHANGES  **          
      **                         APPLICABLE IN THE MAINTENANCE ROW  **          
      **                         SET CUSTOMER NUMBER TO ZERO ON THE **          
      **                         MAINTENANCE TRANSACTION ROW.       **          
      **                         DO NOT SET AT-CODE-DISC-OK         **          
      **                         FOR FINALS AND WRITEOFFS.          **          
      **                                                            **          
C26296**   5/11/05    KR19687    INITIALIZED AUTOMATED DEPOSIT      **          
      **                         FIELDS TO ZEROES.                  **          
      **                                                            **          
C28610**   3/29/06    AD94658    1. REPLACED CSS_CUST_COMM_MF BY    **          
C28610**                            CSS_COMM_DATA TABLE.            **          
C28610**                         2. INCULDED LOGIC TO JOURNEL THE   **          
C28610**                            LOCAL OFFICE CHANGE.            **          
C28610**                         3. JOURNEL THE CHANGES ONLY WHEN   **          
C28610**                            THERE IS A CYCLE/ROUTE/SEQ/LOCAL**          
C28610**                            OFFICE CHANGE.                  **          
C28610**                         4. UPDATE THE READ CYCLE AND ROUTE **          
C28610**                            FOR ALL THE ACCTS LIKED TO THE  **          
C28610**                            PREMISE IRRESPECTIVE OF WHETHER **          
C28610**                            THE ACCT IS ACTIVE OR NOT.      **          
T35584**   4/10/07    DB41297    CHANGES FOR COMMUNICATION TYPES    **          
T35584**                         AND SUBTYPES.                      **          
T35152**  11-15-07   PG36856     ADDED NEW FIELDS TO RP000 AND       *          
      **                         REMOVED NAME AND ADDRESS PROCESS.   *          
      **                                                            **          
C37054**  4 MAR 2008  RF10596    MOVE PARAGRAPH 1100-VALIDATE-ROUTE **          
C37054**                         TO BEFORE 8145-COMPARE-CSS-PREMISE **          
C37054**                         TO PREVENT UPDATING PREMISE WITH   **          
C37054**                         AN INVALID LOCAL OFFICE.           **          
      **                                                            **          
C37381**  1 JULY 2008 GD97441    1.REMOVED CH_CURSOR TO ADDRESS THE **          
C37381**                           INCORRECT AT UPDATES ISSUE FOR   **          
C37381**                           BILL CYCLE CHANGES.              **          
C37381**                         2.AUTOMATIC DRAFT CYCLE UPDATE     **          
C37381**                           PROCESS IS UPDATED BASED ON      **          
C37381**                           ROBIN'S INPUTS. IF BUSINESS CASE1**          
C37381**                           PASSES THEN THERE WILL BE NO      *          
C37381**                           UPDATE TO DRAFT CYCLE ELSE WQ    **          
C37381**                           WILL BE GENERATED. AUTOMATIC     **          
C37381**                           DRAFT CYCLE UPDATE & LETTER      **          
C37381**                           GENERATION WILL NOT HAPPEN.      **          
C37381**                         3.REQSTED_DRAFT_DAY CHECK IS BEEN  **          
C37381**                           REMOVED IN AUTOMATIC DRAFT LOGIC **          
C37381**                           BASED ON ROBIN'S INPUTS.         **          
C37381**                         4.WQ PROCESS IS UPDATED TO PREVENT **          
C37381**                           FINAL BILLED ACCOUNT.            **          
C37381**                         5.REMOVED MN_CURSOR1 CURSOR.       **          
C37381**                         6.UPDATED MN_CURSOR2 CURSOR.       **          
A00765**  01/15/09    CVNS       ADDED 9000-SEND-ERROR-RESULT PARA. **  PCS00230
A00765**              CHENNAI                                       **  PCS00230
A01391**  06/30/09    BD09555    PERFORMANCE CHANGES                **  PCS00230
A01125**  07/09/09    SP94986    DISCONNECT EXEMPT DETAIL ROW OF CHG**          
A01125**                         COLUMN FIELD CORRECTIONS ON PREMISE**          
A01125**                         TRANS HIST PANEL (PANEL 156).      **          
A37741**  14 NOV 2009 MC95456    DECLARED  S-RETURN-CODE RESPECTIVE  *          
A37741**                         CPD00067  CHANGES                  **          
A02474**                                                            **          
A02474**  22 JUN 2010 NC94746    WRITE WQ WHEN ACCOUNT BILL CYCLE   **          
A02474**                         IS DIFFERENT FROM READ CYCLE. FIX  **          
A02474**                         ISSUES CAUSING BILL CYCLE & READ   **          
A02474**                         CYCLE DIFFERENCES.FIX DRAFT CYCLE  **          
A02474**                         ISSUE OF NOT GENERATING WQ'S.      **          
A02474**                                                            **          
AA2474**  31 JUL 2010 NC94746    ADDED AUTOMATIC LETTER GENERATION  **          
AA2474**                         FOR DRAFT CYCLE CHANGE CUTOMERS AND**          
AA2474**                         WRITING COMM DATA RECORDS.         **          
AB2474**  13 OCT 2010 NC94746    INITIALIZE FIORP000 LAYOUT AS PER  **          
AB2474**                         DIALOGUE JOB RECENT CHANGES TO     **          
AB2474**                         AVOID RC 08 ON DIALOGUE STEPS.     **          
A03792**  11 NOV 2011 NC94746    DEVELOP JOB PARM OPTION TO EITHER  **          
A03792**                         GENERATE REPORT OF ACCOUNTS THAT   **          
A03792**                         REQUIRE DRAFT CHANGE OR ALLOW PGM  **          
A03792**                         AUTOMATICALLY UPDATE DRAFT CYCLE.  **          
A03866**  23 JAN 2012 MC95456    MOVED MESSAGE ID TO PROMOTION-ID IN**          
A03866** A03866-ACT006           CSS_COMM_DATA.                     **          
P00599**                                                            **          
P00599** 30 AUG 2012  RC41079    INSERT NOTICES INTO DB2 TABLE      **          
P00599**                         INSTEAD OF WRITING TO A FILE.      **          
A04860**                                                            **  02431000
A04860** 08 APR 2014  MR7E794    LOAD DIRECTLY CSS_WQ_ITEMS INSTEAD **          
A04860**              ACT032     OF CSS_WQ_ITEMS_MF BY CALLING SUB  **          
A04860**                         PROGRAM SCSCB077                   **          
ACT137** 07 NOV 2014  BD09555    CHANGE CHECK FOR NUMBER OF ROWS    **          
ACT137**       a04880            CYCLE ROWS RETURNED SO THAT PROGRAM**          
ACT137**                         CAN HANDLE FEWER THAN 19.          **          
      **                                                            **          
ACT263** 23 AUG 2016  BD09555    REMOVE TBWQMF                      **          
ACT263** A05460-ACT263                                              **          
      **                                                            **          
      ****************************************************************          
      **                     PCSBW121 NARRATIVE                                 
      **   THIS PROGRAM WILL POST TO THE RELEVANT TABLES ALL CHANGES            
      **   MADE WHEN A GROUP OF ACCOUNTS IS SELECTED TO BE RESCHEDULED          
      **   OR RECYCLED. ONE REPORT IS GENERATED, LISTING BOTH ERRORS            
      **   AND NORMAL UPDATES.  INPUT TO THIS PROGRAM IS A FLAT FILE            
      **   CONTAINING DATA WHICH WAS EXTRACTED FROM MAINFRAME TABLES            
      **   AND MANIPULATED ON A PC.                                             
      ****************************************************************          
      *                                                                         
       ENVIRONMENT DIVISION.                                            
       CONFIGURATION SECTION.                                           
       SOURCE-COMPUTER.    IBM-370.                                     
       OBJECT-COMPUTER.    IBM-370.                                     
       SPECIAL-NAMES.      C01 IS TOP-OF-PAGE.                          
      *                                                                         
       INPUT-OUTPUT SECTION.                                            
       FILE-CONTROL.                                                    
       COPY CSSCA44.                                                            
       COPY CSSPT32.                                                            
A03792 COPY CSSCA47.                                                            
      *                                                                         
       DATA DIVISION.                                                   
       FILE SECTION.                                                    
       COPY CFDCA44.                                                            
       COPY FIOCA44.                                                            
       COPY CFDPT32.                                                            
A03792 COPY CFDCA47.                                                            
A03792 01 FIOCA47-RECORD                   PIC X(80).                   
      *                                                                         
       WORKING-STORAGE SECTION.                                         

MSQ008  01 MSQ008-DRAFT-DAYS  PIC S9(9) COMP-5.
MSQ017 01 MFA-PROGRAM-ID PIC X(8) VALUE 'PCSBW121'.
MSQ017     COPY MFASQLM.
      *                                                                         
       COPY FIOJC01.                                                            
       COPY CWS09900.                                                           
       COPY CWS00004.                                                           
       COPY CWS00010.                                                           
       COPY CWS00011.                                                           
       COPY CWS00038.                                                           
A03792*                                                                         
A03792 01  WS-AUTO-DRAFT-UPD-PARM REDEFINES WS-INPUT-DATA-BREAKDOWN.    
A03792     10  WS-AUTO-DRAFT-UPD-TXT       PIC X(15).                   
A03792         88  AUTO-DRAFT-UPD         VALUE 'AUTO-DRAFT-UPD='.      
A03792     10  WS-AUTO-DRAFT-UPD-FL           PIC  X(01).               
A03792     10  FILLER                         PIC  X(64).               
A03792*                                                                         
       COPY CWS00039.                                                           
AA2474 COPY CWSCA067.                                                           
       COPY CWS00303.                                                           
      *                                                                         
T18480     EXEC SQL                                                             
T18480         INCLUDE CWS00099                                                 
T18480     END-EXEC.                                                            
T18480*                                                                         
A03792 01 FIOCA47-DATA-RECORD.                                          
A03792    05 E-FCA47-ACCOUNT-NO               PIC 9(13).                
A03792    05 FILLER                           PIC X(01) VALUE ','.      
A03792    05 E-FCA47-OLD-BILL-CYCLE           PIC X(02).                
A03792    05 FILLER                           PIC X(01) VALUE ','.      
A03792    05 E-FCA47-NEW-BILL-CYCLE           PIC X(02).                
A03792    05 FILLER                           PIC X(01) VALUE ','.      
A03792    05 E-FCA47-CUR-DRAFT-CYCLE          PIC X(02).                
A03792    05 FILLER                           PIC X(58) VALUE SPACES.   
A03792*                                                                         
       01  WS-DAYS-TABLE-VALUES.                                        
           05 FILLER                   PIC X(04) VALUE '1ST '.          
           05 FILLER                   PIC X(04) VALUE '2ND '.          
           05 FILLER                   PIC X(04) VALUE '3RD '.          
           05 FILLER                   PIC X(04) VALUE '4TH '.          
           05 FILLER                   PIC X(04) VALUE '5TH '.          
           05 FILLER                   PIC X(04) VALUE '6TH '.          
           05 FILLER                   PIC X(04) VALUE '7TH '.          
           05 FILLER                   PIC X(04) VALUE '8TH '.          
           05 FILLER                   PIC X(04) VALUE '9TH '.          
           05 FILLER                   PIC X(04) VALUE '10TH'.          
           05 FILLER                   PIC X(04) VALUE '11TH'.          
           05 FILLER                   PIC X(04) VALUE '12TH'.          
           05 FILLER                   PIC X(04) VALUE '13TH'.          
           05 FILLER                   PIC X(04) VALUE '14TH'.          
           05 FILLER                   PIC X(04) VALUE '15TH'.          
           05 FILLER                   PIC X(04) VALUE '16TH'.          
           05 FILLER                   PIC X(04) VALUE '17TH'.          
           05 FILLER                   PIC X(04) VALUE '18TH'.          
           05 FILLER                   PIC X(04) VALUE '19TH'.          
           05 FILLER                   PIC X(04) VALUE '20TH'.          
           05 FILLER                   PIC X(04) VALUE '21ST'.          
           05 FILLER                   PIC X(04) VALUE '22ND'.          
           05 FILLER                   PIC X(04) VALUE '23RD'.          
           05 FILLER                   PIC X(04) VALUE '24TH'.          
           05 FILLER                   PIC X(04) VALUE '25TH'.          
           05 FILLER                   PIC X(04) VALUE '26TH'.          
           05 FILLER                   PIC X(04) VALUE '27TH'.          
           05 FILLER                   PIC X(04) VALUE '28TH'.          
           05 FILLER                   PIC X(04) VALUE '29TH'.          
           05 FILLER                   PIC X(04) VALUE '30TH'.          
           05 FILLER                   PIC X(04) VALUE '31ST'.          
      *                                                                         
       01 WS-DAYS-TABLE REDEFINES WS-DAYS-TABLE-VALUES.                 
      *                                                                         
           05 WS-DAY-TEXT              PIC X(04)                        
                                       OCCURS 31 TIMES.                 
       01  WS-STATEMENT-DATE.                                           
           05  WS-STATEMENT-YY         PIC X(02) VALUE SPACES.          
           05  WS-STATEMENT-MM         PIC X(02) VALUE SPACES.          
           05  WS-STATEMENT-DD         PIC X(02) VALUE SPACES.          
      *                                                                         
A37741 01  S-RETURN-CODE            PIC S9(9) VALUE  0.                 
      *                                                                         
       01  WS-MISC.                                                     
A02474     05 WS-DUMMY-VAR            PIC X(01) VALUE SPACES.           
A02474     05 WS-BILL-CYC-UPD-SW      PIC 9(01) VALUE 0.                
A02474        88 BILL-CYC-UPD-REQ               VALUE 0.                
A02474        88 BILL-CYC-UPD-NOT-REQ           VALUE 1.                
A02474     05 WS-READ-CYC-UPD-SW      PIC 9(01) VALUE 0.                
A02474        88 READ-CYC-UPD-REQ               VALUE 0.                
A02474        88 READ-CYC-UPD-NOT-REQ           VALUE 1.                
A02474     05 WS-GOOD-CA44-REC-SW     PIC 9(01) VALUE 0.                
A02474        88 GOOD-CA44-REC                  VALUE 0.                
A02474        88 BAD-CA44-REC                   VALUE 1.                
A02474     05 WS-DRAFT-CHNG-REQ-SW    PIC 9(01) VALUE 0.                
A02474        88 DRAFT-CHNG-NOT-REQ             VALUE 0.                
A02474        88 DRAFT-CHNG-REQ                 VALUE 1.                
A02474     05 WS-AT-BILL-CYCLE        PIC X(02) VALUE SPACES.           
A02474     05 WS-MIN-READ-CYCLE       PIC X(02) VALUE SPACES.           
A02474     05 WS-MAX-READ-CYCLE       PIC X(02) VALUE SPACES.           
A02474     05 WS-MIN-READ-ROUTE       PIC S9(04) COMP VALUE +0.         
A02474     05 WS-MAX-READ-ROUTE       PIC S9(04) COMP VALUE +0.         
A02474     05 WS-MN-REGISTER-RD-SEQ   PIC S9(09) COMP VALUE +0.         
A02474     05 WS-CURR-DATE-PLUS1      PIC X(10)  VALUE SPACES.          
A02474     05 WS-NULL-IND1            PIC S9(04) COMP VALUE +0.         
A02474     05 WS-NULL-IND2            PIC S9(04) COMP VALUE +0.         
A02474     05 WS-NULL-IND3            PIC S9(04) COMP VALUE +0.         
A02474     05 WS-NULL-IND4            PIC S9(04) COMP VALUE +0.         
           05  WS-DATE-MTR-RD-NULL-IND                                  
                                       PIC S9(04)   COMP VALUE +0.      
               88  WS-DATE-MTR-RD-NULL              VALUE -1.           
           05  WS-DATE-EXTRACT-NULL-IND                                 
                                       PIC S9(04)   COMP VALUE +0.      
               88  WS-DATE-EXTRACT-NULL             VALUE -1.           
P00599     05 WS-CORRESP-STMT-DT-NULL  PIC S9(04)   COMP.               
           05  WS-LINE-COUNT           PIC S9(03)   COMP-3 VALUE +99.   
           05  WS-PAGE-COUNT           PIC S9(05)   COMP-3 VALUE +0.    
           05  WS-REC-COUNT            PIC S9(05)   COMP-3 VALUE +0.    
           05  WS-FCA44-STATUS         PIC X(02).                       
               88  FCA44-SUCCESSFUL                 VALUE '00'.         
T18480         88  END-OF-FCA44                     VALUE '10'.         
A03792     05  WS-FCA47-STATUS         PIC X(02).                       
A03792         88  FCA47-SUCCESSFUL                 VALUE '00'.         
           05  WS-FCA32-STATUS         PIC X(02).                       
               88  FCA32-SUCCESSFUL                 VALUE '00'.         
           05  WS-TO-CYCLE             PIC XX.                          
           05  WS-TO-CYCLE-R REDEFINES WS-TO-CYCLE                      
                                       PIC 99.                          
AA2474     05  WS-PREV-TO-CYCLE        PIC XX VALUE SPACES.             
AA2474     05  WS-COMM-RETRY-COUNT     PIC S9(04) COMP VALUE 3.         
AA2474     05  WS-COMM-SUB             PIC S9(04) COMP VALUE 0.         
           05  WS-TO-ROUTE             PIC S9(04)   COMP.               
           05  WS-FROM-CYCLE           PIC XX.                          
           05  WS-FROM-CYCLE-R REDEFINES WS-FROM-CYCLE                  
                                       PIC 99.                          
           05  WS-FROM-ROUTE           PIC S9(04)   COMP.               
           05  WS-LOCAL-OFFICE         PIC XXX.                         
T23532     05  WS-LOCAL-OFFICE2        PIC XXX.                         
COB305     05 WS-PREMISE-NO        PIC S9(10) COMP-3 VALUE 0.             
           05  WS-FRP000-STATUS        PIC X(02).                       
               88  FRP000-SUCCESSFUL          VALUE '00'.               
           05  WS-BANK-DRAFT-DATE.                                      
               10 WS-BANK-DRAFT-YEAR   PIC X(04).                       
               10 FILLER               PIC X(01).                       
               10 WS-BANK-DRAFT-MONTH  PIC X(02).                       
               10 FILLER               PIC X(01).                       
               10 WS-BANK-DRAFT-DAY    PIC X(02).                       
           05  WS-BANK-DRAFT-DAY-NUM   PIC 9(02).                       
AA2474     05  WS-NEW-DRAFT-CYCLE      PIC 9(02) VALUE 0.               
AA2474     05  WS-OLD-DRAFT-CYCLE      PIC 9(02) VALUE 0.               
AA2474     05  WS-NEW-DRAFT-DAYS       PIC 9(02) VALUE 0.               
AA2474     05  WS-OLD-DRAFT-DAYS       PIC 9(02) VALUE 0.               
           05  WS-NULL-IND-5           PIC S9(04) COMP.                 
T18480     05  WS-NULL-IND-1           PIC S9(04) COMP.                 
T18480     05  IV-MN-DATE-MTR-INSTALL  PIC S9(04) COMP.                 
           05  WS-PRV-DRAFT-IND        PIC S9(04) COMP.                 
           05  WS-CLOSED-CYCLE         PIC X(01)    VALUE 'C'.          
T22926     05  WS-OPEN-CYCLE           PIC X(01)    VALUE 'R'.          
T11698     05  WS-UNMETERED            PIC X(01)    VALUE 'U'.          
T11698     05  WS-REROUTE              PIC X(01)    VALUE 'R'.          
           05  WS-REG-RD-SEQ-HOLD      PIC S9(09)   COMP.               
           05  WS-REVENUE-MONTH        PIC 9(6).                        
           05  WS-CYCLE-DIFFERENCE     PIC 9(6)     VALUE 0.            
           05  WS-MAX-CYCLE-DIFF       PIC 9        VALUE 5.            
           05  WS-TODAYS-DATE          PIC 9(08)    VALUE 0.            
           05  WS-TIME-OF-DAY          PIC 9(08)    VALUE 0.            
           05  WS-RUN-DATE             PIC X(10).                       
           05  WS-FROM-DATE-NEXT-BILL  PIC X(10).                       
           05  WS-FROM-DATE-MTR-READ   PIC X(10).                       
           05  WS-TO-DATE-NEXT-BILL    PIC X(10).                       
           05  WS-TO-DATE-MTR-READ     PIC X(10).                       
           05  WS-SYS-DATE             PIC 9(06)    VALUE ZEROES.       
           05  FILLER  REDEFINES  WS-SYS-DATE.                          
               10  WS-SYS-DATE-YY      PIC 9(02).                       
               10  WS-SYS-DATE-MM      PIC 9(02).                       
               10  WS-SYS-DATE-DD      PIC 9(02).                       
           05  WS-SYSTEM-DATE.                                          
               10  WS-SYST-YY          PIC 99.                          
               10  WS-SYST-MM          PIC 99.                          
               10  WS-SYST-DD          PIC 99.                          
               10  F                   PIC XX       VALUE SPACES.       
           05  WS-SYSTEM-TIME.                                          
               10  WS-SYSTEM-HH        PIC 99.                          
               10  WS-SYSTEM-MM        PIC 99.                          
               10  WS-SYSTEM-SS        PIC 99.                          
               10  F                   PIC XX       VALUE SPACES.       
           05  WS-RUN-TIME.                                             
               10  WS-RUN-HH           PIC 99.                          
               10  F                   PIC X        VALUE ':'.          
               10  WS-RUN-MM           PIC 99.                          
               10  F                   PIC X        VALUE ':'.          
               10  WS-RUN-SS           PIC 99.                          
           05  WS-DISPLAY-SQLCODE      PIC -ZZZZZZZZ9.                  
C37381     05  WS-TO-CYCLE-PLUS5       PIC 99       VALUE ZEROS.        
C37381     05  WS-TO-CYCLE-MINUS5      PIC 99       VALUE ZEROS.        
AA2474     05  WS-TO-CYCLE-MINUS1      PIC 99       VALUE ZEROS.        
T21445     05  WS-NUM-CYCLE            PIC 99       VALUE ZEROS.        
T28610     05  WS-RED-FL-NULL-IND      PIC S9(4)    COMP VALUE 0.       
T28610     05  WS-END-NULL-IND         PIC S9(4)    COMP VALUE 0.       
A03866     05  WS-MESSAGE-NO           PIC 9(05)    VALUE 90811.        
P00599     05  WRITTEN-NOTICE-CNT      PIC S9(04)   COMP VALUE 0.       
P00599     05  WS-CURRENT-DATE         PIC X(10)    VALUE SPACES.       
P00599     05  WS-CURRENT-TIMESTAMP    PIC X(26)    VALUE SPACES.       
P00599     05  WS-CORRESP-VAR-TYPE     PIC X(1)     VALUE SPACES.       
P00599     05  WS-CORRESP-VAR-DATA     PIC X(20)    VALUE SPACES.       
P00599     05  WS-CORRESP-VAR-NM       PIC X(20)    VALUE SPACES.       
COB305     05 WS-CORRESP-ID        PIC S9(13)V USAGE COMP-3 VALUE 0.       
C36000     05  WS-GRP2-LOW-CSC-QUALIFY PIC 9(02)    VALUE 0.            
T26307*                                                                         
T26307 01  WS-COMMIT-DATA.                                              
T26307     05  WS-PRINT-COUNTERS           PIC X(01) VALUE 'C'.         
T26307     05  WS-COMMIT-CHKP-SEQ-NO       PIC 9(05) VALUE ZERO.        
T26307     05  WS-FLAG-TO-TURN-OFF-COMMITS PIC 9(04) VALUE 9999.        
AA2474     05  WS-DEFAULT-CHKP-LUW-LIMIT PIC 9(04) VALUE 50.            
T26307     05  WS-CHKP-LUW-LIMIT         PIC 9(04).                     
T26307     05  WS-CHKP-LUW-COUNTER       PIC 9(04) COMP-3 VALUE ZERO.   
AA2474     05  WS-DEFAULT-CHKP-UPD-LIMIT PIC 9(04) VALUE 50.            
T26307     05  WS-CHKP-UPD-LIMIT         PIC 9(04).                     
T26307     05  WS-CHKP-UPD-COUNTER       PIC S9(04) COMP-3 VALUE ZERO.  
T26307     05  WS-CHKP-ID.                                              
T26307         10  WS-CHKP-PGM-ID   PIC X(02) VALUE 'B4'.               
T26307         10  WS-CHKP-PART-NO  PIC 9(01) VALUE 0.                  
T26307         10  WS-CHKP-SEQ-NO   PIC 9(05) VALUE ZERO.               
T26307     05  WS-DUP               PIC S9(04) COMP VALUE -803.         
T26307*****************************************************************         
T26307*    THE FOLLOWING FIELD WILL ALLOW PROGRAMMER TO FORCE ABEND BY          
T26307*    SPECIFYING AN ACCOUNT NO                                             
T26307*****************************************************************         
T26307     05  WS-STOP-ACCOUNT-NO            PIC 9(13).                 
T26307*****************************************************************         
T26307*  THE FOLLOWING FIELDS ARE TO STORE OFF THE DATABASE UPDATE              
T26307*  COUNTERS "PER LUW" AN LUW = 1 ENTRY IN THE JOB PARM TABLE              
T26307*****************************************************************         
T26307     05  WS-AT-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-PR-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-MN-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-UT-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-RG-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-BG-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-BE-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-CQ-ISRT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-WQ-ISRT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-RF-ISRT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
T26307     05  WS-RF-UPDT-CNTR-LUW                PIC S9(07) COMP-3     
T26307                                                       VALUE ZERO.
AA2474     05  WS-COMMIT-ACCT-NO                  PIC 9(13) VALUE 0.    
T26307*                                                                         
T26307 01  WS-STOP-PARM-BREAKDOWN.                                      
T26307      05  WS-STOP-PARM-ACCOUNT-NO           PIC 9(10).            
T26307      05  FILLER                            PIC X(38).            
      *                                                                         
       01  WS-SWITCHES.                                                 
           05  WS-BILL-CYCLE-FOUND-SW    PIC X(01)  VALUE 'N'.          
               88  BILL-CYCLE-NOT-FOUND             VALUE 'N'.          
           05  WS-READ-CYCLE-FOUND-SW    PIC X(01)  VALUE 'N'.          
               88  READ-CYCLE-NOT-FOUND             VALUE 'N'.          
A03792     05  WS-AUTO-DRAFT-UPD-REQ-SW  PIC 9(01)  VALUE 0.            
A03792         88  REPORT-ONLY-REQ                  VALUE 0.            
A03792         88  AUTO-DRAFT-UPD-REQ               VALUE 1.            
P00599     05  WS-WRITE-NOTICE-IND       PIC X(01)  VALUE SPACES.       
P00599         88  WRITE-NOTICE                     VALUE 'Y'.          
      *                                                                         
AA2474 01 WS-TAB-VARS.                                                  
AA2474    05 WS-DRAFT-ROW-COUNT       PIC S9(4) COMP VALUE 0.           
AA2474    05 WS-DRAFT-SUB             PIC 9(02)  VALUE 0.               
AA2474    05 WS-PREV-DRAFT-DAYS       PIC 9(02)  VALUE 0.               
AA2474    05 WS-DRAFT-TAB.                                              
AA2474       10 WS-DRAFT-CYCLE        PIC X(02) OCCURS 30 TIMES         
AA2474                                              VALUE SPACES.       
AA2474       10 WS-DRAFT-DAYS         PIC S9(04) COMP OCCURS 30 TIMES   
AA2474                                              VALUE 0.            
AA2474    05 WS-DFT-SUB               PIC 9(02) COMP VALUE 0.           
AA2474    05 WS-DFT-MATCH-TAB.                                          
AA2474       10 WS-TAB-TO-CYCLE       PIC 9(02) OCCURS 9 TIMES          
AA2474                                              VALUE ZEROS.        
       01  WS-LITERALS.                                                 
           05  PROGRAM-NAME            PIC X(08)    VALUE 'PCSBW121'.   
           05  WS-PGRMNAME             PIC X(08)    VALUE 'PCSBW121'.   
           05  WS-COMMON               PIC X(08)    VALUE 'COMMON  '.   
           05  WS-N                    PIC X(01)    VALUE 'N'.          
           05  WS-Y                    PIC X(01)    VALUE 'Y'.          
           05  WS-1                    PIC X(01)    VALUE '1'.          
           05  WS-LETTER               PIC X(01)    VALUE 'L'.          
           05  WS-OUTGOING             PIC X(01)    VALUE 'O'.          
           05  WS-YES                  PIC X(01)    VALUE 'Y'.          
           05  WS-NO                   PIC X(01)    VALUE 'N'.          
           05  WS-DASHES               PIC X(10)    VALUE ALL '-'.      
           05  WS-USERABEN             PIC X(08)    VALUE 'USERABEN'.   
           05  WS-USERABEN-MESSAGE     PIC X(72)    VALUE               
               'UNSUCCESSFUL CALL TO JOURNAL ROUTINE'.                  
C32762     05  WS-RESEQ-DESC           PIC X(38)    VALUE               
C28610         'METER CYCLE/ROUTE/SEQ/LOCAL OFFICE CHG'.                
C28610     05  WS-RESEQ-DESC-SHORT     PIC X(15)    VALUE               
C28610         'CYC/RT/SEQ/LOC '.                                       
A04860     05  SCSCB077                PIC X(08)    VALUE 'SCSCB077'.   
      *                                                                         
30592      05  WS-CODE-LPC-XMT         PIC X(19)    VALUE               
30592          'LATE PAYMENT EXMPTN'.                                   
30592      05  WS-OLD-CODE-LPC-XMT     PIC X.                           
30592      05  WS-NEW-CODE-LPC-XMT     PIC X.                           
      *                                                                         
30592      05  WS-CODE-DISC-OK         PIC X(17)    VALUE               
30592          'DISCONNECT EXMPTN'.                                     
30592      05  WS-OLD-CODE-DISC-OK     PIC X.                           
30592      05  WS-NEW-CODE-DISC-OK     PIC X.                           
      *                                                                         
30592      05  WS-PRORATE-CODE         PIC X(13)    VALUE               
30592          'BG-PRORATE-CD'.                                         
30592      05  WS-OLD-PRORATE-CD       PIC X.                           
30592      05  WS-NEW-PRORATE-CD       PIC X.                           
      *                                                                         
AA2474     05  WS-INITIAL-COMMENTS     PIC X(45)    VALUE               
AA2474            'DRAFT CYCLE CHANGE COMMUNICATION LETTER SENT.'.      
           05  WS-REROUTE-COMMENTS     PIC X(80)    VALUE               
T21711         'BILL CYCLE IS CHANGED, DRAFT CYCLE MAY NOT BE VALID. PLE        
T21711-        'ASE REVIEW.'.                                                   
T21711*     'DRAFT CYCLE NO LONGER VALID FOR BILL CYCLE'.                       
A02474*                                                                         
A02474     05 WS-CYC-DIFF-COMMENTS.                                     
A02474        10 WS-CYC-DIFF-TXT          PIC X(34)    VALUE            
A02474         'BILL CYCLE NOT SAME AS READ CYCLE,'.                    
A02474        10 WS-CYC-DIFF-BCYC-TXT     PIC X(10)    VALUE            
A02474         ' BILL CYC:'.                                            
A02474        10 WS-CYC-DIFF-BCYC-NO      PIC X(02)    VALUE            
A02474         '00'.                                                    
A02474        10 WS-CYC-DIFF-FRCYC-TXT    PIC X(16)    VALUE            
A02474         ', FROM READ CYC:'.                                      
A02474        10 WS-CYC-DIFF-FRCYC-NO     PIC X(02)    VALUE            
A02474         '00'.                                                    
A02474        10 WS-CYC-DIFF-TRCYC-TXT    PIC X(14)    VALUE            
A02474         ', TO READ CYC:'.                                        
A02474        10 WS-CYC-DIFF-TRCYC-NO     PIC X(02)    VALUE            
A02474         '00'.                                                    
A02474        10 WS-CYC-CHNG-CODE-TXT     PIC X(23)    VALUE            
A02474           ', BILL CYC CHNG REASON:'.                             
A02474        10 WS-CYC-DIFF-FIA-IND      PIC X(12) VALUE SPACES.       
A02474           88 FIA-ACCOUNT         VALUE 'FIA ACCOUNT'.            
A02474           88 NON-UTILITY-ACC     VALUE 'NON UTILITY'.            
A02474           88 BANK-DRAFT-ACC      VALUE 'BANK DRAFT'.             
A02474           88 READ-DATE-ACC       VALUE 'READ DATE'.              
A02474           88 SETUP-MASTER-ACC    VALUE 'SETUP MASTER'.           
A02474           88 UN-AVAILABLE        VALUE 'UN-KNOWN'.               
A02474           88 NO-CHNG-REASON      VALUE 'NONE'.                   
A02474                                                                  
A02474*                                                                         
           05  WS-NEW-METER-DATA.                                       
               10  WS-JRNL-NEW-CYCLE   PIC 9(02).                       
               10  FILLER              PIC X(03)    VALUE ' / '.        
               10  WS-JRNL-NEW-ROUTE   PIC 9(04).                       
               10  FILLER              PIC X(03)    VALUE ' / '.        
5212           10  WS-JRNL-NEW-SEQ     PIC 9(09).                       
C28610         10  FILLER              PIC X(03)    VALUE ' / '.        
C28610         10  WS-JRNL-NEW-LOC-OFF PIC X(03).                       
           05  WS-OLD-METER-DATA.                                       
               10  WS-JRNL-OLD-CYCLE   PIC 9(02).                       
               10  FILLER              PIC X(03)    VALUE ' / '.        
               10  WS-JRNL-OLD-ROUTE   PIC 9(04).                       
               10  FILLER              PIC X(03)    VALUE ' / '.        
5212           10  WS-JRNL-OLD-SEQ     PIC 9(09).                       
C28610         10  FILLER              PIC X(03)    VALUE ' / '.        
C28610         10  WS-JRNL-OLD-LOC-OFF PIC X(03).                       
           05  WS-DEFAULT-RPT1-TITLE   PIC X(50)    VALUE               
               '     SOUTH CAROLINA ELECTRIC AND GAS              '.    
           05  WS-DEFAULT-RPT1-HEAD    PIC X(50)    VALUE               
               '     ACCOUNT REROUTE/RECYCLING UPDATE REPORT      '.    
      *                                                                         
       01  WS-ERROR-MESSAGES.                                           
           05  WS-TO-BAD-COMBO.                                         
               10  FILLER              PIC X(31)    VALUE               
                   'INVALID LOC OFFICE-CYCLE-ROUTE '.                   
           05  WS-FROM-CYCLE-OPEN.                                      
               10  FILLER              PIC X(31)    VALUE               
                   'FROM CYCLE BILL WINDOW OPEN    '.                   
           05  WS-FROM-CYCLE-BILLED.                                    
               10  FILLER              PIC X(31)    VALUE               
                   'FROM CYCLE BILLED, TO CYCLE NOT'.                   
           05  WS-TO-CYCLE-OPEN.                                        
               10  FILLER              PIC X(31)    VALUE               
                   'TO CYCLE BILL WINDOW OPEN      '.                   
           05  WS-TO-CYCLE-BILLED.                                      
               10  FILLER              PIC X(31)    VALUE               
                   'TO CYCLE BILLED, FROM CYCLE NOT'.                   
           05  WS-CYCLE-DIFF-ERROR      PIC X(31)    VALUE              
                   'CYCLE DIFFERENCE GREATER THAN 5'.                   
           05  WS-UT-ERROR              PIC X(31)    VALUE              
                   'UTIL ENVRNMT DATA NOT VALID    '.                   
           05  WS-MN-ERROR              PIC X(41)    VALUE              
                   'REGISTER READ SEQ NOT IN MTRD ENVRNMT'.             
           05  WS-AT-ERROR              PIC X(31)    VALUE              
                   'ACCOUNT INFO DATA NOT VALID    '.                   
A02474     05  WS-PR-ERROR              PIC X(31)    VALUE              
A02474             'PREMISE INFO DATA NOT VALID    '.                   
           05  WS-AA-ERROR              PIC X(31)    VALUE              
                   'NO ACTIVE ACCOUNT FOR PREMISE  '.                   
           05  WS-TO-ERROR              PIC X(23)    VALUE              
                   'TO CYCLE NOT NUMERIC: '.                            
           05  WS-FROM-ERROR            PIC X(25)    VALUE              
                   'FROM CYCLE NOT NUMERIC: '.                          
           05  WS-NO-REV-MONTH          PIC X(25)    VALUE              
                    'NO REVENUE MONTH ON FILE'.                         
      *                                                                         
       01  WS-NO-DATA-LINE.                                             
           05  FILLER                  PIC X(55)    VALUE SPACES.       
           05  FILLER                  PIC X(22)    VALUE               
                     '** NO DATA THIS RUN **'.                          
           05  FILLER                  PIC X(55)    VALUE SPACES.       
      *                                                                         
       01  P-HEADER-LINE-1.                                             
           05  FILLER                  PIC X(08)    VALUE 'PCSBW121'.   
           05  FILLER                  PIC X(33)    VALUE SPACES.       
           05  P-RPT1-TITLE            PIC X(50).                       
           05  FILLER                  PIC X(23)    VALUE SPACES.       
           05  FILLER                  PIC X(10)    VALUE 'RUN DATE: '. 
           05  P-RUN-DATE              PIC X(08).                       
      *                                                                         
       01  P-HEADER-LINE-2.                                             
           05  FILLER                  PIC X(06)    VALUE 'DATE: '.     
           05  P-REPORT-DATE           PIC X(08).                       
           05  FILLER                  PIC X(27)    VALUE SPACES.       
           05  P-RPT1-HEAD             PIC X(50).                       
           05  FILLER                  PIC X(23)    VALUE SPACES.       
           05  FILLER                  PIC X(10)    VALUE 'RUN TIME: '. 
           05  P-RUN-TIME              PIC X(08).                       
      *                                                                         
       01  P-HEADER-LINE-2A.                                            
           05  FILLER                  PIC X(118)   VALUE SPACES.       
           05  FILLER                  PIC X(07)    VALUE 'PAGE:  '.    
           05  P-PAGE-NO               PIC Z,ZZ9.                       
      *                                                                         
       01  P-HEADER-LINE-3.                                             
           05  FILLER                  PIC X(01)    VALUE SPACES.       
           05  FILLER                  PIC X(28)    VALUE               
                                      'LOCAL   ACCOUNT        UTIL '.   
           05  FILLER                  PIC X(01)    VALUE SPACES.       
           05  FILLER                  PIC X(27)    VALUE               
                                      '*********** FROM **********'.    
           05  FILLER                  PIC X(06)    VALUE SPACES.       
           05  FILLER                  PIC X(27)    VALUE               
                                      '************ TO ***********'.    
           05  FILLER                  PIC X(03)    VALUE SPACES.       
           05  FILLER                  PIC X(27)    VALUE               
                                      '***** ERROR MESSAGES *****'.     
           05  FILLER                  PIC X(13)  VALUE SPACES.         
      *                                                                         
       01  P-HEADER-LINE-4.                                             
           05  FILLER                  PIC X(01)    VALUE SPACES.       
           05  FILLER                  PIC X(28)    VALUE               
                                      'OFFICE  NUMBER         TYPE '.   
           05  FILLER                  PIC X(01)    VALUE SPACES.       
           05  FILLER                  PIC X(27)    VALUE               
                                      'RG.RD.SEQ  CYCLE  ROUTE    '.    
           05  FILLER                  PIC X(06)    VALUE SPACES.       
           05  FILLER                  PIC X(27)    VALUE               
                                      'RG.RD.SEQ  CYCLE  ROUTE    '.    
           05  FILLER                  PIC X(43)    VALUE SPACES.       
      *                                                                         
       01  P-DETAIL-LINE-1.                                             
           05  FILLER                  PIC X(01)    VALUE SPACES.       
T18480     05  P-LOCAL-OFFICE          PIC 9(03).                       
           05  FILLER                  PIC X(05)    VALUE SPACES.       
           05  P-ACCOUNT-NO            PIC Z(13).                       
           05  FILLER                  PIC X(03)    VALUE SPACES.       
           05  P-CODE-UTIL-TYPE        PIC X(01).                       
           05  FILLER                  PIC X(04)    VALUE SPACES.       
           05  P-REGISTER-RD-SEQ       PIC Z(09).                       
           05  FILLER                  PIC X(03)    VALUE SPACES.       
T18480     05  P-FROM-CYCLE            PIC 9(02).                       
           05  FILLER                  PIC X(04)    VALUE SPACES.       
T18480     05  P-FROM-ROUTE            PIC 9(04).                       
           05  FILLER                  PIC X(11)    VALUE SPACES.       
           05  P-REG-RD-SEQ-HOLD       PIC Z(09).                       
           05  FILLER                  PIC X(03)    VALUE SPACES.       
T18480     05  P-TO-CYCLE              PIC 9(02).                       
           05  FILLER                  PIC X(04)    VALUE SPACES.       
T18480     05  P-TO-ROUTE              PIC 9(04).                       
           05  FILLER                  PIC X(05)    VALUE SPACES.       
           05  P-ERROR-MESSAGE         PIC X(43).                       
      *                                                                         
T18480 01  WS-END-OF-DATA.                                              
T18480     05  FILLER                          PIC X(57)  VALUE SPACES. 
T18480     05  FILLER                          PIC X(20)  VALUE         
T18480         '***END OF REPORT*** '.                                  
T18480     05  FILLER                          PIC X(55)  VALUE SPACES. 
      *                                                                         
A04860 01  WS-RUN-TS.                                                   
A04860     05  WS-RUN-DATE-TS          PIC X(10).                       
A04860     05  WS-RUN-TS-REF           PIC X(16)                        
A04860                               VALUE '-00.00.00.000000'.          
A04860 01  WS-CURR-TS.                                                  
A04860     05  WS-CURR-DATE-TS              PIC X(10).                  
A04860     05  WS-CURR-TS-REF               PIC X(16)                   
A04860                                    VALUE '-00.00.00.000000'.     
A04860******************************************************************        
A04860* WORKING STORAGE COPYBOOK FOR SCSCB077                          *        
A04860******************************************************************        
A04860*                                                                         
A04860     EXEC SQL                                                             
A04860        INCLUDE CWS00077                                                  
A04860     END-EXEC.                                                            
A04860*                                                                         
P00599*****************************************************************         
P00599*  CWS00341  - INSERT INTO CSS_CORRESP_HDR, CSS_CORRESP_NOTICE, *         
P00599*              AND CSS_CORRESP_VAR.                             *         
P00599*****************************************************************         
P00599*                                                                         
P00599      EXEC SQL                                                            
P00599           INCLUDE CWS00341                                               
P00599      END-EXEC.                                                           
P00599*                                                                         
P00599*****************************************************************         
P00599*  CWS00350  - CORRESP_COMM vARIABLES                           *         
P00599*****************************************************************         
P00599*                                                                         
P00599      EXEC SQL                                                            
P00599           INCLUDE CWS00350                                               
P00599      END-EXEC.                                                           
P00599*                                                                         
P00599*****************************************************************         
P00599*  CWSCA165  - THIS COPYBOOK IS THE WORKING STORAGE FOR CPDCA165*         
P00599*****************************************************************         
P00599*                                                                         
P00599      EXEC SQL                                                            
P00599           INCLUDE CWSCA165                                               
P00599      END-EXEC.                                                           
P00599*                                                                         
           EXEC SQL                                                             
               INCLUDE SQLCA                                                    
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBJBPARM                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBBLLDET                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBLCOFRT                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBBILWDW                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBRDWNDW                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBMNHIST                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBMNHDT                                                  
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBRGREAD                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBACCT                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
               INCLUDE TBUTLENV                                                 
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBMTRENV                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBNMACTX                                                   
           END-EXEC.                                                            
      *                                                                         
DC         EXEC SQL                                                             
DC           INCLUDE TBBNKEFT                                                   
DC         END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBNAME                                                     
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBCSADRX                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBADRFRE                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBADRFMT                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBZIPCD                                                    
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBPDBKDF                                                   
           END-EXEC.                                                            
      *                                                                         
           EXEC SQL                                                             
             INCLUDE TBCUST                                                     
           END-EXEC.                                                            
      *                                                                         
C28610     EXEC SQL                                                             
C28610         INCLUDE TBCOMDAT                                                 
C28610     END-EXEC.                                                            
      *                                                                         
TP4657     EXEC SQL                                                             
TP4657         INCLUDE TBATMISC                                                 
TP4657     END-EXEC.                                                            
      *                                                                         
C28610     EXEC SQL                                                             
C28610         INCLUDE TBCSTPRM                                                 
C28610     END-EXEC.                                                            
      *                                                                         
P00599******************************************************************06330000
P00599* CSS_PREMISE - PR                                               *06340000
P00599******************************************************************06350000
      *                                                                         
P00599     EXEC SQL                                                             
P00599         INCLUDE TBPREM                                                   
P00599     END-EXEC.                                                            
      *                                                                         
P00599******************************************************************06330000
P00599* CSS_CORRESP_HDR - 1J                                           *06340000
P00599******************************************************************06350000
      *                                                                         
P00599     EXEC SQL                                                             
P00599         INCLUDE TBCORHDR                                                 
P00599     END-EXEC.                                                            
      *                                                                         
P00599******************************************************************        
P00599* CSS_CORRESP_NOTICE - 1M                                       *         
P00599******************************************************************        
      *                                                                         
P00599     EXEC SQL                                                             
P00599         INCLUDE TBCORNOT                                                 
P00599     END-EXEC.                                                            
      *                                                                         
P00599******************************************************************06330000
P00599* CSS_CORRESP_VAR - 1K                                           *06340000
P00599******************************************************************06350000
      *                                                                         
P00599     EXEC SQL                                                             
P00599         INCLUDE TBCORVAR                                                 
P00599     END-EXEC.                                                            
      *                                                                         
P00599******************************************************************06330000
P00599* CSS_CORRESP_COMM - IL                                          *06340000
P00599******************************************************************06350000
      *                                                                         
P00599     EXEC SQL                                                             
P00599         INCLUDE TBCORCOM                                                 
P00599     END-EXEC.                                                            
      *                                                                         
T18480******************************************************************        
C37381* CURSOR FOR RECORDS FROM MN & UT BASED ON PREMISE, METER_NO ETC *        
T18480******************************************************************        
A02474     EXEC SQL                                                     
A02474         DECLARE   MN_CURSOR CURSOR FOR                           
A02474          SELECT   MN.ACCOUNT_NO                                  
A02474                  ,MN.REGISTER_RD_SEQ                             
A02474                  ,MN.CODE_DATA_PRESENT                           
A02474            FROM   CSS_MTRD_ENVRNMT MN WITH(READUNCOMMITTED)              
A02474                  ,CSS_UTIL_ENVRNMT UT WITH(READUNCOMMITTED)              
A02474           WHERE   UT.ACCOUNT_NO        = MN.ACCOUNT_NO           
A02474             AND   UT.CODE_UTIL_TYPE    = MN.CODE_UTIL_TYPE       
A02474             AND   UT.IC_NO             = MN.IC_NO                
A02474             AND   MN.CODE_UTIL_TYPE    = :MN-CODE-UTIL-TYPE      
A02474             AND   MN.IC_NO             = :MN-IC-NO               
A02474             AND   MN.MTR_REF_NO        = :MN-MTR-REF-NO          
A02474             AND   UT.PREMISE_NO        = :UT-PREMISE-NO          
A02474           FOR READ ONLY                                  
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ004
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DECLARE   MN_CURSOR CURSOR FOR                                   
MFA-TR*         SELECT   MN.ACCOUNT_NO                                          
MFA-TR*                 ,MN.REGISTER_RD_SEQ                                     
MFA-TR*                 ,MN.CODE_DATA_PRESENT                                   
MFA-TR*           FROM   CSS_MTRD_ENVRNMT MN                                    
MFA-TR*                 ,CSS_UTIL_ENVRNMT UT                                    
MFA-TR*          WHERE   UT.ACCOUNT_NO        = MN.ACCOUNT_NO                   
MFA-TR*            AND   UT.CODE_UTIL_TYPE    = MN.CODE_UTIL_TYPE               
MFA-TR*            AND   UT.IC_NO             = MN.IC_NO                        
MFA-TR*            AND   MN.CODE_UTIL_TYPE    = :MN-CODE-UTIL-TYPE              
MFA-TR*            AND   MN.IC_NO             = :MN-IC-NO                       
MFA-TR*            AND   MN.MTR_REF_NO        = :MN-MTR-REF-NO                  
MFA-TR*            AND   UT.PREMISE_NO        = :UT-PREMISE-NO                  
MFA-TR*          FOR FETCH ONLY WITH UR                                         
MFA-TR*          QUERYNO 7150                                                   
MFA-TR*    END-EXEC.                                                            
AA2474*                                                                         
T18480******************************************************************        
C37381* CURSOR TO GET 20 CYCLES AND THEIR DRAFT DAY FROM BW TABLE.     *        
T18480******************************************************************        
A02474     EXEC SQL                                                     
A02474         DECLARE DRAFT_DAYS CURSOR                                
A02474                 WITH ROWSET POSITIONING FOR                      
A02474          SELECT BILL_CYCLE                                       
A02474                ,MIN(DAY(DATE_EXTRACT))                           
A02474          FROM CSS_BILL_WINDOW WITH(READUNCOMMITTED)                      
A02474          WHERE BILL_CYCLE < '21'                                 
A02474            AND DATE_EXTRACT   > CAST(SYSDATETIMEOFFSET() AS DATE)        
A02474            AND CIS.INT2DECIMAL(MONTH(DATE_EXTRACT))/100                  
A02474               = (REVENUE_MONTH/100) - FLOOR(REVENUE_MONTH/100)   
A02474            AND YEAR(DATE_EXTRACT)  =  FLOOR(REVENUE_MONTH/100)   
A02474          GROUP BY BILL_CYCLE                                     
A02474          ORDER BY BILL_CYCLE                                     
A02474          FOR READ ONLY                                   
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ004
MFA-TR* MSQ022
MFA-TR* MSQ028
MFA-TR* MSQ029
MFA-TR*    EXEC SQL                                                             
MFA-TR*        DECLARE DRAFT_DAYS CURSOR                                        
MFA-TR*                WITH ROWSET POSITIONING FOR                              
MFA-TR*         SELECT BILL_CYCLE                                               
MFA-TR*               ,MIN(DAY(DATE_EXTRACT))                                   
MFA-TR*         FROM CSS_BILL_WINDOW                                            
MFA-TR*         WHERE BILL_CYCLE < '21'                                         
MFA-TR*           AND DATE_EXTRACT   > CURRENT DATE                             
MFA-TR*           AND DECIMAL(MONTH(DATE_EXTRACT))/100                          
MFA-TR*              = (REVENUE_MONTH/100) - FLOOR(REVENUE_MONTH/100)           
MFA-TR*           AND YEAR(DATE_EXTRACT)  =  FLOOR(REVENUE_MONTH/100)           
MFA-TR*         GROUP BY BILL_CYCLE                                             
MFA-TR*         ORDER BY BILL_CYCLE                                             
MFA-TR*         FOR FETCH ONLY WITH UR                                          
MFA-TR*         QUERYNO 7320                                                    
MFA-TR*    END-EXEC.                                                            
A02474*                                                                         
       PROCEDURE DIVISION.                                              
      ****************************************************************          
      **                                                            **          
      **  0000-MAINLINE                                             **          
      **      CONTROLS MAIN PROCESSING OF PROGRAM                   **          
      **                                                            **          
      ****************************************************************          
       0000-MAINLINE.                                                   
      *                                                                         
           PERFORM 0100-INITIALIZATION           THRU 0100-EXIT.        
T18480     PERFORM 1000-PROCESS THRU 1000-EXIT                          
T18480                  UNTIL END-OF-FCA44.                             
      *                                                                         
           IF WS-REC-COUNT EQUAL ZERO                                   
               PERFORM 1320-PRINT-HEADING        THRU 1320-EXIT         
               WRITE PRT32-RECORD FROM WS-NO-DATA-LINE                  
                    AFTER ADVANCING 2 LINES                             
T18480     ELSE                                                         
T18480         WRITE PRT32-RECORD FROM WS-END-OF-DATA                   
T18480              AFTER ADVANCING 2 LINES                             
           END-IF.                                                      
      *                                                                         
           PERFORM 9000-TERMINATE                THRU 9000-EXIT.        
           STOP RUN.                                                    
      *                                                                         
       0000-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ****************************************************************          
      **                                                            **          
      **  0100-INITIALIZATION                                       **          
      **      COMMON INITIALIZATION ROUTINE                         **          
      **                                                            **          
      ****************************************************************          
       0100-INITIALIZATION.                                             
      *                                                                         
           OPEN INPUT FCSCA44-FILE                                      
                OUTPUT FCSPT32-FILE                                     
A03792          OUTPUT FCSCA47-FILE.                                    
      *                                                                         
           ACCEPT WS-SYSTEM-TIME FROM TIME.                             
           MOVE WS-SYSTEM-HH           TO WS-RUN-HH.                    
           MOVE WS-SYSTEM-MM           TO WS-RUN-MM.                    
           MOVE WS-SYSTEM-SS           TO WS-RUN-SS.                    
           MOVE WS-RUN-TIME            TO P-RUN-TIME.                   
      *                                                                         
           ACCEPT WS-SYSTEM-DATE FROM DATE.                             
           MOVE WS-SYST-YY             TO WS-DISPLAY-YY.                
           MOVE WS-SYST-MM             TO WS-DISPLAY-MM.                
           MOVE WS-SYST-DD             TO WS-DISPLAY-DD.                
           MOVE WS-DISPLAY-DATE        TO P-RUN-DATE.                   
      *                                                                         
           PERFORM 6251-GET-FJC01-DATE           THRU 6251-EXIT.        
      *                                                                         
T17765     IF COMMON-DATE-NEEDED                                        
T17765        MOVE 'COMMON'            TO WS-PGRMNAME                   
T17765        MOVE SPACES              TO WS-INPUT-AREA                 
T17765        MOVE SPACES              TO WS-INPUT-DATA-BREAKDOWN       
T17765        PERFORM 6251-GET-FJC01-DATE THRU 6251-EXIT                
T17765        MOVE 'PCSBW121'          TO WS-PGRMNAME
           END-IF.                  
      *                                                                         
T17765     MOVE WS-INPUT-DATE          TO WS-INPUT-RUN-DATE.            
      *                                                                         
           MOVE WS-INPUT-RUN-DATE-CC   TO WS-DATE-CC.                   
           MOVE WS-INPUT-RUN-DATE-YY   TO WS-DATE-YY,                   
                                          P-REPORT-DATE (7:2),          
                                          WS-STATEMENT-YY.              
           MOVE WS-INPUT-RUN-DATE-MM   TO WS-DATE-MM,                   
                                          P-REPORT-DATE (1:2),          
                                          WS-STATEMENT-MM.              
           MOVE WS-INPUT-RUN-DATE-DD   TO WS-DATE-DD,                   
                                          P-REPORT-DATE (4:2),          
                                          WS-STATEMENT-DD.              
           MOVE '/'                    TO P-REPORT-DATE (3:1),          
                                          P-REPORT-DATE (6:1).          
           MOVE WS-INPUT-RUN-DATE      TO WS-RUN-DATE.                  
           MOVE WS-DATE-BREAKDOWN      TO WS-TODAYS-DATE.               
           MOVE WS-PGRMNAME            TO WS-PROGRAM.                   
           MOVE SPACES                 TO WS-SYSIPT.                    
           MOVE ZEROS                  TO WS-SEQUENCE.                  
           MOVE WS-PARM                TO WS-COMMAND.                   
           MOVE WS-KEY-AREA            TO E-FJC01-KEY.                  
      *                                                                         
           PERFORM 7600-START-FCSJC01            THRU 7600-EXIT.        
           PERFORM 7610-READ-FCSJC01             THRU 7610-EXIT         
               UNTIL (RPT1-TITLE AND INPUT-ACTIVE)                      
                  OR  END-OF-SYSIPT.                                    
      *                                                                         
           IF END-OF-SYSIPT                                             
               MOVE WS-DEFAULT-RPT1-TITLE TO P-RPT1-TITLE               
               MOVE WS-DEFAULT-RPT1-HEAD TO P-RPT1-HEAD                 
           ELSE                                                         
               PERFORM 7611-CLOSE                THRU 7611-EXIT         
               MOVE WS-RPT1-TITLE-PARM TO P-RPT1-TITLE                  
               MOVE WS-DEFAULT-RPT1-HEAD TO P-RPT1-HEAD                 
           END-IF.                                                      
A03792*                                                                         
A03792     MOVE WS-PGRMNAME            TO WS-PROGRAM.                   
A03792     MOVE SPACES                 TO WS-SYSIPT.                    
A03792     MOVE ZEROS                  TO WS-SEQUENCE.                  
A03792     MOVE WS-PARM                TO WS-COMMAND.                   
A03792     MOVE WS-KEY-AREA            TO E-FJC01-KEY.                  
A03792*                                                                         
A03792     PERFORM 7600-START-FCSJC01            THRU 7600-EXIT.        
A03792     PERFORM 7610-READ-FCSJC01             THRU 7610-EXIT         
A03792         UNTIL (AUTO-DRAFT-UPD AND INPUT-ACTIVE)                  
A03792            OR  END-OF-SYSIPT.                                    
A03792*                                                                         
A03792     IF END-OF-SYSIPT                                             
A03792        DISPLAY ' '                                               
A03792        DISPLAY '******************************************'      
A03792        DISPLAY '* AUTO DRAFT UPDATE FLAG NOT SET UP     **'      
A03792        DISPLAY '* FLAG SET TO DEFAULT OF REPORT-ONLY    **'      
A03792        DISPLAY '******************************************'      
A03792        SET REPORT-ONLY-REQ          TO TRUE                      
A03792     ELSE                                                         
A03792        PERFORM 7611-CLOSE                THRU 7611-EXIT          
A03792        DISPLAY ' '                                               
A03792        IF WS-AUTO-DRAFT-UPD-FL = 'Y'                             
A03792           DISPLAY '******************************************'   
A03792           DISPLAY '* AUTO DRAFT UPDATE FLAG SET TO Y        *'   
A03792           DISPLAY '* PROGRAM PERFORM AUTOMATIC DRAFT CYCLE  *'   
A03792           DISPLAY '* UPDATES AND SEND COMMUNICATION LETTERS *'   
A03792           DISPLAY '******************************************'   
A03792           SET AUTO-DRAFT-UPD-REQ   TO TRUE                       
A03792        ELSE                                                      
A03792           DISPLAY '******************************************'   
A03792           DISPLAY '* AUTO DRAFT UPDATE FLAG SET TO: '            
A03792                                       WS-AUTO-DRAFT-UPD-FL       
A03792           DISPLAY '* PROGRAM GENERATE REPORT ONLY AND DO NOT*'   
A03792           DISPLAY '* UPDATES DRAFT CYCLE.                   *'   
A03792           DISPLAY '******************************************'   
A03792           SET REPORT-ONLY-REQ          TO TRUE                   
A03792        END-IF                                                    
A03792     END-IF.                                                      
A03792*                                                                         
      ***  THE REVENUE MONTH IS OBTAINED BY GETTING THE MOST RECENT             
      ***  EXTRACT DATE FROM THE READ WINDOW TABLE FOR READ CYCLE 1.            
      *                                                                         
A01319     EXEC SQL                                                     
A01319         SELECT TOP(1) REVENUE_MONTH                                   
A01319             INTO :RW-REVENUE-MONTH                               
A01319             FROM CSS_READ_WINDOW WITH(READUNCOMMITTED)                   
A01319             WHERE READ_CYCLE = '01'                              
A01319               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) )              
A01319             ORDER BY DATE_MTR_RD_XTRCT DESC                      
A01319                                       
A02474                                                       
           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   REVENUE_MONTH                                           
MFA-TR*            INTO :RW-REVENUE-MONTH                                       
MFA-TR*            FROM CSS_READ_WINDOW                                         
MFA-TR*            WHERE READ_CYCLE = '01'                                      
MFA-TR*              AND DATE_MTR_RD_XTRCT <= :WS-RUN-DATE                      
MFA-TR*            ORDER BY DATE_MTR_RD_XTRCT DESC                              
MFA-TR*            FETCH FIRST ROW ONLY WITH UR                                 
MFA-TR*          QUERYNO 100                                                    
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

      *                                                                         
           IF SQLCODE EQUAL SUCCESSFUL-CALL                             
               MOVE RW-REVENUE-MONTH   TO WS-REVENUE-MONTH              
           ELSE                                                         
               IF SQLCODE EQUAL NOT-FOUND                               
                   MOVE ZERO           TO SQLCODE                       
                   MOVE WS-NO-REV-MONTH                                 
                                       TO P-ERROR-MESSAGE               
                   PERFORM 1300-PRINT-REPORT     THRU 1300-EXIT         
                   PERFORM 9000-TERMINATE        THRU 9000-EXIT         
                   STOP RUN                                             
               ELSE                                                     
                   DISPLAY '*****************************************'  
                   DISPLAY '**  0100-INITIALIZATION                **'  
                   DISPLAY '*****************************************'  
T21445             DISPLAY '* WS-RUN-DATE = ' WS-RUN-DATE               
                   PERFORM 9900-SQL-ERROR-ROUTINE                       
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
T26307     PERFORM 6253-GET-FJC01-CHKP-LIMIT     THRU 6253-EXIT.        
T26307     IF WS-CHKP-LUW-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS       
T26307       AND WS-CHKP-UPD-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS    
T26307         DISPLAY ' '                                              
T26307         DISPLAY '**   ' WS-PGRMNAME ' INFORMATIONAL MSG    **'   
T26307         DISPLAY '**   CHKP-LUW AND CHKP-UPD PARMS   **'          
T26307         DISPLAY '** BOTH SET TO ' WS-FLAG-TO-TURN-OFF-COMMITS    
T26307                 ', INTERPRETED TO**'                             
T26307         DISPLAY '**  INDICATE THAT INTERIM COMMIT   **'          
T26307         DISPLAY '**   POINTS SHOULD NOT BE TAKEN.   **'          
T26307         DISPLAY '** COMPLETE RERUN WILL BE REQUIRED **'          
T26307         DISPLAY '**  UPON UNSUCCESSFUL COMPLETION.  **'          
T26307         DISPLAY '**      PROCESSING CONTINUING      **'          
T26307     END-IF.                                                      
T26307     PERFORM 6254-GET-FJC01-STOP-KEY           THRU 6254-EXIT.    
T26307     MOVE WS-STOP-KEY TO WS-STOP-PARM-BREAKDOWN.                  
T26307     IF WS-STOP-PARM-ACCOUNT-NO NUMERIC                           
T26307         MOVE WS-STOP-PARM-ACCOUNT-NO TO WS-STOP-ACCOUNT-NO       
T26307     ELSE                                                         
T26307         MOVE 9999999999999           TO WS-STOP-ACCOUNT-NO       
T26307     END-IF.                                                      
      *                                                                         
A02474     PERFORM 7310-GET-CURR-DATE-PLUS1 THRU 7310-EXIT.             
AA2474     PERFORM 0200-GET-DRAFT-DAYS      THRU 0200-EXIT.             
A02474     PERFORM 7000-READ-CA44-FILE      THRU 7000-EXIT.             
A02474*                                                                         
       0100-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
AA2474*================================================================*        
AA2474 0200-GET-DRAFT-DAYS.                                             
AA2474*================================================================*        
AA2474*                                                                         
AA2474     INITIALIZE WS-DRAFT-TAB.                                     
AA2474     PERFORM 7320-OPEN-DRAFT-DAYS  THRU 7320-EXIT.                
AA2474     PERFORM 7330-FETCH-DRAFT-DAYS THRU 7330-EXIT.                
AA2474     PERFORM 7340-CLOSE-DRAFT-DAYS THRU 7340-EXIT.                
AA2474     IF WS-DRAFT-ROW-COUNT = 0                                    
AA2474        OR WS-DRAFT-ROW-COUNT > 20                                
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         DISPLAY '* 7320-OPEN-DRAFT-DAYS                   *'     
AA2474         DISPLAY '* DRAFT ARRAY EMPTY OR MORE THAN 20 ROWS *'     
AA2474         DISPLAY '* # ROWS IN ARRAY: ' WS-DRAFT-ROW-COUNT         
AA2474         DISPLAY '* PROGRAM ABORTING...                    *'     
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         PERFORM 9900-ABEND            THRU 9900-EXIT             
AA2474     END-IF.                                                      
AA2474     MOVE ZEROS TO       WS-PREV-DRAFT-DAYS                       
AA2474     PERFORM VARYING WS-DRAFT-SUB FROM 1 BY 1                     
AA2474               UNTIL WS-DRAFT-SUB > 20                            
AA2474        EVALUATE TRUE                                             
AA2474           WHEN WS-DRAFT-CYCLE (WS-DRAFT-SUB) = WS-DRAFT-SUB      
AA2474              IF WS-DRAFT-DAYS (WS-DRAFT-SUB) > 30                
AA2474                 IF WS-PREV-DRAFT-DAYS < 30                       
AA2474                    COMPUTE WS-DRAFT-DAYS (WS-DRAFT-SUB)          
AA2474                          = WS-PREV-DRAFT-DAYS + 1                
AA2474                 ELSE                                             
AA2474                   MOVE 1   TO WS-DRAFT-DAYS (WS-DRAFT-SUB)       
AA2474                 END-IF                                           
AA2474              END-IF                                              
ACT137           WHEN WS-DRAFT-CYCLE (WS-DRAFT-SUB) = SPACES            
ACT137              MOVE WS-DRAFT-SUB TO WS-DRAFT-CYCLE (WS-DRAFT-SUB)  
ACT137                                   WS-DRAFT-ROW-COUNT             
ACT137              IF WS-PREV-DRAFT-DAYS < 30                          
ACT137                  COMPUTE WS-DRAFT-DAYS (WS-DRAFT-SUB)            
ACT137                        = WS-PREV-DRAFT-DAYS + 1                  
ACT137               ELSE                                               
ACT137                  MOVE 1   TO WS-DRAFT-DAYS (WS-DRAFT-SUB)        
ACT137               END-IF                                             
AA2474           WHEN OTHER                                             
AA2474             DISPLAY '********** PCSBW121 ABORT ************'     
AA2474             DISPLAY '* 7320-OPEN-DRAFT-DAYS               *'     
AA2474             DISPLAY '* DRAFT ARRAY NOT IN PROPER ORDER    *'     
AA2474             DISPLAY '* FROM SUBSCRIPT # : ' WS-DRAFT-SUB         
AA2474             DISPLAY '* THE DRAFT ARRAY: ' WS-DRAFT-TAB           
AA2474             DISPLAY '********** PCSBW121 ABORT ************'     
AA2474             PERFORM 9900-ABEND            THRU 9900-EXIT         
AA2474        END-EVALUATE                                              
AA2474        MOVE WS-DRAFT-DAYS (WS-DRAFT-SUB) TO WS-PREV-DRAFT-DAYS   
AA2474     END-PERFORM.                                                 
AA2474*                                                                         
AA2474 0200-EXIT.                                                       
AA2474     EXIT.                                                        
AA2474*                                                                         
      ****************************************************************          
      **  1000-PROCESS                                              **          
      **      READS THE INPUT FILE, MOVES FIELDS TO WORKING STOR-   **          
      **      AGE, PERFORMS EDITS, PERFORMS UPDATES, AND PRINTS A   **          
      **      REPORT LINE.                                          **          
      ****************************************************************          
       1000-PROCESS.                                                    
      *                                                                         
P00599     INITIALIZE WS-CORRESP-VAR                                    
P00599                WS-CORRESP-HDR                                    
P00599                WS-CORRESP-NOTICE.                                
      *                                                                         
A02474     SET GOOD-CA44-REC           TO TRUE.                         
           ADD 1                       TO WS-REC-COUNT.                 
           MOVE SPACES                 TO P-DETAIL-LINE-1,              
                                          WS-FROM-CYCLE.                
           MOVE ZEROES                 TO MN-REGISTER-RD-SEQ            
                                          WS-MN-REGISTER-RD-SEQ         
                                          WS-FROM-ROUTE                 
           MOVE E-FCA44-ACCT-NO        TO AT-ACCOUNT-NO                 
A02474                                    UT-ACCOUNT-NO                 
A02474                                    MN-ACCOUNT-NO                 
A02474                                    WS-COMMIT-ACCT-NO             
A02474     MOVE E-FCA44-CODE-UTIL-TYPE TO UT-CODE-UTIL-TYPE             
A02474                                    MN-CODE-UTIL-TYPE.            
A02474     MOVE E-FCA44-IC-NO          TO UT-IC-NO                      
A02474                                    MN-IC-NO.                     
           MOVE E-FCA44-MTR-REF-NO     TO MN-MTR-REF-NO.                
           MOVE E-FCA44-READ-CYCLE     TO WS-TO-CYCLE,                  
                                          O2-READ-CYCLE.                
           MOVE E-FCA44-READ-ROUTE     TO WS-TO-ROUTE,                  
                                          O2-READ-ROUTE.                
           MOVE E-FCA44-REGISTER-RD-SEQ                                 
                                       TO WS-REG-RD-SEQ-HOLD            
                                          WS-MN-REGISTER-RD-SEQ         
           MOVE E-FCA44-LOCAL-OFFICE   TO WS-LOCAL-OFFICE,              
T23532                                    WS-LOCAL-OFFICE2,             
                                          O2-LOCAL-OFFICE.              
           MOVE E-FCA44-PREMISE-NO     TO WS-PREMISE-NO                 
C28610                                    CH-PREMISE-NO                 
A02474                                    UT-PREMISE-NO                 
A02474                                    AT-PREMISE-NO                 
T18480     MOVE E-FCA44-METER-NO       TO MN-METER-NO.                  
A02474*                                                                         
A02474     PERFORM 1100-VAL-LOC-OFF-CYC-RT THRU 1100-EXIT.              
A02474*                                                                         
A02474     IF GOOD-CA44-REC                                             
A02474        PERFORM 1200-VAL-PREMISE-DTL THRU 1200-EXIT               
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF GOOD-CA44-REC                                             
A02474        PERFORM 1400-GET-AT-UT-DTL   THRU 1400-EXIT               
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF GOOD-CA44-REC                                             
A02474        PERFORM 1500-VAL-FROM-CYCLES THRU 1500-EXIT               
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF READ-CYC-UPD-REQ AND GOOD-CA44-REC                        
A02474        PERFORM 1600-POST-INPUT-DATA THRU 1600-EXIT               
T26307        ADD 1 TO WS-CHKP-LUW-COUNTER                              
A02474     END-IF                                                       
A02474*                                                                         
A02474     PERFORM 1300-PRINT-REPORT         THRU 1300-EXIT.            
T26307     IF (WS-CHKP-LUW-COUNTER EQUAL WS-CHKP-LUW-LIMIT)             
T26307       OR (WS-CHKP-UPD-COUNTER  EQUAL WS-CHKP-UPD-LIMIT           
T26307       OR GREATER WS-CHKP-UPD-LIMIT)                              
T26307        PERFORM 8898-ISSUE-CHKP               THRU 8898-EXIT      
T26307     END-IF.                                                      
T26307*                                                                         
A02474     PERFORM 7000-READ-CA44-FILE      THRU 7000-EXIT.             
A02474*                                                                         
      *                                                                         
       1000-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1100-VAL-LOC-OFF-CYC-RT.                                         
A02474*================================================================*        
A02474*                                                                         
A02474***  THE 'TO' CYCLE FROM THE INPUT FILE MUST BE NUMERIC.                  
A02474*                                                                         
A02474     IF WS-TO-CYCLE NOT NUMERIC                                   
A02474         STRING WS-TO-ERROR,                                      
A02474                WS-TO-CYCLE                                       
A02474                DELIMITED BY SIZE                                 
A02474                               INTO P-ERROR-MESSAGE               
A02474         MOVE ZEROES             TO WS-TO-CYCLE                   
A02474         SET BAD-CA44-REC        TO TRUE                          
A02474         GO TO 1100-EXIT                                          
A02474     END-IF.                                                      
      *                                                                         
37054 ***  THE COMBINATION OF LOCAL OFFICE, ROUTE, AND CYCLE FROM               
37054 ***  THE INPUT FILE MUST BE VALID.                                        
      *                                                                         
A02474     PERFORM 7200-SELECT-LOC-OFF-CYC-RT THRU 7200-EXIT.           
      *                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
37054         MOVE WS-TO-BAD-COMBO TO P-ERROR-MESSAGE                   
A02474        SET BAD-CA44-REC        TO TRUE                           
37054      END-IF.                                                      
A02474*                                                                         
      *                                                                         
       1100-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1200-VAL-PREMISE-DTL.                                            
A02474*================================================================*        
A02474*                                                                         
A02474     PERFORM 7210-GET-PREMISE-LOF THRU 7210-EXIT.                 
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A02474        IF WS-LOCAL-OFFICE2 NOT = O2-LOCAL-OFFICE                 
A02474           PERFORM 8150-UPDATE-CSS-PREMISE THRU 8150-EXIT         
A02474        END-IF                                                    
A02474     ELSE                                                         
A02474        MOVE WS-PR-ERROR        TO P-ERROR-MESSAGE                
A02474        SET BAD-CA44-REC        TO TRUE                           
A02474        GO TO 1200-EXIT                                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474***  GET LATEST ACCOUNT ON THE PREMISE USING CPDCA099 COPYBOOK.           
A02474*                                                                         
A02474     MOVE WS-PREMISE-NO              TO WS-CPD99-PREMISE-NO       
A02474                                        HT-PREMISE-NO.            
A02474     PERFORM 6990-FETCH-CUR-ACCOUNT  THRU 6990-EXIT.              
A02474*                                                                         
A02474     IF WS-CPD99-ACCOUNT-NO NOT = AT-ACCOUNT-NO                   
A02474        DISPLAY '*********************************************'   
A02474        DISPLAY 'LATEST ACCOUNT  FOUND:'                          
A02474        DISPLAY 'NEW ACCOUNT: ' WS-CPD99-ACCOUNT-NO               
A02474        DISPLAY 'OLD ACCOUNT: ' AT-ACCOUNT-NO                     
A02474        DISPLAY '*********************************************'   
A02474        MOVE WS-CPD99-ACCOUNT-NO        TO AT-ACCOUNT-NO          
A02474                                           UT-ACCOUNT-NO          
A02474                                           MN-ACCOUNT-NO          
A02474     END-IF.                                                      
A02474*                                                                         
A02474 1200-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
      ****************************************************************          
      **                                                            **          
      **  1300-PRINT-REPORT                                         **          
      **      PRINT REPORT DETAIL LINES (REGULAR AND ERROR)         **          
      **                                                            **          
      ****************************************************************          
       1300-PRINT-REPORT.                                               
      *                                                                         
           MOVE AT-ACCOUNT-NO          TO P-ACCOUNT-NO.                 
           MOVE MN-CODE-UTIL-TYPE      TO P-CODE-UTIL-TYPE.             
           MOVE WS-LOCAL-OFFICE        TO P-LOCAL-OFFICE.               
           MOVE WS-FROM-CYCLE          TO P-FROM-CYCLE.                 
           MOVE WS-FROM-ROUTE          TO P-FROM-ROUTE.                 
A02474     MOVE WS-MN-REGISTER-RD-SEQ  TO P-REGISTER-RD-SEQ.            
           MOVE WS-TO-CYCLE            TO P-TO-CYCLE.                   
           MOVE WS-TO-ROUTE            TO P-TO-ROUTE.                   
           MOVE WS-REG-RD-SEQ-HOLD     TO P-REG-RD-SEQ-HOLD.            
      *                                                                         
           IF WS-LINE-COUNT > 56                                        
               PERFORM 1320-PRINT-HEADING        THRU 1320-EXIT         
           END-IF.                                                      
      *                                                                         
           WRITE PRT32-RECORD FROM P-DETAIL-LINE-1                      
                AFTER ADVANCING 2 LINES.                                
      *                                                                         
           ADD 2                       TO WS-LINE-COUNT.                
           MOVE SPACES                 TO P-DETAIL-LINE-1.              
      *                                                                         
       1300-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ****************************************************************          
      **                                                            **          
      **  1320-PRINT-HEADING                                        **          
      **                                                            **          
      ****************************************************************          
       1320-PRINT-HEADING.                                              
      *                                                                         
           ADD 1                       TO WS-PAGE-COUNT.                
           MOVE WS-PAGE-COUNT          TO P-PAGE-NO.                    
      *                                                                         
           WRITE PRT32-RECORD FROM P-HEADER-LINE-1                      
                AFTER ADVANCING TOP-OF-PAGE.                            
           WRITE PRT32-RECORD FROM P-HEADER-LINE-2                      
                AFTER ADVANCING 1 LINE.                                 
           WRITE PRT32-RECORD FROM P-HEADER-LINE-2A                     
                AFTER ADVANCING 1 LINE.                                 
           WRITE PRT32-RECORD FROM P-HEADER-LINE-3                      
                AFTER ADVANCING 2 LINES.                                
           WRITE PRT32-RECORD FROM P-HEADER-LINE-4                      
                AFTER ADVANCING 1 LINE.                                 
      *                                                                         
           MOVE 6                      TO WS-LINE-COUNT.                
      *                                                                         
       1320-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1400-GET-AT-UT-DTL.                                              
A02474*================================================================*        
A02474*                                                                         
A02474     PERFORM 7010-SELECT-AT-FROM-DATA      THRU 7010-EXIT.        
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A02474        MOVE AT-BILL-CYCLE       TO WS-AT-BILL-CYCLE              
A02474     ELSE                                                         
A02474        MOVE WS-AT-ERROR         TO P-ERROR-MESSAGE               
A02474        SET BAD-CA44-REC        TO TRUE                           
A02474        GO TO 1400-EXIT                                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474***  GET THE MIN & MAX READ CYCLES ASSOCIATED WITH ACTIVE METERS.         
A02474*                                                                         
A02474     MOVE '00'                     TO WS-MIN-READ-CYCLE           
A02474                                      WS-MAX-READ-CYCLE           
A02474     MOVE ZEROS                    TO WS-MIN-READ-ROUTE           
A02474                                      WS-MAX-READ-ROUTE           
A02474     PERFORM 7050-SELECT-MTR-CYCLES        THRU 7050-EXIT.        
A02474     IF WS-MAX-READ-CYCLE = '00'                                  
A02474***  NO DATA AVAILABLE IN UT & MN                                         
A02474        MOVE WS-MN-ERROR        TO P-ERROR-MESSAGE                
A02474        SET BAD-CA44-REC        TO TRUE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 1400-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1500-VAL-FROM-CYCLES.                                            
A02474*================================================================*        
A02474*                                                                         
A02474     SET BILL-CYC-UPD-REQ          TO TRUE                        
A02474     SET READ-CYC-UPD-REQ          TO TRUE                        
A02474***  THE 'FROM' CYCLE (MIN & MAX FROM UT TABLE) MUST BE NUMERIC.          
A02474*                                                                         
A02474     IF WS-MIN-READ-CYCLE NOT NUMERIC                             
A02474        OR WS-MAX-READ-CYCLE NOT NUMERIC                          
A02474         STRING WS-FROM-ERROR,                                    
A02474                WS-MIN-READ-CYCLE,                                
A02474                WS-MAX-READ-CYCLE,                                
A02474                DELIMITED BY SIZE                                 
A02474                               INTO P-ERROR-MESSAGE               
A02474         SET READ-CYC-UPD-NOT-REQ TO TRUE                         
A02474         GO TO 1500-EXIT                                          
A02474     END-IF.                                                      
A02474***  IN NORMAL CASES WS-MIN-READ-CYCLE AND WS-MAX-READ-CYCLE              
A02474***  SHOULD HAVE SAME VALUE AND THAT VALUE SHOULD MATCH                   
A02474***  AT-BILL-CYCLE. IF THESE VALUES NOT SAME THEN WQ                      
A02474***  IF ABOVE CYCLES ARE NOT SAME THEN                                    
A02474***   (1) CYCLE MISMATCH WQ WILL BE GENERATED AS PER LISA.M               
A02474***   (2) NO BILL-CYCLE UPDATED AND NO DRAFT CYCLE PROCESS.               
A02474***   (3) READ-CYCLE WILL BE UPDATED WITH 'TO' CYCLE RECEIVED             
A02474***       FROM FILE  AFTER VALIDATIONS.                                   
A02474***  IF ABOVE CYCLES ARE SAME THEN                                        
A02474***   (1) BILL-CYCLE AND READ-CYCLE WILL BE UPDATED WITH                  
A02474***       'TO' CYCLE RECEIVED FROM FILE AFTER VALIDATIONS.                
A02474***   (2) DRAFT CYCLE PROCESS WILL BE EXECUTED.                           
A02474*                                                                         
A02474     IF WS-MAX-READ-CYCLE = WS-TO-CYCLE                           
A02474        MOVE WS-MIN-READ-CYCLE        TO UT-READ-CYCLE            
A02474                                         WS-FROM-CYCLE            
A02474     ELSE                                                         
A02474        MOVE WS-MAX-READ-CYCLE        TO UT-READ-CYCLE            
A02474                                         WS-FROM-CYCLE            
A02474     END-IF.                                                      
A02474     IF WS-MAX-READ-ROUTE =  WS-TO-ROUTE                          
A02474        MOVE WS-MIN-READ-ROUTE        TO UT-READ-ROUTE            
A02474                                         WS-FROM-ROUTE            
A02474     ELSE                                                         
A02474        MOVE WS-MAX-READ-ROUTE        TO UT-READ-ROUTE            
A02474                                         WS-FROM-ROUTE            
A02474     END-IF.                                                      
A02474     IF (WS-MIN-READ-CYCLE NOT = WS-MAX-READ-CYCLE                
A02474        OR WS-AT-BILL-CYCLE  NOT = WS-MAX-READ-CYCLE)             
AA2474        AND AT-CODE-ACCT-STAT = 'A'                               
A02474***     CYCLES ARE NOT SAME                                               
A02474        SET BILL-CYC-UPD-NOT-REQ          TO TRUE                 
A02474        IF WS-AT-BILL-CYCLE NOT = WS-TO-CYCLE                     
A02474***     CREATE WQ ONLY 'FROM' OR 'TO' CYCLES NOT SAME AS BILL-CYC         
C37381           PERFORM 1550-CYC-DIFF-WQ       THRU 1550-EXIT          
A02474        END-IF                                                    
A02474     END-IF.                                                      
A02474     IF WS-AT-BILL-CYCLE = WS-TO-CYCLE                            
A02474***     NO NEED TO CHANGE BILL CYCLE                                      
A02474        SET BILL-CYC-UPD-NOT-REQ          TO TRUE                 
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF WS-FROM-CYCLE  = WS-TO-CYCLE                              
A02474        SET BILL-CYC-UPD-NOT-REQ          TO TRUE                 
A02474     ELSE                                                         
A02474        PERFORM 1520-VALIDATE-READ-CYCLE THRU 1520-EXIT           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 1500-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1520-VALIDATE-READ-CYCLE.                                        
A02474*================================================================*        
A02474*                                                                         
T18480***  THE DIFFERENCE BETWEEN THE 'FROM' AND 'TO' CYCLES CANNOT             
T18480***  EXCEED 5.                                                            
T18480*                                                                         
T18480     IF  WS-FROM-CYCLE-R <= WS-TO-CYCLE-R                         
T18480         IF  ( WS-TO-CYCLE-R - WS-FROM-CYCLE-R ) > 5              
T18480             MOVE WS-CYCLE-DIFF-ERROR                             
T18480                                 TO P-ERROR-MESSAGE               
T18480             SET READ-CYC-UPD-NOT-REQ TO TRUE                     
T18480         END-IF                                                   
T18480     ELSE                                                         
T21498         IF  ( WS-FROM-CYCLE-R - WS-TO-CYCLE-R ) > 5              
T18480             MOVE WS-CYCLE-DIFF-ERROR                             
T18480                                 TO P-ERROR-MESSAGE               
A02474             SET READ-CYC-UPD-NOT-REQ TO TRUE                     
T18480         END-IF                                                   
T18480     END-IF.                                                      
T18480*                                                                         
T18480***  NEITHER 'FROM' NOR 'TO' BILL WINDOWS CAN BE OPEN.  BILLED            
T18480***  CYCLE CANNOT CHANGE TO UNBILLED (AND VICE-VERSA).                    
T18480*                                                                         
A02474     IF READ-CYC-UPD-REQ                                          
T18480        PERFORM 1530-VALIDATE-CYCLE-CHG   THRU 1530-EXIT          
T18480     END-IF.                                                      
A02474*                                                                         
A02474 1520-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1530-VALIDATE-CYCLE-CHG.                                         
A02474*================================================================*        
      **      IF RUN DATE IS BETWEEN METER READ DATE (FROM THE READ **          
      **      WINDOW TABLE) AND NEXT BILL DATE (FROM THE BILL WIN-  **          
      **      DOW TABLE), INCLUSIVE, THE BILL WINDOW IS OPEN.  IN   **          
      **      THIS CASE, CYCLE CANNOT BE CHANGED.  ALSO, A BILLED   **          
      **      CYCLE CANNOT BE CHANGED TO UNBILLED (AND VICE-VERSA). **          
      *                                                                         
           MOVE WS-REVENUE-MONTH       TO BN-REVENUE-MONTH.             
           MOVE WS-FROM-CYCLE          TO BN-BILL-CYCLE.                
           PERFORM 7300-GET-BILL-WINDOW          THRU 7300-EXIT.        
      *                                                                         
           IF BILL-CYCLE-NOT-FOUND                                      
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           MOVE BN-DATE-EXTRACT        TO WS-FROM-DATE-NEXT-BILL.       
      *                                                                         
           MOVE WS-FROM-CYCLE          TO RW-READ-CYCLE.                
           MOVE WS-REVENUE-MONTH       TO RW-REVENUE-MONTH.             
           PERFORM 7400-GET-READ-WINDOW          THRU 7400-EXIT.        
      *                                                                         
           IF READ-CYCLE-NOT-FOUND                                      
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           MOVE RW-DATE-MTR-RD-XTRCT   TO WS-FROM-DATE-MTR-READ.        
      *                                                                         
           IF (WS-FROM-DATE-MTR-READ = WS-INPUT-RUN-DATE  OR            
               WS-FROM-DATE-MTR-READ < WS-INPUT-RUN-DATE) AND           
              (WS-FROM-DATE-NEXT-BILL = WS-INPUT-RUN-DATE OR            
               WS-FROM-DATE-NEXT-BILL > WS-INPUT-RUN-DATE)              
A02474         SET READ-CYC-UPD-NOT-REQ TO TRUE                         
               MOVE WS-FROM-CYCLE-OPEN TO P-ERROR-MESSAGE               
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           MOVE WS-REVENUE-MONTH       TO BN-REVENUE-MONTH.             
           MOVE WS-TO-CYCLE            TO BN-BILL-CYCLE.                
      *                                                                         
           PERFORM 7300-GET-BILL-WINDOW          THRU 7300-EXIT.        
           IF BILL-CYCLE-NOT-FOUND                                      
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           MOVE BN-DATE-EXTRACT        TO WS-TO-DATE-NEXT-BILL.         
      *                                                                         
           MOVE WS-TO-CYCLE            TO RW-READ-CYCLE.                
           MOVE WS-REVENUE-MONTH       TO RW-REVENUE-MONTH.             
           PERFORM 7400-GET-READ-WINDOW          THRU 7400-EXIT.        
      *                                                                         
           IF READ-CYCLE-NOT-FOUND                                      
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           MOVE RW-DATE-MTR-RD-XTRCT   TO WS-TO-DATE-MTR-READ.          
      *                                                                         
           IF (WS-TO-DATE-MTR-READ  = WS-INPUT-RUN-DATE  OR             
               WS-TO-DATE-MTR-READ  < WS-INPUT-RUN-DATE) AND            
              (WS-TO-DATE-NEXT-BILL = WS-INPUT-RUN-DATE  OR             
               WS-TO-DATE-NEXT-BILL > WS-INPUT-RUN-DATE)                
A02474         SET READ-CYC-UPD-NOT-REQ TO TRUE                         
               MOVE WS-TO-CYCLE-OPEN   TO P-ERROR-MESSAGE               
               GO                      TO 1530-EXIT                     
           END-IF.                                                      
      *                                                                         
           IF WS-FROM-CYCLE > WS-TO-CYCLE                               
               IF WS-FROM-DATE-NEXT-BILL < WS-TO-DATE-NEXT-BILL         
A02474             SET READ-CYC-UPD-NOT-REQ TO TRUE                     
                   MOVE WS-TO-CYCLE-BILLED                              
                                       TO P-ERROR-MESSAGE               
                   GO                  TO 1530-EXIT                     
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
           IF WS-FROM-CYCLE < WS-TO-CYCLE                               
               IF WS-FROM-DATE-NEXT-BILL > WS-TO-DATE-NEXT-BILL         
A02474             SET READ-CYC-UPD-NOT-REQ TO TRUE                     
                   MOVE WS-FROM-CYCLE-BILLED                            
                                       TO P-ERROR-MESSAGE               
                   GO                  TO 1530-EXIT                     
               END-IF                                                   
           END-IF.                                                      
      *                                                                         
       1530-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1550-CYC-DIFF-WQ.                                                
A02474*================================================================*        
A02474*                                                                         
A04860     INITIALIZE CWS00077-FIELDS.                                  
A04860     MOVE 504                    TO WS-77-CATEGORY-ID             
A02474     MOVE WS-AT-BILL-CYCLE       TO WS-CYC-DIFF-BCYC-NO           
A02474     MOVE UT-READ-CYCLE          TO WS-CYC-DIFF-FRCYC-NO          
A02474     MOVE WS-TO-CYCLE            TO WS-CYC-DIFF-TRCYC-NO          
A02474***  EXISTING BILL CYC CHANGE REASON                                      
A02474     EVALUATE TRUE                                                
A02474        WHEN AT-BILL-CYCLE-CHG-CD = 'F'                           
A02474             SET FIA-ACCOUNT      TO TRUE                         
A02474        WHEN AT-BILL-CYCLE-CHG-CD = 'N'                           
A02474             SET NON-UTILITY-ACC  TO TRUE                         
A02474        WHEN AT-BILL-CYCLE-CHG-CD = 'B'                           
A02474             SET BANK-DRAFT-ACC   TO TRUE                         
A02474        WHEN AT-BILL-CYCLE-CHG-CD = 'R'                           
A02474             SET READ-DATE-ACC    TO TRUE                         
A02474        WHEN AT-BILL-CYCLE-CHG-CD = 'M'                           
A02474             SET SETUP-MASTER-ACC TO TRUE                         
A02474        WHEN AT-BILL-CYCLE-CHG-CD = ' '                           
A02474             SET NO-CHNG-REASON   TO TRUE                         
A02474        WHEN OTHER                                                
A02474             SET UN-AVAILABLE     TO TRUE                         
A02474     END-EVALUATE                                                 
A04860     MOVE WS-CYC-DIFF-COMMENTS   TO WS-77-COMMENTS-TEXT           
C37381     PERFORM 2150-FORMAT-WORK-QUEUE THRU 2150-EXIT.               
A02474*                                                                         
A02474 1550-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1600-POST-INPUT-DATA.                                            
A02474*================================================================*        
A02474*                                                                         
A02474     PERFORM 1610-SETUP-TRANS-HIST  THRU 1610-EXIT.               
A02474*                                                                         
A02474     PERFORM 8200-UPDATE-UTIL-ENVRNMT  THRU 8200-EXIT             
A02474     PERFORM 7150-OPEN-MN-CURSOR  THRU 7150-EXIT.                 
A02474     PERFORM 7160-FETCH-MN-CURSOR   THRU 7160-EXIT.               
A02474     PERFORM UNTIL WS-ACTIVE-RETURN-CODE EQUAL NOT-FOUND          
A02474        IF MN-REGISTER-RD-SEQ NOT = WS-REG-RD-SEQ-HOLD            
A02474           IF AT-ACCOUNT-NO = MN-ACCOUNT-NO                       
A02474              MOVE MN-REGISTER-RD-SEQ TO WS-MN-REGISTER-RD-SEQ    
A02474           END-IF                                                 
A02474           PERFORM 8300-UPDATE-MTRD-ENVRNMT THRU 8300-EXIT        
A02474           IF MN-CODE-DATA-PRESENT > SPACES                       
A02474              MOVE MN-ACCOUNT-NO     TO RG-ACCOUNT-NO             
A02474              MOVE MN-CODE-UTIL-TYPE TO RG-CODE-UTIL-TYPE         
A02474              MOVE MN-IC-NO          TO RG-IC-NO                  
A02474              MOVE MN-MTR-REF-NO     TO RG-MTR-REF-NO             
A02474              PERFORM 8305-UPDATE-REGISTER-READ THRU 8305-EXIT    
A02474           END-IF                                                 
A02474        END-IF                                                    
A02474        PERFORM 7160-FETCH-MN-CURSOR   THRU 7160-EXIT             
A02474     END-PERFORM.                                                 
A02474     PERFORM 7170-CLOSE-MN-CURSOR   THRU 7170-EXIT.               
A02474*                                                                         
A02474     IF (WS-FROM-CYCLE      NOT EQUAL WS-TO-CYCLE)        OR      
A02474        (WS-FROM-ROUTE      NOT EQUAL WS-TO-ROUTE)        OR      
A02474        (WS-MN-REGISTER-RD-SEQ NOT EQUAL WS-REG-RD-SEQ-HOLD) OR   
A02474        (WS-LOCAL-OFFICE2   NOT EQUAL O2-LOCAL-OFFICE)            
A02474          PERFORM 1650-JOURNAL-CHANGES     THRU 1650-EXIT         
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF BILL-CYC-UPD-REQ                                          
A02474        PERFORM 2000-PROCESS-BILL-CYC  THRU 2000-EXIT             
A02474     END-IF.                                                      
A02474*                                                                         
A02474 1600-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1610-SETUP-TRANS-HIST.                                           
A02474*================================================================*        
A02474*                                                                         
A02474     MOVE 'F'                    TO MH-CODE-TRAN-TYPE.            
A02474     MOVE SPACES                 TO MH-RESP-AREA-ID.              
A02474     MOVE AT-ACCOUNT-NO          TO MH-ACCOUNT-NO.                
A02474     MOVE ZEROS                  TO MH-CUSTOMER-NO.               
A02474     MOVE WS-PREMISE-NO          TO MH-PREMISE-NO.                
A02474     MOVE 'SYSTEM'               TO MH-USER-ID.                   
A02474     MOVE 'PCSBW121 '            TO MH-APPL-PROGRAM-ID.           
A02474     MOVE +38                    TO MH-TRAN-COMMENT-LEN.          
A02474     MOVE WS-RESEQ-DESC          TO MH-TRAN-COMMENT-TEXT.         
A02474*                                                                         
AA2474     MOVE SPACES                 TO MH-TRANS-HIST-SEQ-NO          
AA2474                                    MH-DATE-TRANS                 
AA2474                                    MI-TRANS-HIST-SEQ-NO.         
A02474     MOVE ZEROS                  TO MI-TRAN-APPL-NO.              
A02474*                                                                         
A02474 1610-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 1650-JOURNAL-CHANGES.                                            
A02474*================================================================*        
A02474**      FORMAT AND INSERT THE JOURNAL RECORDS                 **          
A02474*                                                                         
           MOVE WS-FROM-CYCLE          TO WS-JRNL-OLD-CYCLE.            
           MOVE WS-FROM-ROUTE          TO WS-JRNL-OLD-ROUTE.            
           MOVE WS-MN-REGISTER-RD-SEQ  TO WS-JRNL-OLD-SEQ.              
C28610     MOVE WS-LOCAL-OFFICE2       TO WS-JRNL-OLD-LOC-OFF.          
           MOVE WS-TO-CYCLE            TO WS-JRNL-NEW-CYCLE.            
           MOVE WS-TO-ROUTE            TO WS-JRNL-NEW-ROUTE.            
           MOVE WS-REG-RD-SEQ-HOLD     TO WS-JRNL-NEW-SEQ.              
C28610     MOVE O2-LOCAL-OFFICE        TO WS-JRNL-NEW-LOC-OFF.          
      *                                                                         
A02474     COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1                
A02474     MOVE MH-TRANS-HIST-SEQ-NO   TO MI-TRANS-HIST-SEQ-NO.         
           MOVE WS-RESEQ-DESC-SHORT    TO MI-COLUMN-DESC.               
C37381     MOVE SPACES                 TO MI-TABLE-ID.                  
5212       MOVE +27                    TO MI-PRV-COLUMN-VALUE-LEN.      
           MOVE WS-OLD-METER-DATA      TO MI-PRV-COLUMN-VALUE-TEXT.     
5212       MOVE +27                    TO MI-CHG-COLUMN-VALUE-LEN.      
           MOVE WS-NEW-METER-DATA      TO MI-CHG-COLUMN-VALUE-TEXT.     
      *                                                                         
           PERFORM 6530-LOAD-MNT-TRANS-HIST      THRU 6530-EXIT.        
A02474*                                                                         
A02474 1650-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*                                                                         
A02474*================================================================*        
A02474 2000-PROCESS-BILL-CYC.                                           
A02474*================================================================*        
A02474*                                                                         
A02474     MOVE SPACES                 TO WS-OLD-CODE-LPC-XMT           
A02474                                    WS-NEW-CODE-LPC-XMT           
A02474                                    WS-OLD-CODE-DISC-OK           
A02474                                    WS-NEW-CODE-DISC-OK           
A02474*                                                                         
A02474     MOVE WS-TO-CYCLE            TO AT-BILL-CYCLE                 
A02474*                                                                         
A02474     IF WS-AT-BILL-CYCLE  NOT =  WS-TO-CYCLE                      
A02474        COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1             
A02474        MOVE MH-TRANS-HIST-SEQ-NO TO MI-TRANS-HIST-SEQ-NO         
A02474        MOVE 'BILL CYCLE'         TO MI-COLUMN-DESC               
A02474        MOVE '  '                 TO MI-TABLE-ID                  
A02474        MOVE +2                   TO MI-PRV-COLUMN-VALUE-LEN      
A02474        MOVE WS-AT-BILL-CYCLE     TO MI-PRV-COLUMN-VALUE-TEXT     
A02474        MOVE +2                   TO MI-CHG-COLUMN-VALUE-LEN      
A02474        MOVE WS-TO-CYCLE          TO MI-CHG-COLUMN-VALUE-TEXT     
A02474        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
A02474     END-IF.                                                      
A02474     IF WS-AT-BILL-CYCLE  > WS-TO-CYCLE AND                       
A02474        AT-CODE-LPC-XMT = SPACES                                  
A02474         COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1            
A02474         MOVE AT-CODE-LPC-XMT TO WS-OLD-CODE-LPC-XMT              
A02474         MOVE WS-1            TO AT-CODE-LPC-XMT                  
A02474                                 WS-NEW-CODE-LPC-XMT              
A02474         MOVE MH-TRANS-HIST-SEQ-NO TO MI-TRANS-HIST-SEQ-NO        
A02474         MOVE WS-CODE-LPC-XMT      TO MI-COLUMN-DESC              
A02474         MOVE '11'                 TO MI-TABLE-ID                 
A02474         MOVE +1                   TO MI-PRV-COLUMN-VALUE-LEN     
A02474         MOVE WS-OLD-CODE-LPC-XMT  TO MI-PRV-COLUMN-VALUE-TEXT    
A02474         MOVE +1                   TO MI-CHG-COLUMN-VALUE-LEN     
A02474         MOVE WS-NEW-CODE-LPC-XMT  TO MI-CHG-COLUMN-VALUE-TEXT    
A02474         PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT          
A02474     END-IF.                                                      
A02474     IF AT-CODE-DISC-OK = SPACES                                  
A02474        AND AT-CODE-ACCT-STAT = 'A'                               
A02474        COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1             
A02474        MOVE AT-CODE-DISC-OK TO WS-OLD-CODE-DISC-OK               
A02474        MOVE WS-1            TO AT-CODE-DISC-OK                   
A02474                                WS-NEW-CODE-DISC-OK               
A02474        MOVE MH-TRANS-HIST-SEQ-NO TO MI-TRANS-HIST-SEQ-NO         
A02474        MOVE WS-CODE-DISC-OK      TO MI-COLUMN-DESC               
A02474        MOVE '12'                 TO MI-TABLE-ID                  
A02474        MOVE +1 TO MI-PRV-COLUMN-VALUE-LEN                        
A02474        MOVE WS-OLD-CODE-DISC-OK  TO MI-PRV-COLUMN-VALUE-TEXT     
A02474        MOVE +1 TO MI-CHG-COLUMN-VALUE-LEN                        
T11698        MOVE WS-NEW-CODE-DISC-OK  TO MI-CHG-COLUMN-VALUE-TEXT     
A02474        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
A02474     END-IF.                                                      
A02474     PERFORM 8100-UPDATE-BILL-CYC      THRU 8100-EXIT             
A02474     IF WS-OLD-CODE-LPC-XMT     = WS-NEW-CODE-LPC-XMT             
A02474        AND WS-OLD-CODE-DISC-OK = WS-NEW-CODE-DISC-OK             
A02474        CONTINUE                                                  
A02474     ELSE                                                         
A02474        PERFORM 8110-UPDATE-LPC-DISC-OK   THRU 8110-EXIT          
A02474     END-IF.                                                      
A02474     MOVE WS-REROUTE         TO BG-PRORATE-CD                     
A02474     MOVE AT-ACCOUNT-NO      TO BG-ACCOUNT-NO                     
A02474     PERFORM 8500-UPDATE-BILLDET    THRU 8500-EXIT                
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A02474        ADD 1                     TO WS-CHKP-UPD-COUNTER          
A02474        ADD 1                     TO WS-BG-UPDT-CNTR-LUW          
A02474        COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1             
A02474        MOVE SPACES               TO WS-OLD-PRORATE-CD            
A02474        MOVE BG-PRORATE-CD        TO WS-NEW-PRORATE-CD            
A02474        MOVE MH-TRANS-HIST-SEQ-NO TO MI-TRANS-HIST-SEQ-NO         
A02474        MOVE WS-PRORATE-CODE      TO MI-COLUMN-DESC               
A02474        MOVE SPACES               TO MI-TABLE-ID                  
A02474        MOVE +1                   TO MI-PRV-COLUMN-VALUE-LEN      
A02474        MOVE WS-OLD-PRORATE-CD    TO MI-PRV-COLUMN-VALUE-TEXT     
A02474        MOVE +1                   TO MI-CHG-COLUMN-VALUE-LEN      
A02474        MOVE WS-NEW-PRORATE-CD    TO MI-CHG-COLUMN-VALUE-TEXT     
A02474        PERFORM 6530-LOAD-MNT-TRANS-HIST THRU 6530-EXIT           
A02474     END-IF.                                                      
A02474*                                                                         
A02474     IF AT-CODE-ACCT-STAT = 'A'                                   
A02474        MOVE AT-ACCOUNT-NO           TO BE-ACCOUNT-NO             
A02474        PERFORM 7220-SELECT-BANK-EFT THRU 7220-EXIT               
A02474*                                                                         
A02474        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                
A02474           PERFORM 2100-EDIT-DRAFT-CYCLE THRU 2100-EXIT           
A02474        END-IF                                                    
A02474     END-IF.                                                      
A02474 2000-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*                                                                         
      ****************************************************************          
      **                                                            **          
      **  2100-EDIT-DRAFT-CYCLE                                     **          
      **                                                            **          
      ****************************************************************          
DC     2100-EDIT-DRAFT-CYCLE.                                           
DC    *                                                                         
AA2474     MOVE BE-DRAFT-CYCLE         TO WS-OLD-DRAFT-CYCLE            
AA2474                                    WS-NEW-DRAFT-CYCLE.           
      *                                                                         
AA2474     IF WS-TO-CYCLE =  WS-PREV-TO-CYCLE                           
AA2474        CONTINUE                                                  
AA2474     ELSE                                                         
AA2474        MOVE WS-TO-CYCLE         TO WS-PREV-TO-CYCLE              
C37381        MOVE ZEROS               TO WS-TO-CYCLE-PLUS5             
C37381                                    WS-TO-CYCLE-MINUS5            
AA2474        INITIALIZE  WS-DFT-MATCH-TAB                              
C37381*                                                                         
C37381        COMPUTE WS-TO-CYCLE-PLUS5  = WS-TO-CYCLE-R + 5            
C37381        IF WS-TO-CYCLE-PLUS5  > 20                                
C37381           COMPUTE WS-TO-CYCLE-PLUS5 = WS-TO-CYCLE-PLUS5 - 20     
C37381        END-IF                                                    
C37381        IF WS-TO-CYCLE-R > 5                                      
C37381           COMPUTE WS-TO-CYCLE-MINUS5 = WS-TO-CYCLE-R - 5         
C37381        ELSE                                                      
C37381           COMPUTE WS-TO-CYCLE-MINUS5 = WS-TO-CYCLE-R + 15        
C37381        END-IF                                                    
C37381                                                                  
AA2474        MOVE WS-TO-CYCLE-MINUS5  TO WS-TO-CYCLE-MINUS1            
AA2474                                                                  
AA2474        PERFORM VARYING WS-DFT-SUB FROM 1 BY 1                    
AA2474                UNTIL WS-DFT-SUB > 9                              
AA2474           COMPUTE WS-TO-CYCLE-MINUS1 = WS-TO-CYCLE-MINUS1 + 1    
AA2474           IF WS-TO-CYCLE-MINUS1 > 20                             
AA2474              MOVE 01      TO WS-TO-CYCLE-MINUS1                  
AA2474           END-IF                                                 
AA2474           MOVE WS-TO-CYCLE-MINUS1  TO                            
AA2474                             WS-TAB-TO-CYCLE (WS-DFT-SUB)         
AA2474        END-PERFORM                                               
AA2474     END-IF.                                                      
AA2474*                                                                         
AA2474     SET DRAFT-CHNG-NOT-REQ   TO TRUE                             
AA2474     EVALUATE TRUE                                                
AA2474        WHEN  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (1)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (2)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (3)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (4)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (5)                
AA2474              SET DRAFT-CHNG-REQ TO TRUE                          
AA2474              MOVE WS-TO-CYCLE-MINUS5  TO WS-NEW-DRAFT-CYCLE      
AA2474        WHEN  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (6)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (7)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (8)                
AA2474          OR  BE-DRAFT-CYCLE = WS-TAB-TO-CYCLE (9)                
AA2474              SET DRAFT-CHNG-REQ TO TRUE                          
AA2474              MOVE WS-TO-CYCLE-PLUS5  TO WS-NEW-DRAFT-CYCLE       
AA2474        WHEN  OTHER CONTINUE                                      
AA2474     END-EVALUATE.                                                
AA2474*                                                                         
AA2474     IF DRAFT-CHNG-REQ                                            
C37381        AND WS-NEW-DRAFT-CYCLE NOT = WS-OLD-DRAFT-CYCLE           
A03792        IF AUTO-DRAFT-UPD-REQ                                     
C37381           PERFORM 2200-PRODUCE-LETTER THRU 2200-EXIT             
A02474***        WRITE TRANS HIST FOR DRAFT CYC CHANGE.                         
A02474           COMPUTE MI-TRAN-APPL-NO = MI-TRAN-APPL-NO + 1          
A02474           MOVE MH-TRANS-HIST-SEQ-NO TO MI-TRANS-HIST-SEQ-NO      
C37381           MOVE 'DRAFT CYCLE'        TO MI-COLUMN-DESC            
C37381           MOVE SPACES               TO MI-TABLE-ID               
C37381           MOVE +2                   TO MI-CHG-COLUMN-VALUE-LEN   
C37381           MOVE WS-NEW-DRAFT-CYCLE   TO MI-CHG-COLUMN-VALUE-TEXT  
C37381           MOVE +2                   TO MI-PRV-COLUMN-VALUE-LEN   
C37381           MOVE WS-OLD-DRAFT-CYCLE   TO MI-PRV-COLUMN-VALUE-TEXT  
C37381           PERFORM 6530-LOAD-MNT-TRANS-HIST  THRU 6530-EXIT       
A03792        ELSE                                                      
A03792           MOVE AT-ACCOUNT-NO        TO E-FCA47-ACCOUNT-NO        
A03792           MOVE WS-AT-BILL-CYCLE     TO E-FCA47-OLD-BILL-CYCLE    
A03792           MOVE WS-TO-CYCLE          TO E-FCA47-NEW-BILL-CYCLE    
A03792           MOVE WS-OLD-DRAFT-CYCLE   TO E-FCA47-CUR-DRAFT-CYCLE   
A03792           MOVE FIOCA47-DATA-RECORD  TO FIOCA47-RECORD            
A03792           PERFORM 8950-WRITE-FCSCA47   THRU 8950-EXIT            
A03792        END-IF                                                    
C37381     END-IF.                                                      
A02474*                                                                         
A02474 2100-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 2150-FORMAT-WORK-QUEUE.                                          
A02474*================================================================*        
A02474*                                                                         
A04860     MOVE AT-ACCOUNT-NO          TO WS-77-ACCOUNT-NO.             
A04860     MOVE AT-CUSTOMER-NO         TO WS-77-CUSTOMER-NO.            
A04860     MOVE WS-PREMISE-NO          TO WS-77-PREMISE-NO.             
A04860     MOVE '4'                    TO WS-77-ROUTE-CATEGORY.         
A04860     MOVE 'N'                    TO WS-77-PRIORITY.               
A04860     MOVE WS-RUN-DATE            TO WS-RUN-DATE-TS.               
A04860     MOVE WS-RUN-TS              TO WS-77-DATE-CREATED.           
A04860     MOVE WS-LOCAL-OFFICE        TO WS-77-LOCAL-OFFICE.           
A04860     MOVE WS-CURR-DATE-PLUS1     TO WS-CURR-DATE-TS.              
A04860     MOVE WS-CURR-TS             TO WS-77-DATE-REQUIRED.          
A04860     COMPUTE WS-77-COMMENTS-LEN = LENGTH OF WS-77-COMMENTS-TEXT.  
A04860     MOVE WS-PGRMNAME            TO WS-77-CREATED-BY.             
      *                                                                         
A02474     PERFORM 8895-INSERT-WORK-QUEUE THRU 8895-EXIT.               
A02474*                                                                         
A02474 2150-EXIT.                                                       
A02474     EXIT.                                                        
      *                                                                         
      ************************************************************              
      * 2200-PRODUCE-LETTER                                      *              
      * THIS PARAGRAPH RETRIEVES AND FORMATS THE INOFORMATION    *              
      * THAT IS WRITTEN TO FILE FCSRP000.  THE INFORMATION IS TO *              
      * PRODUCE PCSLTR19 "BANK DRAFT CYCLE CHANGE" LETTER.  THIS *              
      * LETTER IS PRODUCED FOR EACH ACCOUNT WHEN ITS DRAFT CYCLE *              
      * IS CHANGED.                                              *              
      ************************************************************              
      *================================================================*        
       2200-PRODUCE-LETTER.                                             
      *================================================================*        
      * THIS PARAGRAPH RETRIEVES AND FORMATS THE INOFORMATION          *        
      * THAT IS WRITTEN TO FILE FCSRP000.  THE INFORMATION IS TO       *        
      * PRODUCE PCSLTR19 "BANK DRAFT CYCLE CHANGE" LETTER.  THIS       *        
      * LETTER IS PRODUCED FOR EACH ACCOUNT WHEN ITS DRAFT CYCLE       *        
      * IS CHANGED.                                                    *        
      *----------------------------------------------------------------*        
           DISPLAY  'LETTER BEING PRODUCED' AT-ACCOUNT-NO.              
P00599     MOVE AT-ACCOUNT-NO          TO 1J-ACCOUNT-NO.                
P00599     MOVE AT-COMPANY-NO          TO 1J-CORRESP-COMPANY-NO         
P00599                                    1L-COMPANY-NO.                
P00599     MOVE AT-CUSTOMER-NO         TO 1J-CUSTOMER-NO.               
P00599     MOVE WS-REG-RD-SEQ-HOLD     TO 1J-REG-GROUP-CD.              
P00599     MOVE 'I'                    TO 1J-CORRESP-STATUS-CD.         
P00599     MOVE ZEROES                 TO 1J-GUARNTR-ACCT-NO            
P00599                                    1J-THD-PRTY-ID.               
P00599     MOVE SPACES                 TO 1J-BARCODE-UNIQUE-ID.         
P00599     MOVE WS-MESSAGE-NO          TO 1J-CORRESP-MSG-ID             
P00599                                    1L-CORRESP-MSG-ID             
P00599                                    WS-MESSAGE-ID.                
P00599     MOVE WS-PGRMNAME            TO 1J-CREATED-BY-PGM-ID          
P00599                                    1J-LAST-UPDATE-PGM-ID.        
P00599     MOVE WS-RUN-DATE            TO 1J-CORRESP-STMT-DT            
P00599                                    1L-EFF-TO-DT.                 
P00599     MOVE SPACES                 TO WS-CORRESP-ID-FND.            
P00599     PERFORM 5000-CHECK-LOAD-CORRESP-TBL   THRU 5000-CPD350-EXIT. 
P00599     MOVE WS-CURR-CORRESP-TYP-CD TO 1J-CORRESP-TYPE-CD.           
P00599                                                                  
P00599     PERFORM 5425-GET-CORRESP-ID-VAL       THRU 5425-CPD350-EXIT. 
AA2474*                                                                         
AA2474     MOVE WS-DRAFT-DAYS (WS-OLD-DRAFT-CYCLE)                      
AA2474                                 TO WS-OLD-DRAFT-DAYS.            
AA2474     MOVE WS-DRAFT-DAYS (WS-NEW-DRAFT-CYCLE)                      
AA2474                                 TO WS-NEW-DRAFT-DAYS.            
P00599     PERFORM 5500-LOAD-CORRESP-VAR         THRU 5500-EXIT.        
      *                                                                         
AA2474     MOVE WS-NEW-DRAFT-CYCLE     TO BE-DRAFT-CYCLE                
T22926     PERFORM 8600-UPDATE-BNKEFT            THRU 8600-EXIT.        
      *                                                                         
P00599     IF WS-CURR-COMM-INSERT-FL = 'Y'                              
P00599       PERFORM  2210-LOAD-COMM-DATA        THRU   2210-EXIT       
P00599     END-IF.                                                      
      *                                                                         
       2200-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
P00599*================================================================*        
       2210-LOAD-COMM-DATA.                                             
      *================================================================*        
      *                                                                         
T28610     MOVE AT-ACCOUNT-NO          TO KO-ACCOUNT-NO.                
T28610     MOVE AT-CUSTOMER-NO         TO KO-CUSTOMER-NO.               
AA2474     MOVE AT-PREMISE-NO          TO KO-PREMISE-NO.                
T28610     MOVE SPACES                 TO KO-CONTACT-NAME.              
T28610     MOVE ZEROES                 TO KO-PREMISE-NO.                
T28610     MOVE AT-COMPANY-NO          TO KO-COMPANY-NO.                
T28610     MOVE WS-LETTER              TO KO-COMM-METHOD.               
T28610     MOVE WS-OUTGOING            TO KO-COMM-DIRECTION.            
AA2474     MOVE 'SYSTEM'               TO KO-USER-ID-ORIG.              
T28610     MOVE SPACES                 TO KO-PSC-COMPLIANCE-IND.        
T28610     MOVE 'N'                    TO KO-RED-FLAG-IND               
T28610                                    KO-SCREEN-POP-IND.            
T28610     MOVE 'A'                    TO KO-COMM-ASSOC-CD.             
A03866     MOVE WS-MESSAGE-NO          TO KO-PROMOTION-ID.              
T28610     MOVE SPACES                 TO KO-RED-FLAG-EXPIRE-DT         
T28610                                    KO-CALL-END-TIME              
T28610                                    KO-RESPONSE-REASON-CD         
T28610                                    KO-RESPONSE-TYPE-CD           
T28610                                    KO-SOLICITATION-CD.           
AA2474     MOVE WS-INITIAL-COMMENTS    TO KO-INITIAL-COMMENT-TX-TEXT    
AA2474     MOVE 45                     TO KO-INITIAL-COMMENT-TX-LEN.    
T28610     MOVE 'N'                    TO KO-COMPLAINT-FL.              
T28610     MOVE -1                     TO WS-RED-FL-NULL-IND            
T28610                                    WS-END-NULL-IND.              
T28610     MOVE ZEROES                 TO KO-CALL-ORIGIN-ID             
T28610                                    KO-NUMBER-TRANSFERS           
T28610                                    KO-HOLD-TIME                  
T28610                                    KO-QUEUE-TIME                 
T28610                                    KO-TOTAL-CALL-TIME.           
T28610     MOVE SPACES                 TO KO-DISCOVERY-MTHD-CD          
T28610                                    KO-PREV-MARKETER-CD.          
T28610     MOVE WS-CURR-COMM-TYP-CD    TO KO-COMM-TYPE-CD.              
T28610     MOVE WS-CURR-COMM-SUBTYP-CD TO KO-COMM-SUBTYPE-CODE.         
      *                                                                         
AA2474     MOVE ZEROS                  TO WS-COMM-SUB.                  
AA2474     PERFORM 8700-INSERT-COMM-DATA        THRU 8700-EXIT          
AA2474            UNTIL WS-COMM-SUB >= WS-COMM-RETRY-COUNT.             
AA2474     IF WS-ACTIVE-RETURN-CODE = -803                              
AA2474        DISPLAY '*************************************'           
AA2474        DISPLAY '* 8700-INSERT-COMM-DATA'                         
AA2474        DISPLAY '* CUSTOMER_NO = ' AT-CUSTOMER-NO                 
AA2474        DISPLAY '* ACCOUNT_NO  = ' AT-ACCOUNT-NO                  
AA2474        DISPLAY '* SQL RETURN CODE = ' SQLCODE                    
AA2474        DISPLAY '*************************************'           
AA2474        PERFORM 9900-ABEND                THRU 9900-EXIT          
AA2474     END-IF.                                                      
      *                                                                         
       2210-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
           COPY CPD00037.                                                       
           COPY CPD00004.                                                       
           EXEC SQL                                                             
AA2474         INCLUDE CPDCA067                                                 
           END-EXEC.                                                            
      *                                                                         
P00599******************************************************************        
P00599* 5000-CHECK-LOAD-CORRESP-TBL.                                   *        
P00599******************************************************************        
P00599*                                                                         
P00599      EXEC SQL                                                            
P00599           INCLUDE CPD00350                                               
P00599      END-EXEC.                                                           
P00599*                                                                         
P00599*****************************************************************         
P00599*5500-LOAD-CORRESP-VAR.                                         *         
P00599*****************************************************************         
P00599*                                                                         
P00599 5500-LOAD-CORRESP-VAR.                                           
P00599*                                                                         
P00599     INITIALIZE DCLCSS-CORRESP-VAR.                               
P00599     MOVE WS-CORRESP-ID           TO 1K-CORRESP-ID.               
P00599     MOVE 'ALPHA-VAR-1'           TO 1K-CORRESP-VAR-NM.           
P00599     MOVE 'OLD-DRAFT-DAYS'        TO 1K-CORRESP-VAR-DATA.         
P00599*                                                                         
P00599     STRING 'the ',                                               
P00599            WS-DAY-TEXT(WS-OLD-DRAFT-DAYS)                        
P00599            DELIMITED BY SIZE                                     
P00599       INTO 1K-CORRESP-VAR-CHAR.                                  
P00599*                                                                         
P00599     PERFORM 8600-INSERT-CORRESP-VAR       THRU 8600-CPD350-EXIT. 
AA2474*                                                                         
P00599     INITIALIZE DCLCSS-CORRESP-VAR.                               
P00599     MOVE WS-CORRESP-ID           TO 1K-CORRESP-ID.               
P00599     MOVE 'ALPHA-VAR-2'           TO 1K-CORRESP-VAR-NM.           
P00599     MOVE 'NEW-DRAFT-DAYS'        TO 1K-CORRESP-VAR-DATA.         
AA2474*                                                                         
AA2474     STRING 'the ',                                               
P00599            WS-DAY-TEXT(WS-NEW-DRAFT-DAYS)                        
AA2474            DELIMITED BY SIZE                                     
P00599       INTO 1K-CORRESP-VAR-CHAR.                                  
P00599*                                                                         
P00599     PERFORM 8600-INSERT-CORRESP-VAR       THRU 8600-CPD350-EXIT. 
P00599*                                                                         
P00599     INITIALIZE DCLCSS-CORRESP-VAR.                               
P00599*                                                                         
P00599 5500-EXIT.                                                       
P00599     EXIT.                                                        
P00599*                                                                         
T26307*    6253-GET-FJC01-CHKP-LIMIT.                                           
T26307 COPY CPD00034.                                                           
T26307*                                                                         
T26307*    6254-GET-FJC01-STOP-KEY.                                             
T26307 COPY CPD00036.                                                           
T26307*                                                                         
T26307*    6255-GET-FJC01-PRT-CNTR.                                             
T26307*                                                                         
T26307 COPY CPD00015.                                                           
T26307*                                                                         
T18480******************************************************************        
T18480* 6990-FETCH-CUR-ACCOUNT                                         *        
T18480*  TO FETCH THE MOST CURRENT ACCOUNT AT THE PREMISE.             *        
T18480******************************************************************        
T18480     EXEC SQL                                                             
T18480         INCLUDE CPDCA099                                                 
T18480     END-EXEC.                                                            
T18480*                                                                         
T18480 6995-CPD99-ERROR-ROUTINE.                                        
T18480*                                                                         
T18480     DISPLAY '*************PCSBW121************'.                 
T18480     DISPLAY '* ERROR IN PARA ' ACTIVE-PARAGRAPH.                 
T18480     DISPLAY '* PREMISE-NO = ', HOSTVAR-ELEMENT-1.                
T18480     DISPLAY '* SQL CODE IS ', WS-CPD99-RETURN-CODE.              
T18480     DISPLAY '* PROGRAM ABENDING...           *'.                 
T18480     DISPLAY '*************PCSBW121************'.                 
T18480     PERFORM 9900-ABEND THRU 9900-EXIT.                           
T18480*                                                                         
T18480 6995-EXIT.                                                       
T18480     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 7000-READ-CA44-FILE.                                             
A02474*================================================================*        
A02474***  READ RE-SEQ INPUT FILE FOR PROCESSING.                               
A02474*                                                                         
A02474     READ FCSCA44-FILE AT END                                     
A02474         GO TO 7000-EXIT.                                         
A02474*                                                                         
A02474     IF FCA44-SUCCESSFUL                                          
A02474         CONTINUE                                                 
A02474     ELSE                                                         
A02474         DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7000-READ-CA44-FILE           '     
A02474         DISPLAY '** ERROR READING FCSCA44 '                      
A02474         DISPLAY '** FILE STATUS = ' WS-FCA44-STATUS              
A02474         DISPLAY '******************************************'     
A02474         PERFORM 9000-TERMINATE            THRU 9000-EXIT         
A02474     END-IF.                                                      
A02474*                                                                         
A02474 7000-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*                                                             **          
A02474*================================================================*        
       7010-SELECT-AT-FROM-DATA.                                        
A02474*================================================================*        
      *                                                                         
           EXEC SQL                                                     
               SELECT CODE_LPC_XMT,                                     
                      CUSTOMER_NO,                                      
                      BILL_CYCLE,                                       
T18480                CODE_DISC_OK,                                     
                      CODE_ACCT_STAT,                                   
                      COMPANY_NO,                                       
                      ADDRESS_ID,                                       
                      ADDRESS_FORMAT,                                   
                      LOCAL_OFFICE,                                     
A02474                NXT_BILL_NO,                                      
A02474                BILL_CYCLE_CHG_CD                                 
               INTO :AT-CODE-LPC-XMT,                                   
                    :AT-CUSTOMER-NO,                                    
                    :AT-BILL-CYCLE,                                     
T18480              :AT-CODE-DISC-OK,                                   
                    :AT-CODE-ACCT-STAT,                                 
                    :AT-COMPANY-NO,                                     
                    :AT-ADDRESS-ID,                                     
                    :AT-ADDRESS-FORMAT,                                 
                    :AT-LOCAL-OFFICE,                                   
A02474              :AT-NXT-BILL-NO,                                    
A02474              :AT-BILL-CYCLE-CHG-CD                               
               FROM CSS_ACCOUNT WITH(READUNCOMMITTED)                           
               WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                        
T35584                                                           
A02474                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT CODE_LPC_XMT,                                             
MFA-TR*               CUSTOMER_NO,                                              
MFA-TR*               BILL_CYCLE,                                               
MFA-TR*               CODE_DISC_OK,                                             
MFA-TR*               CODE_ACCT_STAT,                                           
MFA-TR*               COMPANY_NO,                                               
MFA-TR*               ADDRESS_ID,                                               
MFA-TR*               ADDRESS_FORMAT,                                           
MFA-TR*               LOCAL_OFFICE,                                             
MFA-TR*               NXT_BILL_NO,                                              
MFA-TR*               BILL_CYCLE_CHG_CD                                         
MFA-TR*        INTO :AT-CODE-LPC-XMT,                                           
MFA-TR*             :AT-CUSTOMER-NO,                                            
MFA-TR*             :AT-BILL-CYCLE,                                             
MFA-TR*             :AT-CODE-DISC-OK,                                           
MFA-TR*             :AT-CODE-ACCT-STAT,                                         
MFA-TR*             :AT-COMPANY-NO,                                             
MFA-TR*             :AT-ADDRESS-ID,                                             
MFA-TR*             :AT-ADDRESS-FORMAT,                                         
MFA-TR*             :AT-LOCAL-OFFICE,                                           
MFA-TR*             :AT-NXT-BILL-NO,                                            
MFA-TR*             :AT-BILL-CYCLE-CHG-CD                                       
MFA-TR*        FROM CSS_ACCOUNT                                                 
MFA-TR*        WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                                
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

      *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE  = SUCCESSFUL-CALL OR NOT-FOUND     
               CONTINUE                                                 
           ELSE                                                         
               DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7010-SELECT-AT-FROM-DATA  '         
               DISPLAY '** ACCOUNT NO = ' AT-ACCOUNT-NO                 
               DISPLAY '******************************************'     
               PERFORM 9900-SQL-ERROR-ROUTINE                           
           END-IF.                                                      
      *                                                                         
       7010-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
A02474*================================================================*        
A02474 7050-SELECT-MTR-CYCLES.                                          
A02474*================================================================*        
A02474***  GET THE MIN & MAX READ CYCLES ASSOCIATED WITH ACTIVE METERS.         
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         SELECT MIN(UT.READ_CYCLE)                                
A02474               ,MAX(UT.READ_CYCLE)                                
A02474               ,MIN(UT.READ_ROUTE)                                
A02474               ,MAX(UT.READ_ROUTE)                                
A02474          INTO :WS-MIN-READ-CYCLE :WS-NULL-IND1                   
A02474              ,:WS-MAX-READ-CYCLE :WS-NULL-IND2                   
A02474              ,:WS-MIN-READ-ROUTE :WS-NULL-IND3                   
A02474              ,:WS-MAX-READ-ROUTE :WS-NULL-IND4                   
A02474         FROM CSS_UTIL_ENVRNMT UT WITH(READUNCOMMITTED)                   
A02474             ,CSS_MTRD_ENVRNMT MN WITH(READUNCOMMITTED)                   
A02474         WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                 
A02474           AND UT.ACCOUNT_NO     = MN.ACCOUNT_NO                  
A02474           AND UT.CODE_UTIL_TYPE = MN.CODE_UTIL_TYPE              
A02474           AND UT.IC_NO          = MN.IC_NO                       
A02474                                                           
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT MIN(UT.READ_CYCLE)                                        
MFA-TR*              ,MAX(UT.READ_CYCLE)                                        
MFA-TR*              ,MIN(UT.READ_ROUTE)                                        
MFA-TR*              ,MAX(UT.READ_ROUTE)                                        
MFA-TR*         INTO :WS-MIN-READ-CYCLE :WS-NULL-IND1                           
MFA-TR*             ,:WS-MAX-READ-CYCLE :WS-NULL-IND2                           
MFA-TR*             ,:WS-MIN-READ-ROUTE :WS-NULL-IND3                           
MFA-TR*             ,:WS-MAX-READ-ROUTE :WS-NULL-IND4                           
MFA-TR*        FROM CSS_UTIL_ENVRNMT UT                                         
MFA-TR*            ,CSS_MTRD_ENVRNMT MN                                         
MFA-TR*        WHERE UT.ACCOUNT_NO     = :UT-ACCOUNT-NO                         
MFA-TR*          AND UT.ACCOUNT_NO     = MN.ACCOUNT_NO                          
MFA-TR*          AND UT.CODE_UTIL_TYPE = MN.CODE_UTIL_TYPE                      
MFA-TR*          AND UT.IC_NO          = MN.IC_NO                               
MFA-TR*        WITH UR                                                          
MFA-TR*        QUERYNO 7050                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE  = SUCCESSFUL-CALL OR NOT-FOUND     
A02474         CONTINUE                                                 
A02474     ELSE                                                         
A02474         DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7050-SELECT-MTR-CYCLES        '     
A02474         DISPLAY '** ACCOUNT NO        = ' UT-ACCOUNT-NO          
A02474         DISPLAY '******************************************'     
A02474         PERFORM 9900-SQL-ERROR-ROUTINE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 7050-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
T18480 7150-OPEN-MN-CURSOR.                                             
T18480*                                                                         
T18480     MOVE '7150'                       TO ACTIVE-PARAGRAPH.       
T18480*                                                                         
T18480     EXEC SQL                                                     
T18480        OPEN MN_CURSOR                                            
T18480     END-EXEC.                                                    

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

T18480                                                                  
T18480     MOVE SQLCODE                      TO                         
T18480                                          WS-ACTIVE-RETURN-CODE.  
T18480     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T18480         CONTINUE                                                 
T18480     ELSE                                                         
T18480         DISPLAY '********** PCSBW121  ABORT ***************'     
T18480         DISPLAY '* 7150-OPEN-MN-CURSOR                    *'     
T18480         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
T18480         DISPLAY '* PROGRAM ABORTING...                    *'     
T18480         DISPLAY '********** PCSBW121  ABORT ***************'     
T18480         PERFORM 9900-ABEND            THRU 9900-EXIT             
T18480     END-IF.                                                      
T18480*                                                                         
T18480 7150-EXIT.                                                       
T18480     EXIT.                                                        
T18480*                                                                         
T18480******************************************************************        
T18480**  FETCHES INSTALLED METER DATE FROM MTRD ENVRNMT TABLE        **        
T18480******************************************************************        
T18480*                                                                         
T18480 7160-FETCH-MN-CURSOR.                                            
T18480*                                                                         
T18480     MOVE '7160'                       TO ACTIVE-PARAGRAPH.       
      *                                                                         
           EXEC SQL                                                     
T18480        FETCH MN_CURSOR                                           
T18480         INTO  :MN-ACCOUNT-NO                                     
T18480              ,:MN-REGISTER-RD-SEQ                                
T18480              ,:MN-CODE-DATA-PRESENT                              
           END-EXEC.                                                    

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

      *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
T18480     IF  WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL OR NOT-FOUND 
               CONTINUE                                                 
           ELSE                                                         
T18480         DISPLAY '********** PCSBW121 ABORT ****************'     
T18480         DISPLAY '* 7160-FETCH-MN-CURSOR                   *'     
T21445         DISPLAY '* CODE_UTIL_TYPE = ' MN-CODE-UTIL-TYPE          
C37381         DISPLAY '* IC_NO          = ' MN-IC-NO                   
C37381         DISPLAY '* MTR_REF_NO     = ' MN-MTR-REF-NO              
T21445         DISPLAY '* PREMISE_NO     = ' UT-PREMISE-NO              
T18480         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
T18480         DISPLAY '* PROGRAM ABORTING...                    *'     
T18480         DISPLAY '********** PCSBW121 ABORT ****************'     
T18480         PERFORM 9900-ABEND            THRU 9900-EXIT             
T18480     END-IF.                                                      
T18480*                                                                         
T18480 7160-EXIT.                                                       
T18480     EXIT.                                                        
T18480*                                                                         
T18480******************************************************************        
T18480**  CLOSES THE MTRD-ENV CURSOR                                  **        
T18480******************************************************************        
T18480*                                                                         
T18480 7170-CLOSE-MN-CURSOR.                                            
T18480*                                                                         
T18480     MOVE '7170'                       TO ACTIVE-PARAGRAPH.       
T18480*                                                                         
T18480     EXEC SQL                                                     
T18480        CLOSE MN_CURSOR                                           
T18480     END-EXEC.                                                    

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

T18480*                                                                         
T18480     MOVE SQLCODE                      TO                         
T18480                                      WS-ACTIVE-RETURN-CODE.      
T18480     IF WS-ACTIVE-RETURN-CODE EQUAL SUCCESSFUL-CALL               
T18480         CONTINUE                                                 
T18480     ELSE                                                         
T18480         DISPLAY '********** PCSBW121 ABORT ****************'     
T18480         DISPLAY '* 7170-CLOSE-MN-CURSOR                   *'     
T18480         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
T18480         DISPLAY '* PROGRAM ABORTING...                    *'     
T18480         DISPLAY '********** PCSBW121 ABORT ****************'     
T18480         PERFORM 9900-ABEND            THRU 9900-EXIT             
           END-IF.                                                      
      *                                                                         
T18480 7170-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 7200-SELECT-LOC-OFF-CYC-RT.                                      
A02474*================================================================*        
A02474***     LOCAL OFFICE/CYCLE/ROUTE VALIDATION                               
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         SELECT 'Y'                                               
A02474           INTO :WS-DUMMY-VAR                                     
A02474         FROM CSS_LOC_OFF_CYC_RT WITH(READUNCOMMITTED)                    
A02474         WHERE LOCAL_OFFICE = :O2-LOCAL-OFFICE                    
A02474           AND READ_CYCLE   = :O2-READ-CYCLE                      
A02474           AND READ_ROUTE   = :O2-READ-ROUTE                      
A02474                                                           
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT 'Y'                                                       
MFA-TR*          INTO :WS-DUMMY-VAR                                             
MFA-TR*        FROM CSS_LOC_OFF_CYC_RT                                          
MFA-TR*        WHERE LOCAL_OFFICE = :O2-LOCAL-OFFICE                            
MFA-TR*          AND READ_CYCLE   = :O2-READ-CYCLE                              
MFA-TR*          AND READ_ROUTE   = :O2-READ-ROUTE                              
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE  = SUCCESSFUL-CALL OR NOT-FOUND     
A02474         CONTINUE                                                 
A02474     ELSE                                                         
A02474         DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7200-SELECT-LOC-OFF-CYC-RT'         
A02474         DISPLAY '** LOCAL OFFICE = ' O2-LOCAL-OFFICE             
A02474         DISPLAY '** READ CYCLE   = ' O2-READ-CYCLE               
A02474         DISPLAY '** READ ROUTN   = ' O2-READ-ROUTE               
A02474         DISPLAY '******************************************'     
A02474         PERFORM 9900-SQL-ERROR-ROUTINE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 7200-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 7210-GET-PREMISE-LOF.                                            
A02474*================================================================*        
A02474***  VALIDATE PREMISE NO RECEIVED FROM INPUT FILE AGAINST PREMISE         
A02474***  TABLE AND AT THE SAME TIME GET LOCAL OFFICE FROM PREMISE             
A02474***  TABLE TO UPDATE LATER.                                               
T23532*                                                                         
T23532     EXEC SQL                                                     
T23532         SELECT LOCAL_OFFICE                                      
T23532         INTO :WS-LOCAL-OFFICE2                                   
T23532         FROM CSS_PREMISE WITH(READUNCOMMITTED)                           
T23532         WHERE PREMISE_NO = :WS-PREMISE-NO                        
T35584                                                           
A02474                                                      
T23532     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT LOCAL_OFFICE                                              
MFA-TR*        INTO :WS-LOCAL-OFFICE2                                           
MFA-TR*        FROM CSS_PREMISE                                                 
MFA-TR*        WHERE PREMISE_NO = :WS-PREMISE-NO                                
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T23532         CONTINUE                                                 
T23532     ELSE                                                         
T23532         DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7210-GET-PREMISE-LOF '              
A02474         DISPLAY '** PREMISE_NO   = ' WS-PREMISE-NO               
T23532         DISPLAY '******************************************'     
T23532         PERFORM 9900-SQL-ERROR-ROUTINE                           
T23532     END-IF.                                                      
T23532*                                                                         
T23532 7210-EXIT.                                                       
T23532     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 7220-SELECT-BANK-EFT.                                            
A02474*================================================================*        
A02474***STATUS_CODE=D:CANCELLED,E:INCOMPLETE,M:ACTIVE,N:PRE-NOTE,              
A02474***       O:CANCELLED. VALUES M,N & O APPLIES TO EPAY ONLY                
A02474*                                                                         
DC         EXEC SQL                                                     
DC             SELECT ACCOUNT_NO,            STATUS_CODE,               
DC                    REQSTED_DRAFT_DAY,     DRAFT_CYCLE                
DC             INTO  :BE-ACCOUNT-NO,        :BE-STATUS-CODE,            
DC                   :BE-REQSTED-DRAFT-DAY, :BE-DRAFT-CYCLE             
DC             FROM   CSS_BANK_EFT WITH(READUNCOMMITTED)                        
DC             WHERE ACCOUNT_NO = :BE-ACCOUNT-NO                        
C37381           AND STATUS_CODE NOT IN ('D','E','M','N','O')           
T35584                                                           
A02474                                                      
DC         END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT ACCOUNT_NO,            STATUS_CODE,                       
MFA-TR*               REQSTED_DRAFT_DAY,     DRAFT_CYCLE                        
MFA-TR*        INTO  :BE-ACCOUNT-NO,        :BE-STATUS-CODE,                    
MFA-TR*              :BE-REQSTED-DRAFT-DAY, :BE-DRAFT-CYCLE                     
MFA-TR*        FROM   CSS_BANK_EFT                                              
MFA-TR*        WHERE ACCOUNT_NO = :BE-ACCOUNT-NO                                
MFA-TR*          AND STATUS_CODE NOT IN ('D','E','M','N','O')                   
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

DC    *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
T21445        CONTINUE                                                  
T21445     ELSE                                                         
T21445         DISPLAY '******************************************'     
T21445         DISPLAY '** ERROR IN 7220-SELECT-BANK-EFT          '     
T21445         DISPLAY '** ACCOUNT_NO        = ' BE-ACCOUNT-NO          
T21445         DISPLAY '******************************************'     
T21445         PERFORM 9900-SQL-ERROR-ROUTINE                           
T21445     END-IF.                                                      
T21445*                                                                         
DC     7220-EXIT.                                                       
DC         EXIT.                                                        
DC    *                                                                         
A02474*                                                                         
      ****************************************************************          
      **                                                            **          
      **  7300-GET-BILL-WINDOW                                      **          
      **      GET THE BILL WINDOW FOR THE REVENUE MONTH             **          
      **                                                            **          
      ****************************************************************          
       7300-GET-BILL-WINDOW.                                            
      *                                                                         
           EXEC SQL                                                     
               SELECT MIN(DATE_EXTRACT)                                 
               INTO :BN-DATE-EXTRACT :WS-DATE-EXTRACT-NULL-IND          
               FROM CSS_BILL_WINDOW WITH(READUNCOMMITTED)                       
               WHERE     BILL_CYCLE = :BN-BILL-CYCLE                    
                 AND  REVENUE_MONTH = :BN-REVENUE-MONTH                 
T35584                                                           
A02474                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT MIN(DATE_EXTRACT)                                         
MFA-TR*        INTO :BN-DATE-EXTRACT :WS-DATE-EXTRACT-NULL-IND                  
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 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

      *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
           EVALUATE WS-ACTIVE-RETURN-CODE                               
               WHEN SUCCESSFUL-CALL                                     
                   IF WS-DATE-EXTRACT-NULL                              
                       MOVE WS-N       TO WS-BILL-CYCLE-FOUND-SW        
                   ELSE                                                 
                       MOVE WS-Y       TO WS-BILL-CYCLE-FOUND-SW        
                   END-IF                                               
               WHEN NOT-FOUND                                           
                   MOVE WS-N           TO WS-BILL-CYCLE-FOUND-SW        
               WHEN OTHER                                               
                   DISPLAY '7300-GET-BILL-WINDOW'                       
T21445             DISPLAY 'BILL_CYCLE = '   BN-BILL-CYCLE              
T21445             DISPLAY 'REVENUE_MONTH = ' BN-REVENUE-MONTH          
                   PERFORM 9900-SQL-ERROR-ROUTINE                       
           END-EVALUATE.                                                
      *                                                                         
       7300-EXIT.                                                       
           EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 7310-GET-CURR-DATE-PLUS1.                                        
A02474*================================================================*        
A02474*                                                                         
           EXEC SQL                                                     
A02474         SELECT
              DATEADD( DAY, 1, CAST(SYSDATETIMEOFFSET() AS DATE) )
            INTO
              :WS-CURR-DATE-PLUS1                              
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ006
MFA-TR* MSQ028
MFA-TR* MSQ044
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SET  :WS-CURR-DATE-PLUS1 =                                       
MFA-TR*              CURRENT DATE + 1 DAYS                                      
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

      *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              CONTINUE                                                  
           ELSE                                                         
               DISPLAY '******************************************'     
A02474         DISPLAY '** ERROR IN 7310-GET-CURR-DATE-PLUS1'           
               DISPLAY '******************************************'     
               PERFORM 9900-SQL-ERROR-ROUTINE                           
           END-IF.                                                      
A02474*                                                                         
A02474 7310-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
AA2474*================================================================*        
AA2474 7320-OPEN-DRAFT-DAYS.                                            
AA2474*================================================================*        
AA2474*                                                                         
AA2474     EXEC SQL                                                     
AA2474         OPEN DRAFT_DAYS                                          
AA2474     END-EXEC.                                                    

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

AA2474*                                                                         
AA2474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
AA2474*                                                                         
AA2474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
AA2474        CONTINUE                                                  
AA2474     ELSE                                                         
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         DISPLAY '* 7320-OPEN-DRAFT-DAYS                   *'     
AA2474         DISPLAY '* BILL_CYCLE <  21                       *'     
AA2474         DISPLAY '* DATE_EXTRACT   > CURRENT DATE          *'     
AA2474         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
AA2474         DISPLAY '* PROGRAM ABORTING...                    *'     
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         PERFORM 9900-ABEND            THRU 9900-EXIT             
AA2474     END-IF.                                                      
AA2474*                                                                         
AA2474 7320-EXIT.                                                       
AA2474     EXIT.                                                        
AA2474*                                                                         
AA2474*================================================================*        
AA2474 7330-FETCH-DRAFT-DAYS.                                           

MSQ008     MOVE 30 TO MSQ008-DRAFT-DAYS
AA2474*================================================================*        
AA2474*                                                                         
AA2474     EXEC SQL                                                     
AA2474          FOR :MSQ008-DRAFT-DAYS
              FETCH 
              FROM DRAFT_DAYS            
AA2474            INTO :WS-DRAFT-CYCLE                                  
AA2474                ,:WS-DRAFT-DAYS                                   
AA2474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ008
MFA-TR*    EXEC SQL                                                             
MFA-TR*         FETCH NEXT ROWSET FROM DRAFT_DAYS FOR 30 ROWS                   
MFA-TR*           INTO :WS-DRAFT-CYCLE                                          
MFA-TR*               ,:WS-DRAFT-DAYS                                           
MFA-TR*    END-EXEC.                                                            

MSQ008      IF SQLCODE EQUAL ZERO AND
MSQ008        SQLERRD(3) < MSQ008-DRAFT-DAYS
MSQ008         MOVE 100        TO SQLCODE
MSQ008         MOVE 2000       TO SQLSTATE
MSQ008      END-IF.
MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

AA2474*                                                                         
AA2474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
AA2474*                                                                         
AA2474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
AA2474        MOVE SQLERRD (3)         TO WS-DRAFT-ROW-COUNT            
AA2474     ELSE                                                         
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         DISPLAY '* 7330-FETCH-DRAFT-DAYS                  *'     
AA2474         DISPLAY '* BILL_CYCLE <  21                       *'     
AA2474         DISPLAY '* DATE_EXTRACT   > CURRENT DATE          *'     
AA2474         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
AA2474         DISPLAY '* PROGRAM ABORTING...                    *'     
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         PERFORM 9900-ABEND            THRU 9900-EXIT             
AA2474     END-IF.                                                      
AA2474*                                                                         
AA2474 7330-EXIT.                                                       
AA2474     EXIT.                                                        
AA2474*                                                                         
AA2474*================================================================*        
AA2474 7340-CLOSE-DRAFT-DAYS.                                           
AA2474*================================================================*        
AA2474*                                                                         
AA2474     EXEC SQL                                                     
AA2474         CLOSE DRAFT_DAYS                                         
AA2474     END-EXEC.                                                    

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

AA2474*                                                                         
AA2474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
AA2474*                                                                         
AA2474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
AA2474        CONTINUE                                                  
AA2474     ELSE                                                         
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         DISPLAY '* 7340-CLOSE-DRAFT-DAYS                  *'     
AA2474         DISPLAY '* BILL_CYCLE <  21                       *'     
AA2474         DISPLAY '* DATE_EXTRACT   > CURRENT DATE          *'     
AA2474         DISPLAY '* SQLCODE IS ', WS-ACTIVE-RETURN-CODE           
AA2474         DISPLAY '* PROGRAM ABORTING...                    *'     
AA2474         DISPLAY '********** PCSBW121 ABORT ****************'     
AA2474         PERFORM 9900-ABEND            THRU 9900-EXIT             
AA2474     END-IF.                                                      
AA2474*                                                                         
AA2474 7340-EXIT.                                                       
AA2474     EXIT.                                                        
AA2474*                                                                         
      ****************************************************************          
      **                                                            **          
      **  7400-GET-READ-WINDOW                                      **          
      **      GET THE READ WINDOW FOR THE REVENUE MONTH             **          
      **                                                            **          
      ****************************************************************          
       7400-GET-READ-WINDOW.                                            
      *                                                                         
           EXEC SQL                                                     
               SELECT MIN(DATE_MTR_RD_XTRCT)                            
               INTO   :RW-DATE-MTR-RD-XTRCT :WS-DATE-MTR-RD-NULL-IND    
               FROM   CSS_READ_WINDOW WITH(READUNCOMMITTED)                     
               WHERE  READ_CYCLE    = :RW-READ-CYCLE                    
                 AND  REVENUE_MONTH = :RW-REVENUE-MONTH                 
T35584                                                           
A02474                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR*    EXEC SQL                                                             
MFA-TR*        SELECT MIN(DATE_MTR_RD_XTRCT)                                    
MFA-TR*        INTO   :RW-DATE-MTR-RD-XTRCT :WS-DATE-MTR-RD-NULL-IND            
MFA-TR*        FROM   CSS_READ_WINDOW                                           
MFA-TR*        WHERE  READ_CYCLE    = :RW-READ-CYCLE                            
MFA-TR*          AND  REVENUE_MONTH = :RW-REVENUE-MONTH                         
MFA-TR*        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

      *                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
           EVALUATE WS-ACTIVE-RETURN-CODE                               
               WHEN SUCCESSFUL-CALL                                     
                   IF WS-DATE-MTR-RD-NULL                               
                       MOVE WS-N       TO WS-READ-CYCLE-FOUND-SW        
                   ELSE                                                 
                       MOVE WS-Y       TO WS-READ-CYCLE-FOUND-SW        
                   END-IF                                               
               WHEN NOT-FOUND                                           
                   MOVE WS-N           TO WS-READ-CYCLE-FOUND-SW        
               WHEN OTHER                                               
                   DISPLAY '7400-GET-READ-WINDOW'                       
T21445             DISPLAY 'READ_CYCLE = '   RW-READ-CYCLE              
T21445             DISPLAY 'REVENUE_MONTH = ' RW-REVENUE-MONTH          
                   PERFORM 9900-SQL-ERROR-ROUTINE                       
           END-EVALUATE.                                                
      *                                                                         
       7400-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
           EXEC SQL                                                             
AA2474         INCLUDE CPDCA038                                                 
           END-EXEC.                                                            
A02474*                                                                         
A02474*================================================================*        
A02474 8100-UPDATE-BILL-CYC.                                            
A02474*================================================================*        
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         UPDATE CSS_ACCOUNT                                       
A02474            SET BILL_CYCLE       = :AT-BILL-CYCLE                 
A02474               ,DATE_LAST_ACTION = CAST(SYSDATETIMEOFFSET() 
           AS DATE)                   
A02474           WHERE PREMISE_NO = :AT-PREMISE-NO                      
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ACCOUNT                                               
MFA-TR*           SET BILL_CYCLE       = :AT-BILL-CYCLE                         
MFA-TR*              ,DATE_LAST_ACTION = CURRENT DATE                           
MFA-TR*          WHERE PREMISE_NO = :AT-PREMISE-NO                              
MFA-TR*        QUERYNO 8100                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A02474        ADD 1 TO WS-CHKP-UPD-COUNTER                              
A02474        ADD 1 TO WS-AT-UPDT-CNTR-LUW                              
A02474     ELSE                                                         
A02474         DISPLAY '***************************************'        
A02474         DISPLAY '* 8100-UPDATE-BILL-CYC'                         
A02474         DISPLAY '* PREMISE-NO = ' AT-PREMISE-NO                  
A02474         DISPLAY '* BILL_CYCLE = ' AT-BILL-CYCLE                  
A02474         DISPLAY '***************************************'        
A02474         PERFORM 9900-SQL-ERROR-ROUTINE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 8100-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 8110-UPDATE-LPC-DISC-OK.                                         
A02474*================================================================*        
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         UPDATE CSS_ACCOUNT                                       
A02474            SET CODE_LPC_XMT  = :AT-CODE-LPC-XMT                  
A02474               ,CODE_DISC_OK  = :AT-CODE-DISC-OK                  
A02474         WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                        
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_ACCOUNT                                               
MFA-TR*           SET CODE_LPC_XMT  = :AT-CODE-LPC-XMT                          
MFA-TR*              ,CODE_DISC_OK  = :AT-CODE-DISC-OK                          
MFA-TR*        WHERE ACCOUNT_NO = :AT-ACCOUNT-NO                                
MFA-TR*        QUERYNO 8110                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
A02474        ADD 1 TO WS-CHKP-UPD-COUNTER                              
A02474        ADD 1 TO WS-AT-UPDT-CNTR-LUW                              
A02474     ELSE                                                         
A02474         DISPLAY '***************************************'        
A02474         DISPLAY '* ERROR IN 8110-UPDATE-LPC-DISC-OK'             
A02474         DISPLAY '* ACCOUNT_NO    = ' AT-ACCOUNT-NO               
A02474         DISPLAY '* CODE_LPC_XMT  = ' AT-CODE-LPC-XMT             
A02474         DISPLAY '* CODE_DISC_OK  = ' AT-CODE-DISC-OK             
A02474         DISPLAY '***************************************'        
A02474         PERFORM 9900-SQL-ERROR-ROUTINE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 8110-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
T23532 8150-UPDATE-CSS-PREMISE.                                         
A02474*================================================================*        
T23532*                                                                         
T23532     EXEC SQL                                                     
T23532         UPDATE CSS_PREMISE                                       
T23532            SET  LOCAL_OFFICE = :O2-LOCAL-OFFICE                  
T23532         WHERE     PREMISE_NO = :WS-PREMISE-NO                    
A02474                                                      
T23532     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_PREMISE                                               
MFA-TR*           SET  LOCAL_OFFICE = :O2-LOCAL-OFFICE                          
MFA-TR*        WHERE     PREMISE_NO = :WS-PREMISE-NO                            
MFA-TR*        QUERYNO 8150                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
T23532     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
T26307        ADD 1 TO WS-CHKP-UPD-COUNTER                              
T26307        ADD 1 TO WS-PR-UPDT-CNTR-LUW                              
T23532     ELSE                                                         
T23532         DISPLAY '***************************************'        
A02474         DISPLAY '* ERROR IN 8150-UPDATE-CSS-PREMISE'             
A02474         DISPLAY '* PREMISE NO = ' WS-PREMISE-NO                  
T23532         DISPLAY '***************************************'        
T23532         PERFORM 9900-SQL-ERROR-ROUTINE                           
T23532     END-IF.                                                      
T23532*                                                                         
T23532 8150-EXIT.                                                       
T23532     EXIT.                                                        
A02474*                                                                         
      *********************************************************                 
T26307 8181-PRINT-COUNTERS.                                             
T26307*                                                                         
T26307     MOVE '8181' TO ACTIVE-PARAGRAPH.                             
T26307     DISPLAY ' '.                                                 
T26307     DISPLAY '*****************************************'.         
T26307     DISPLAY '** I/O COUNTERS FOR 1 LUW IN JCSBW121  **'.         
T26307     DISPLAY ' '.                                                 
T26307     DISPLAY '** AT UPDATES = ' WS-AT-UPDT-CNTR-LUW               
T26307     DISPLAY '** PR UPDATES = ' WS-PR-UPDT-CNTR-LUW               
T26307     DISPLAY '** MN UPDATES = ' WS-MN-UPDT-CNTR-LUW               
T26307     DISPLAY '** UT UPDATES = ' WS-UT-UPDT-CNTR-LUW               
T26307     DISPLAY '** RG UPDATES = ' WS-RG-UPDT-CNTR-LUW               
T26307     DISPLAY '** BG UPDATES = ' WS-BG-UPDT-CNTR-LUW               
T26307     DISPLAY '** BE UPDATES = ' WS-BE-UPDT-CNTR-LUW               
T26307     DISPLAY '** CQ INSERTS = ' WS-CQ-ISRT-CNTR-LUW               
T26307     DISPLAY ' '.                                                 
T26307     DISPLAY '*****************************************'.         
T26307     MOVE ZERO TO WS-AT-UPDT-CNTR-LUW                             
T26307                  WS-PR-UPDT-CNTR-LUW                             
T26307                  WS-MN-UPDT-CNTR-LUW                             
T26307                  WS-UT-UPDT-CNTR-LUW                             
T26307                  WS-RG-UPDT-CNTR-LUW                             
T26307                  WS-BG-UPDT-CNTR-LUW                             
T26307                  WS-BE-UPDT-CNTR-LUW                             
T26307                  WS-CQ-ISRT-CNTR-LUW.                            
T26307 8181-EXIT.                                                       
T26307     EXIT.                                                        
T26307*                                                                         
A02474*                                                                         
A02474*===============================================================*         
A02474 8200-UPDATE-UTIL-ENVRNMT.                                        
A02474*===============================================================*         
A02474***  UPDATE ALL ROWS OF UT USING PREMISE-NO.                              
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         UPDATE CSS_UTIL_ENVRNMT                                  
A02474            SET READ_CYCLE = :WS-TO-CYCLE                         
A02474               ,READ_ROUTE = :WS-TO-ROUTE                         
A02474            WHERE PREMISE_NO = :UT-PREMISE-NO                     
A02474              AND ( READ_CYCLE <> :WS-TO-CYCLE                    
A02474                 OR READ_ROUTE <> :WS-TO-ROUTE )                  
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_UTIL_ENVRNMT                                          
MFA-TR*           SET READ_CYCLE = :WS-TO-CYCLE                                 
MFA-TR*              ,READ_ROUTE = :WS-TO-ROUTE                                 
MFA-TR*           WHERE PREMISE_NO = :UT-PREMISE-NO                             
MFA-TR*             AND ( READ_CYCLE <> :WS-TO-CYCLE                            
MFA-TR*                OR READ_ROUTE <> :WS-TO-ROUTE )                          
MFA-TR*        QUERYNO 8200                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     EVALUATE TRUE                                                
A02474        WHEN WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
A02474             ADD 1 TO WS-CHKP-UPD-COUNTER                         
A02474             ADD 1 TO WS-UT-UPDT-CNTR-LUW                         
A02474        WHEN WS-ACTIVE-RETURN-CODE = NOT-FOUND                    
A02474             CONTINUE                                             
A02474        WHEN OTHER                                                
A02474             DISPLAY '***************************************'    
A02474             DISPLAY '* 8200-UPDATE-UTIL-ENVRNMT'                 
A02474             DISPLAY '* PREMISE_NO = ' UT-PREMISE-NO              
A02474             DISPLAY '* READ_CYCLE = ' WS-TO-CYCLE                
A02474             DISPLAY '* READ_ROUTE = ' WS-TO-ROUTE                
A02474             DISPLAY '***************************************'    
A02474             PERFORM 9900-SQL-ERROR-ROUTINE                       
A02474     END-EVALUATE.                                                
A02474*                                                                         
A02474 8200-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 8300-UPDATE-MTRD-ENVRNMT.                                        
A02474*================================================================*        
A02474** CALL THIS UPD ONLY WHEN READ SEQUENCE DIFFERENT FROM INPUT             
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         UPDATE CSS_MTRD_ENVRNMT                                  
A02474            SET REGISTER_RD_SEQ = :WS-REG-RD-SEQ-HOLD             
A02474          WHERE ACCOUNT_NO     = :MN-ACCOUNT-NO                   
A02474            AND CODE_UTIL_TYPE = :MN-CODE-UTIL-TYPE               
A02474            AND IC_NO          = :MN-IC-NO                        
A02474            AND MTR_REF_NO     = :MN-MTR-REF-NO                   
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_MTRD_ENVRNMT                                          
MFA-TR*           SET REGISTER_RD_SEQ = :WS-REG-RD-SEQ-HOLD                     
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*        QUERYNO 8300                                                     
MFA-TR*    END-EXEC.                                                            

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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     EVALUATE TRUE                                                
A02474        WHEN WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
A02474             ADD 1 TO WS-CHKP-UPD-COUNTER                         
A02474             ADD 1 TO WS-MN-UPDT-CNTR-LUW                         
A02474        WHEN WS-ACTIVE-RETURN-CODE = NOT-FOUND                    
A02474             CONTINUE                                             
A02474        WHEN OTHER                                                
A02474             DISPLAY '***************************************'    
A02474             DISPLAY '* ERROR IN 8300-UPDATE-MTRD-ENVRNMT'        
A02474             DISPLAY '* ACCOUNT NO = ' MN-ACCOUNT-NO              
A02474             DISPLAY '* UTIL TYPE  = ' MN-CODE-UTIL-TYPE          
A02474             DISPLAY '* IC NO      = ' MN-IC-NO                   
A02474             DISPLAY '* MTR_REF_NO = ' MN-MTR-REF-NO              
A02474             DISPLAY '***************************************'    
A02474             PERFORM 9900-SQL-ERROR-ROUTINE                       
A02474     END-EVALUATE.                                                
A02474*                                                                         
A02474 8300-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 8305-UPDATE-REGISTER-READ.                                       
A02474*================================================================*        
A02474** CALL THIS UPD ONLY IF MN-CODE-DATA-PRESENT NOT BLANK.                  
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474         UPDATE CSS_REGISTER_READ                                 
A02474            SET REGISTER_RD_SEQ = :WS-REG-RD-SEQ-HOLD             
A02474         WHERE ACCOUNT_NO        = :RG-ACCOUNT-NO                 
A02474           AND CODE_UTIL_TYPE    = :RG-CODE-UTIL-TYPE             
A02474           AND IC_NO             = :RG-IC-NO                      
A02474           AND MTR_REF_NO        = :RG-MTR-REF-NO                 
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_REGISTER_READ                                         
MFA-TR*           SET REGISTER_RD_SEQ = :WS-REG-RD-SEQ-HOLD                     
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*        QUERYNO 8305                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     EVALUATE TRUE                                                
A02474        WHEN WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL              
A02474             ADD 1 TO WS-CHKP-UPD-COUNTER                         
A02474             ADD 1 TO WS-RG-UPDT-CNTR-LUW                         
A02474        WHEN WS-ACTIVE-RETURN-CODE = NOT-FOUND                    
A02474             CONTINUE                                             
A02474        WHEN OTHER                                                
A02474             DISPLAY '***************************************'    
A02474             DISPLAY '* ERROR IN 8305-UPDATE-REQISTER-READ '      
A02474             DISPLAY '* ACCOUNT NO = ' RG-ACCOUNT-NO              
A02474             DISPLAY '* UTIL TYPE  = ' RG-CODE-UTIL-TYPE          
A02474             DISPLAY '* IC NO      = ' RG-IC-NO                   
A02474             DISPLAY '* MTR-REF-NO = ' RG-MTR-REF-NO              
A02474             DISPLAY '***************************************'    
A02474             PERFORM 9900-SQL-ERROR-ROUTINE                       
A02474     END-EVALUATE.                                                
A02474*                                                                         
A02474 8305-EXIT.                                                       
A02474     EXIT.                                                        
A02474*                                                                         
A02474*================================================================*        
A02474 8500-UPDATE-BILLDET.                                             
A02474*================================================================*        
A02474***  WHEN BILL CYCLE CHANGES, UPDATE PRORATE CODE IN BILLING DET          
A02474***  TABLE FOR ALL IC'S  (FUTURE BILL HOOK ONLY).                         
A02474*                                                                         
A02474     EXEC SQL                                                     
A02474        UPDATE CSS_BILLING_DET                                    
A02474           SET PRORATE_CD     = :BG-PRORATE-CD                    
A02474         WHERE ACCOUNT_NO     = :BG-ACCOUNT-NO                    
A02474           AND PRORATE_CD          =  ' '                         
A02474           AND REV_MTH_ORIG_BILL   =  0                           
A02474           AND REVENUE_MONTH       =  0                           
A02474           AND CODE_BILL_CALC      =  'A'                         
A02474           AND CODE_BILL_ITM_TYPE  =  'C'                         
A02474           AND CODE_BILL_ITM_IND   =  'A'                         
A02474           AND REBILL_IND          <> 'Y'                         
A02474                                                      
A02474     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*       UPDATE CSS_BILLING_DET                                            
MFA-TR*          SET PRORATE_CD     = :BG-PRORATE-CD                            
MFA-TR*        WHERE ACCOUNT_NO     = :BG-ACCOUNT-NO                            
MFA-TR*          AND PRORATE_CD          =  ' '                                 
MFA-TR*          AND REV_MTH_ORIG_BILL   =  0                                   
MFA-TR*          AND REVENUE_MONTH       =  0                                   
MFA-TR*          AND CODE_BILL_CALC      =  'A'                                 
MFA-TR*          AND CODE_BILL_ITM_TYPE  =  'C'                                 
MFA-TR*          AND CODE_BILL_ITM_IND   =  'A'                                 
MFA-TR*          AND REBILL_IND          <> 'Y'                                 
MFA-TR*        QUERYNO 8500                                                     
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

A02474*                                                                         
A02474     MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
A02474*                                                                         
A02474     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
A02474        CONTINUE                                                  
A02474     ELSE                                                         
A02474         DISPLAY '***************************************'        
A02474         DISPLAY '* ERROR IN 8500-UPDATE-BILLDET '                
A02474         DISPLAY '* ACCOUNT NO  = ' BG-ACCOUNT-NO                 
A02474         DISPLAY '***************************************'        
A02474         PERFORM 9900-SQL-ERROR-ROUTINE                           
A02474     END-IF.                                                      
A02474*                                                                         
A02474 8500-EXIT.                                                       
A02474     EXIT.                                                        
AA2474*                                                                         
      *================================================================*        
DC     8600-UPDATE-BNKEFT.                                              
      *================================================================*        
T21711*PER ROBIN WATFORD,SETTING REQSTED_DRAFT_DAY TO SPACES IS CORRECT         
           EXEC SQL                                                     
               UPDATE CSS_BANK_EFT                                      
               SET    DRAFT_CYCLE = :BE-DRAFT-CYCLE,                    
                      REQSTED_DRAFT_DAY = '  '                          
               WHERE   ACCOUNT_NO = :BE-ACCOUNT-NO                      
A02474                                                      
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                             
MFA-TR*        UPDATE CSS_BANK_EFT                                              
MFA-TR*        SET    DRAFT_CYCLE = :BE-DRAFT-CYCLE,                            
MFA-TR*               REQSTED_DRAFT_DAY = '  '                                  
MFA-TR*        WHERE   ACCOUNT_NO = :BE-ACCOUNT-NO                              
MFA-TR*        QUERYNO 8600                                                     
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

           IF SQLCODE EQUAL SUCCESSFUL-CALL                             
T26307         ADD 1 TO WS-CHKP-UPD-COUNTER                             
T26307         ADD 1 TO WS-BE-UPDT-CNTR-LUW                             
           ELSE                                                         
               DISPLAY '8600-UPDATE-BNKEFT'                             
T21445         DISPLAY '** ACCOUNT_NO        = ' BE-ACCOUNT-NO          
               PERFORM 9900-SQL-ERROR-ROUTINE                           
      *                                                                         
           END-IF.                                                      
       8600-EXIT.                                                       
           EXIT.                                                        
      *                                                             **          
      *==============================================================*          
       8700-INSERT-COMM-DATA.                                           
      *==============================================================*          
      *                                                                         
T28610     EXEC SQL                                                     
T28610        INSERT INTO CSS_COMM_DATA                                 
T28610             ( COMMUNICATION_ID,                                  
T28610               ACCOUNT_NO,                                        
T28610               CUSTOMER_NO,                                       
T28610               PREMISE_NO,                                        
T28610               COMPANY_NO,                                        
T28610               RED_FLAG_IND,                                      
T28610               RED_FLAG_EXPIRE_DT,                                
T28610               COMM_METHOD,                                       
T28610               COMM_DIRECTION,                                    
T28610               COMM_TYPE_CD,                                      
T28610               COMM_SUBTYPE_CODE,                                 
T28610               USER_ID_ORIG,                                      
T28610               CONTACT_NAME,                                      
T28610               PROMOTION_ID,                                      
T28610               PSC_COMPLIANCE_IND,                                
T28610               CALL_ORIGIN_ID,                                    
T28610               CALL_END_TIME,                                     
T28610               NUMBER_TRANSFERS,                                  
T28610               HOLD_TIME,                                         
T28610               QUEUE_TIME,                                        
T28610               SCREEN_POP_IND,                                    
T28610               TOTAL_CALL_TIME,                                   
T28610               INITIAL_COMMENT_TX,                                
T28610               RESPONSE_REASON_CD,                                
T28610               RESPONSE_TYPE_CD,                                  
T28610               SOLICITATION_CD,                                   
T28610               COMM_ASSOC_CD,                                     
T28610               COMPLAINT_FL,                                      
T28610               DISCOVERY_MTHD_CD,                                 
T28610               PREV_MARKETER_CD)                                  
T28610        VALUES                                                    
T28610             (CIS.CURRENT$TIMESTAMP(),                                  
T28610              :KO-ACCOUNT-NO,                                     
T28610              :KO-CUSTOMER-NO,                                    
T28610              :KO-PREMISE-NO,                                     
T28610              :KO-COMPANY-NO,                                     
T28610              :KO-RED-FLAG-IND,                                   
T28610              CIS.CHAR2TIMESTAMP(:KO-RED-FLAG-EXPIRE-DT 
                                       :WS-RED-FL-NULL-IND),          
T28610              :KO-COMM-METHOD,                                    
T28610              :KO-COMM-DIRECTION,                                 
T28610              :KO-COMM-TYPE-CD,                                   
T28610              :KO-COMM-SUBTYPE-CODE,                              
T28610              :KO-USER-ID-ORIG,                                   
T28610              :KO-CONTACT-NAME,                                   
T28610              :KO-PROMOTION-ID,                                   
T28610              :KO-PSC-COMPLIANCE-IND,                             
T28610              :KO-CALL-ORIGIN-ID,                                 
T28610              CIS.CHAR2TIMESTAMP(:KO-CALL-END-TIME 
                                       :WS-END-NULL-IND),                  
T28610              :KO-NUMBER-TRANSFERS,                               
T28610              :KO-HOLD-TIME,                                      
T28610              :KO-QUEUE-TIME,                                     
T28610              :KO-SCREEN-POP-IND,                                 
T28610              :KO-TOTAL-CALL-TIME,                                
T28610              :KO-INITIAL-COMMENT-TX,                             
T28610              :KO-RESPONSE-REASON-CD,                             
T28610              :KO-RESPONSE-TYPE-CD,                               
T28610              :KO-SOLICITATION-CD,                                
T28610              :KO-COMM-ASSOC-CD,                                  
T28610              :KO-COMPLAINT-FL,                                   
T28610              :KO-DISCOVERY-MTHD-CD,                              
T28610              :KO-PREV-MARKETER-CD)                               
T28610     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ054
MFA-TR*    EXEC SQL                                                             
MFA-TR*       INSERT INTO CSS_COMM_DATA                                         
MFA-TR*            ( COMMUNICATION_ID,                                          
MFA-TR*              ACCOUNT_NO,                                                
MFA-TR*              CUSTOMER_NO,                                               
MFA-TR*              PREMISE_NO,                                                
MFA-TR*              COMPANY_NO,                                                
MFA-TR*              RED_FLAG_IND,                                              
MFA-TR*              RED_FLAG_EXPIRE_DT,                                        
MFA-TR*              COMM_METHOD,                                               
MFA-TR*              COMM_DIRECTION,                                            
MFA-TR*              COMM_TYPE_CD,                                              
MFA-TR*              COMM_SUBTYPE_CODE,                                         
MFA-TR*              USER_ID_ORIG,                                              
MFA-TR*              CONTACT_NAME,                                              
MFA-TR*              PROMOTION_ID,                                              
MFA-TR*              PSC_COMPLIANCE_IND,                                        
MFA-TR*              CALL_ORIGIN_ID,                                            
MFA-TR*              CALL_END_TIME,                                             
MFA-TR*              NUMBER_TRANSFERS,                                          
MFA-TR*              HOLD_TIME,                                                 
MFA-TR*              QUEUE_TIME,                                                
MFA-TR*              SCREEN_POP_IND,                                            
MFA-TR*              TOTAL_CALL_TIME,                                           
MFA-TR*              INITIAL_COMMENT_TX,                                        
MFA-TR*              RESPONSE_REASON_CD,                                        
MFA-TR*              RESPONSE_TYPE_CD,                                          
MFA-TR*              SOLICITATION_CD,                                           
MFA-TR*              COMM_ASSOC_CD,                                             
MFA-TR*              COMPLAINT_FL,                                              
MFA-TR*              DISCOVERY_MTHD_CD,                                         
MFA-TR*              PREV_MARKETER_CD)                                          
MFA-TR*       VALUES                                                            
MFA-TR*            (CURRENT TIMESTAMP,                                          
MFA-TR*             :KO-ACCOUNT-NO,                                             
MFA-TR*             :KO-CUSTOMER-NO,                                            
MFA-TR*             :KO-PREMISE-NO,                                             
MFA-TR*             :KO-COMPANY-NO,                                             
MFA-TR*             :KO-RED-FLAG-IND,                                           
MFA-TR*             :KO-RED-FLAG-EXPIRE-DT:WS-RED-FL-NULL-IND,                  
MFA-TR*             :KO-COMM-METHOD,                                            
MFA-TR*             :KO-COMM-DIRECTION,                                         
MFA-TR*             :KO-COMM-TYPE-CD,                                           
MFA-TR*             :KO-COMM-SUBTYPE-CODE,                                      
MFA-TR*             :KO-USER-ID-ORIG,                                           
MFA-TR*             :KO-CONTACT-NAME,                                           
MFA-TR*             :KO-PROMOTION-ID,                                           
MFA-TR*             :KO-PSC-COMPLIANCE-IND,                                     
MFA-TR*             :KO-CALL-ORIGIN-ID,                                         
MFA-TR*             :KO-CALL-END-TIME:WS-END-NULL-IND,                          
MFA-TR*             :KO-NUMBER-TRANSFERS,                                       
MFA-TR*             :KO-HOLD-TIME,                                              
MFA-TR*             :KO-QUEUE-TIME,                                             
MFA-TR*             :KO-SCREEN-POP-IND,                                         
MFA-TR*             :KO-TOTAL-CALL-TIME,                                        
MFA-TR*             :KO-INITIAL-COMMENT-TX,                                     
MFA-TR*             :KO-RESPONSE-REASON-CD,                                     
MFA-TR*             :KO-RESPONSE-TYPE-CD,                                       
MFA-TR*             :KO-SOLICITATION-CD,                                        
MFA-TR*             :KO-COMM-ASSOC-CD,                                          
MFA-TR*             :KO-COMPLAINT-FL,                                           
MFA-TR*             :KO-DISCOVERY-MTHD-CD,                                      
MFA-TR*             :KO-PREV-MARKETER-CD)                                       
MFA-TR*    END-EXEC.                                                            

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

      *                                                                         
           MOVE SQLCODE                TO WS-ACTIVE-RETURN-CODE.        
      *                                                                         
           EVALUATE WS-ACTIVE-RETURN-CODE                               
              WHEN SUCCESSFUL-CALL                                      
                 COMPUTE WS-CHKP-UPD-COUNTER = WS-CHKP-UPD-COUNTER + 1  
                 COMPUTE WS-CQ-ISRT-CNTR-LUW = WS-CQ-ISRT-CNTR-LUW + 1  
                 MOVE WS-COMM-RETRY-COUNT  TO WS-COMM-SUB               
              WHEN -803                                                 
                 COMPUTE WS-COMM-SUB = WS-COMM-SUB + 1                  
              WHEN OTHER                                                
                 DISPLAY '*************************************'        
                 DISPLAY '* 8700-INSERT-COMM-DATA'                      
                 DISPLAY '* CUSTOMER_NO = ' AT-CUSTOMER-NO              
                 DISPLAY '* ACCOUNT_NO  = ' AT-ACCOUNT-NO               
                 DISPLAY '* SQL RETURN CODE = ' SQLCODE                 
                 DISPLAY '*************************************'        
                 PERFORM 9900-ABEND                THRU 9900-EXIT       
           END-EVALUATE.                                                
      *                                                                         
       8700-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
T26307 8898-ISSUE-CHKP.                                                 
T26307     MOVE '8898' TO ACTIVE-PARAGRAPH.                             
T26307     IF WS-CHKP-LUW-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS       
T26307       AND WS-CHKP-UPD-LIMIT EQUAL WS-FLAG-TO-TURN-OFF-COMMITS    
T26307         GO TO 8898-EXIT
           END-IF.                                         
T26307     ADD 1                       TO WS-CHKP-SEQ-NO.               
T26307*                                                                         
T26307     EXEC SQL                                                             
T26307         INCLUDE CPD00047                                                 
T26307     END-EXEC.                                                            
T26307*                                                                         
T26307     DISPLAY 'COMMIT POINT # ' WS-CHKP-SEQ-NO ' TAKEN '           
T26307             '@ ACCOUNT # ' WS-COMMIT-ACCT-NO                     
T26307     MOVE ZERO TO WS-CHKP-LUW-COUNTER                             
T26307                  WS-CHKP-UPD-COUNTER.                            
T26307 8898-EXIT.                                                       
T26307     EXIT.                                                        
T26307*                                                                         
A03792*================================================================*        
A03792 8950-WRITE-FCSCA47.                                              
A03792*================================================================*        
A03792                                                                  
A03792      WRITE FIOCA47-RECORD                                        
A03792*                                                                         
A03792      IF FCA47-SUCCESSFUL                                         
A03792         CONTINUE                                                 
A03792      ELSE                                                        
A03792          DISPLAY '********************************************'  
A03792          DISPLAY '8950-ERROR ON FCSCA47 WRITE.  STATUS IS '      
A03792               WS-FCA47-STATUS                                    
A03792          DISPLAY '********************************************'  
A03792          PERFORM 9900-ABEND THRU 9900-EXIT                       
A03792      END-IF.                                                     
A03792*                                                                         
A03792 8950-EXIT.                                                       
A03792     EXIT.                                                        
A03792*                                                                         
      ****************************************************************          
      ** 8895-INSERT-WORK-QUEUE                                     **          
A04860**  CALL SUB PROGRAM SCSCB077 FOR INSERTING WORK QUEUES INTO  **  28610000
A04860**  CSS_WQ_ITEMS                                              **  28620000
      ****************************************************************          
      *                                                                         
A04860 8895-INSERT-WORK-QUEUE.                                          
A04860                                                                  
A04860     CALL SCSCB077  USING   CWS00077-FIELDS,                      
A04860                            ABEND-FILE,                           
A04860                            RS-RETURN-CODE.                       
A04860*                                                                         
A04860     MOVE RS-RETURN-CODE          TO WS-ACTIVE-RETURN-CODE.       
A04860                                                                  
A04860     IF ABEND-FUNCTION > SPACES OR RS-RETURN-CODE NOT = 0         
A04860        MOVE WS-PGRMNAME          TO ABEND-PROGRAM                
A04860        DISPLAY '8895-INSERT-WORK-QUEUE'                          
A04860        DISPLAY 'CALL SCSCB077         '                          
A04860        DISPLAY 'ACCOUNT_NO      ' WS-77-ACCOUNT-NO               
A04860        DISPLAY 'PREMISE_NO      ' WS-77-PREMISE-NO               
A04860        DISPLAY 'SERV_ORDER_NO   ' WS-77-SERV-ORDER-NO            
A04860        DISPLAY 'COMMENTS        ' WS-77-COMMENTS                 
A04860        DISPLAY 'SQL RETURN CODE ' WS-ACTIVE-RETURN-CODE          
A04860        PERFORM 9900-ABEND    THRU 9900-EXIT                      
A04860     END-IF.                                                      
A04860                                                                  
A04860 8895-EXIT.                                                       
A04860     EXIT.                                                        
A04860                                                                  
      *                                                                         
A00765****************************************************************          
A00765* 9000-SEND-ERROR-RESULT. REQUIRED BY THE COPYBOOK             *          
A00765****************************************************************          
A00765 9000-SEND-ERROR-RESULT.                                          
A00765                                                                  
A00765     GO TO 9000-EXIT.                                             
A00765*                                                                         
      ****************************************************************          
      **                                                            **          
      **  9000-TERMINATE                                            **          
      **                                                            **          
      ****************************************************************          
       9000-TERMINATE.                                                  
      *                                                                         
           CLOSE FCSCA44-FILE,                                          
A03792           FCSPT32-FILE                                           
A03792           FCSCA47-FILE.                                          
      *                                                                         
       9000-EXIT.                                                       
           EXIT.                                                        
      *                                                                         
      ****************************************************************          
TP5109**  9700-PROCESS-ABEND.                                       **          
      ****************************************************************          
TP5109 COPY CPD0023B.                                                           
      *                                                                         
      ****************************************************************          
      **                                                            **          
      **  9900-SQL-ERROR-ROUTINE                                    **          
      **                                                            **          
      ****************************************************************          
       9900-SQL-ERROR-ROUTINE.                                          
      *                                                                         
           MOVE SQLCODE                TO WS-DISPLAY-SQLCODE.           
           DISPLAY ' '                                                  
           DISPLAY '**********************************************'     
           DISPLAY '***** 9900-SQL-ERROR-ROUTINE            ******'     
           DISPLAY '**********************************************'     
           DISPLAY ' '                                                  
           DISPLAY 'SQLCODE = ' WS-DISPLAY-SQLCODE                      
           DISPLAY ABEND-RECORD-1-DATA                                  
           DISPLAY ABEND-RECORD-2-DATA                                  
           DISPLAY ABEND-RECORD-3-DATA                                  
           DISPLAY '**********************************************'.    
           PERFORM 9900-ABEND                    THRU 9900-EXIT.        
      *                                                                         
           EXEC SQL                                                             
               INCLUDE CPD09900                                                 
           END-EXEC.                                                            
      *                                                                         
