       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.    CSR02380.                                         
COB303 DATE-WRITTEN.      FEBRUARY 20, 1995                             
       DATE-COMPILED.                                                   
                                                                        
CVT000******************************************************************00060000
CVT000*     - - - - - >   R P C   C O N V E R S I O N   < - - - - -    *00070000
CVT000*         S380 CONVERTED TO DB2 SP CSR02380 ON 10/23/2007        *00080000
CVT000*             -NOTE: AUTOMATED CONVERSION PROGRAM USED           *00090000
CVT000*                                                                *00100000
CVT000*                    CVT000 - CONVERTED CODE                     *00110000
CVT000*                    CVT004 - NEEDED REVIEW                      *00120000
CVT000*                    CVT999 - COMMENTED OUT CODE THAT CAN        *00130000
CVT000*                             POTENTIALLY BE DELETED             *00140000
CVT000*                                                                *00150000
CVT000******************************************************************00160000
      ******************************************************************00170000
      *                                                                *00180000
      *                SOUTH CAROLINA ELECTRIC & GAS                   *00190000
      *                                                                *00200000
      *  THIS PROGRAM IS EXECUTED VIA A REMOTE PROCEDURE CALL (RPC).   *00210000
      *                                                                *00220000
      *  TRANID:        S380                                           *00230000
      *  PROGRAM:       S380                                           *00240000
      *  CALLING SP:    PA_S380                                        *00250000
      *                                                                *00260000
      ******************************************************************00270000
      *                 P R O G R A M  S U M M A R Y                   *00280000
      *                                                                *00290000
      *  THIS PROGRAM CREATES A NEW PREMISE, CUSTOMER, AND PENDING     *00300000
      *  ACCOUNT.  IT THEN CREATES A NEW RECORD IN CSS_MKT_XREF_ACCT,  *00310002
      *  INSERTS INTO CSS_MKT_TRAN_INFO, AND OVER AN OPEN CLIENT       *00320000
      *  CONNECTION TO SYBASE, INITIATES A NEW SERVICE ORDER.          *00330000
      *                                                                *00340000
      ******************************************************************00350000
      *                                                                *00360000
      *                     PROGRAM MODIFICATION LOG                   *00370000
      *                                                                *00380000
      *    DATE    INITIALS   COMMENTS                                 *00390000
      *  --------  --------   ---------------------------------------  *00400000
      *  03/03/99    AMG      PROCEDURE ORIGINALLY CODED.              *00410000
      *  06/22/99    AMG      TPR 19795 : PASS REQUESTER INFO TO       *00420000
      *                       pd_D0000440 SO THAT IT MAY POPULATE      *00430000
      *                       NECESSARY SERVICE ORDER FIELDS           *00440000
ACN   *  07/12/99    AMG      ACN CHANGES:                             *00450000
ACN   *                       - INSERT DEFAULT RATE INTO MKT_XREF_ACCT *00460000
ACN   *                         FOR A MASTER ACCOUNT                   *00470000
ACN   *                       - ACCEPT LANDLORD ACCT NO AS A PARM SO   *00480000
ACN   *                         THAT WE CAN GET IT'S RATE FROM         *00490000
ACN   *                         MKT_XREF_ACCT AND PUT IT THERE FOR THE *00500000
ACN   *                         NEWLY CREATED SUB ACCOUNT              *00510000
ACN   *                       - ADDED PARM-LL-FREEFORM-ADDR SO THAT    *00520000
ACN   *                         A WQ CAN BE CREATED TO NOTIFY THAT     *00530000
ACN   *                         THE PREMISE ID MUST BE UPDATED (SINCE  *00540000
ACN   *                         THERE IS NO WAY TO AUTOMATICALLY       *00550000
ACN   *                         TRANSLATE AN ACN AGREEMENT FREEFORM    *00560000
ACN   *                         ADDRESS INTO A CIS FORMATTED ADDRESS)  *00570000
      *  08/18/99    AMG      MODIFIED 8500 PARA TO FIRST CHECK FOR    *00580000
      *                       EXISTENCE OF ROW IN CSS_MKT_XREF_ACCT    *00590000
      *                       FOR DIST_ACCT_NO.  IF THERE IS, THEN     *00600000
      *                       ERROR OUT, ROLLBACK, RETURN +1 TO PB.    *00610000
      *  09/09/99    AMG      REMOVED CHECK (ABOVE) FROM 8500 AND ADDED*00620000
      *                       8575, WHICH IS CALLED AT THE BEGINNING OF*00630000
      *                       2200.  DUPLICATES FAIL MUCH FASTER NOW.  *00640000
      *  01/10/00    WMG      MODIFIED FOR THE CUSTOMER SIGN-UP WEB    *00650000
      *                       PAGE.  THIS ALSO INCLUDES A WQ CATEOGORY *00660000
      *                       CHANGE FROM 160 TO 178 FOR TPR 21950.    *00670000
      *  11/10/01    MJG      ADDED THE DCLGEN FOR THE DELINQUENCY     *00680000
      *                       TABLE BECAUSE IT IS NEEDED IN CPD0054A   *00690000
C26959*  11/20/02    FMB      INCLUDE CSS_REG_PROFILE FOR SEBR         *00700000
C27914*  11/20/02    FMB      SWITCH FROM CODE-1 TO FINALIST           *00710000
C27329*  12/30/02    RR       INCLUDE CSS_PREM_DLVRY_PT FOR CHANGES TO *00720000
      *                       CPD0037A                                 *00730000
C30122*  02/02/04    RR       ADD ORIG CD TO INPUT PARMS AND INSERT    *00740000
C30122*                       MKT_XREF_ACCT                            *00750000
C29943*  04/14/04    FMB      DELETE FROM CSS_SEB_MIA_XREF WHEN        *00760000
C29943*                       DELETING CUSTOMER.                       *00770000
C30135*  08/12/04    FMB      ADD FRANCHISE FEE PROCESSING.            *00780000
C30677*  11/24/04    RR       ADD INCLUDE FOR WQ ITEMS AND CPD00055    *00790000
C31822*  02/08/05    FMB      DEFAULT CITY GATE FOR PSNC.              *00800000
C31822*  03/07/05    FMB      WQ IF REVENUE DISTRICT CHANGES FOR       *00810000
C31822*                       PENDING ACCOUNT.                         *00820000
C30695*  05/09/05    FMB      WQ IF SUBDIVISION CHANGES.               *00830000
C33702*  09/26/06    MSR      UPDATE READ CYCLE WHEN READ ROUTE IS     *00840000
C33702*                       CHANGED.                                 *00850000
REARCH*  03/21/07   PA        ADDED CODE TO REMOVE SYBASE SP CALLS     *00860000
REARCH*                       CONVERT SYBASE GATEWAY TO DB2  CALLS     *00870000
C36267*  08/30/07    SC       REPLACE DECLARATION OF CSS_ST_CNTY_SUBDIV*00880000
C36267*                       WITH CSS_ZIPCODE_SUBDIV*                  00890000
C36115*  12/06/07    FB       CONVERT TO STORED PROCEDURE.             *00900000
C36115*  12/06/07    ACC3     CALL CICS FINALIST INSTEAD OF BATCH.     *00910000
C34569*  01/30/08    SS       SEB RATE RE-ARCH; INSERT ROWS TO CRM     *00920000
C34569*                       FIXED FACTOR AND UTIL ENV TABLES FOR     *00930000
C34569*                       UNSOLICITED ORIS                         *00940000
A37303*  06/09/09    SS       REMOVE ALL REFERENCES TO TABLE           *00950000
A37303*                       CSS_UTIL_XREF_ACCT SO IT MAY BE DELETED  *00960000
A01727*  08/31/09    FMB      NEW FINALIST RELEASE.                    *00970000
P00269*  02/04/10    MN90523  INCLUDED OFFER_OPT_START_DT AND          *00980000
P00269*                       OFFER_OPT_END_DT                         *00990000
A01088*  04/29/10    FMB      REMOVE DCLGEN FOR CSS_PREM_DLVRY_PT.     *01000000
P00473*  09/16/11    DB18339  MODERNIZATION CHANGES TO PARA 8605.      *01010000
A04473*  05/21/13    FMB      NEW FINALIST RELEASE.                    *01020000
P00778*  06/26/13    SC41135  SEB REUSE PREMISE CHANGES.               *01030000
ACT109*  05/20/15    RS7M249  DELETE UNUSED COPYBOOK(S).               *01040000
ACT313*  06/30/15    SS7F226  DELETE UNUSED COPYBOOK(S).               *01050000
ACT313*              A04480                                            *01060005
ACT009*  01/19/15    MS7M727  REMOVED UNUSED COPYBOOK                  *01061005
      *              A05460                                            *01061006
ACT106*  04/07/16    TP7R341  WORK QUEUE CHANGE TO REPLACE THE         *01061007
ACT106*              A04860   CSS_WQ_ITEMS_MF WITH CSS_WQ_ITEMS        *01061008
      ******************************************************************01070000
      *                                                                *01080000
      *                ---- BASIC SEQUENCE STRUCTURE ----              *01090000
      *                                                                *01100000
      *  0000 - 0999  MAIN CONTROL PATH AND INITIALIZATION             *01110000
      *  1000 - 1999  INPUT PROCESSING CONTROL PATH                    *01120000
      *  2000 - 2999  OUTPUT PROCESSING CONTROL PATH                   *01130000
      *  3000 - 4999  NOT USED                                         *01140000
      *  5000 - 5999  COMMON PROGRAM MODULES                           *01150000
      *  6000 - 6999  COMMON SYSTEM MODULES                            *01160000
      *  7000 - 7999  INPUT MODULES                                    *01170000
      *  8000 - 8999  OUTPUT MODULES                                   *01180000
      *  9000 - 9999  TERMINATION, ABEND, MESSAGING MODULES            *01190000
      *                                                                *01200000
      ******************************************************************01210000
                                                                        
       ENVIRONMENT DIVISION.                                            
       DATA DIVISION.                                                   
                                                                        
       WORKING-STORAGE SECTION.                                         

MSQ001     EXEC SQL
MSQ001      INCLUDE SQLDA
MSQ001     END-EXEC
MSQ001 01 MSQ001-SQLCABACK PIC X(136).
MSQ002  01 MFA-CSRERLOG.
MSQ002    05 ARG-5 PIC X(255).
MSQ002    05 ARG-6 PIC X(255).
MSQ002    05 ARG-7 PIC X(447).

MSQ017 01 MFA-PROGRAM-ID PIC X(8) VALUE 'CSR02380'.
MSQ017     COPY MFASQLM.
       01  WS-START                           PIC X(40) VALUE           
           'WORKING STORAGE FOR RPC S380 STARTS HERE'.                  
                                                                        
      ******************************************************************01300000
      * INCLUDE CSS_ADDR_FORMATTED                                      01310000
      ******************************************************************01320000
           EXEC SQL                                                     01330002
              INCLUDE TBADRFMT                                          01340002
           END-EXEC.                                                    01350002
                                                                        
ACT106******************************************************************01370000
ACT106* INCLUDE CSS_WQ_ITEMS_MF, WF                                     01380000
ACT106******************************************************************01390000
ACT106*    EXEC SQL                                                     01400002
ACT106*       INCLUDE TBMFWQ                                            01410002
ACT106*    END-EXEC.                                                    01420002
                                                                        
C30677******************************************************************01440000
C30677* INCLUDE CSS_WQ_ITEMS                                            01450000
C30677******************************************************************01460000
C30677     EXEC SQL                                                     01470002
C30677        INCLUDE TBWQITS                                           01480002
C30677     END-EXEC.                                                    01490002
                                                                        
      ******************************************************************01510000
      * INCLUDE CSS_ACCOUNT                                             01520000
      ******************************************************************01530000
           EXEC SQL                                                     01540002
              INCLUDE TBACCT                                            01550002
           END-EXEC.                                                    01560002
                                                                        
      ******************************************************************01580000
      * INCLUDE CSS_ADDR_ID_CNTL                                        01590000
      ******************************************************************01600000
           EXEC SQL                                                     01610002
              INCLUDE TBADDRID                                          01620002
           END-EXEC.                                                    01630002
                                                                        
      ******************************************************************01650000
      * INCLUDE CSS_ZIP_CODE                                            01660000
      ******************************************************************01670000
           EXEC SQL                                                     01680002
              INCLUDE TBZIPCD                                           01690002
           END-EXEC.                                                    01700002
                                                                        
      ******************************************************************01720000
      * INCLUDE CSS_PREM_NO_CNTL                                        01730000
      ******************************************************************01740000
           EXEC SQL                                                     01750002
              INCLUDE TBPRCNTL                                          01760002
           END-EXEC.                                                    01770002
                                                                        
      ******************************************************************01790000
      * INCLUDE CSS_PREMISE, PR                                         01800000
      ******************************************************************01810000
           EXEC SQL                                                     01820002
              INCLUDE TBPREM                                            01830002
           END-EXEC.                                                    01840002
                                                                        
      ******************************************************************01860000
      * INCLUDE CSS_MNT_TRANS_HIST, MH                                  01870000
      ******************************************************************01880000
           EXEC SQL                                                     01890002
              INCLUDE TBMNHIST                                          01900002
           END-EXEC.                                                    01910002
                                                                        
      ******************************************************************01930000
      * INCLUDE CSS_MT_TRN_HST_DET, MI                                  01940000
      ******************************************************************01950000
           EXEC SQL                                                     01960002
              INCLUDE TBMNHDT                                           01970002
           END-EXEC.                                                    01980002
                                                                        
      ******************************************************************02000000
      * INCLUDE CSS_REV_DISTRICT, A9                                    02010000
      ******************************************************************02020000
           EXEC SQL                                                     02030002
              INCLUDE TBRVDST                                           02040002
           END-EXEC.                                                    02050002
                                                                        
      ******************************************************************02070000
      * INCLUDE CSS_SUBDIVISION, B0                                     02080000
      ******************************************************************02090000
           EXEC SQL                                                     02100002
              INCLUDE TBSUBDVN                                          02110002
           END-EXEC.                                                    02120002
                                                                        
      ******************************************************************02140000
      * INCLUDE CSS_LOCAL_OFFICE, B1                                    02150000
      ******************************************************************02160000
           EXEC SQL                                                     02170002
              INCLUDE TBLOCOFC                                          02180002
           END-EXEC.                                                    02190002
                                                                        
      ******************************************************************02210000
      * INCLUDE CSS_MKT_TRAN_INFO, TL                                   02220000
      ******************************************************************02230000
           EXEC SQL                                                     02240002
              INCLUDE TBMRKINF                                          02250002
           END-EXEC.                                                    02260002
                                                                        
      ******************************************************************02280000
      * INCLUDE CSS_MKT_XREF_ACCOUNT, XM                                02290000
      ******************************************************************02300000
           EXEC SQL                                                     02310002
              INCLUDE TBMRKXR                                           02320002
           END-EXEC.                                                    02330002
                                                                        
      ******************************************************************02350000
      * INCLUDE CSS_STATE_COUNTY, SC                                    02360000
      ******************************************************************02370000
           EXEC SQL                                                     02380002
              INCLUDE TBSTCNTY                                          02390002
           END-EXEC.                                                    02400002
                                                                        
      ******************************************************************02420000
      * INCLUDE CSS_CREDIT_PROFILE, CZ                                  02430000
      ******************************************************************02440000
           EXEC SQL                                                     02450002
              INCLUDE TBCRPROF                                          02460002
           END-EXEC.                                                    02470002
                                                                        
      ******************************************************************02490000
      * INCLUDE CSS_LANDLORD, SI                                        02500000
      ******************************************************************02510000
      *    EXEC SQL                                                     02520002
      *       INCLUDE TBLNDLRD                                          02530002
      *    END-EXEC.                                                    02540002
      *                                                                 02550002
      ******************************************************************02560000
      * INCLUDE CSS_CUST_PREM_HIST, CH                                  02570000
      ******************************************************************02580000
T12968     EXEC SQL                                                     02590002
T12968        INCLUDE TBCSTPRM                                          02600002
T12968     END-EXEC.                                                    02610002
                                                                        
      *---< CSS_ACCT_NO_CNTL >                                          02630000
           EXEC SQL                                                     02640002
              INCLUDE TBATCNTL                                          02650002
           END-EXEC.                                                    02660002
                                                                        
ONERAT**** CSS_DELINQUENCY ***                                          02680000
ONERAT     EXEC SQL                                                     02690002
ONERAT        INCLUDE TBDELQ                                            02700002
ONERAT     END-EXEC.                                                    02710002
                                                                        
           EXEC SQL                                                     02730002
              INCLUDE TBNMACTX                                          02740002
           END-EXEC.                                                    02750002
                                                                        
           EXEC SQL                                                     02770002
              INCLUDE TBUSRPRF                                          02780002
           END-EXEC.                                                    02790002
                                                                        
           EXEC SQL                                                     02810002
              INCLUDE TBCUST                                            02820002
           END-EXEC.                                                    02830002
                                                                        
           EXEC SQL                                                     02850002
              INCLUDE TBCSTSTS                                          02860002
           END-EXEC.                                                    02870002
                                                                        
           EXEC SQL                                                     02890002
              INCLUDE TBBSCSTS                                          02900002
           END-EXEC.                                                    02910002
                                                                        
           EXEC SQL                                                     02930002
              INCLUDE TBCSTPHN                                          02940002
           END-EXEC.                                                    02950002
                                                                        
           EXEC SQL                                                     02970002
              INCLUDE TBCSTMSC                                          02980002
           END-EXEC.                                                    02990002
                                                                        
           EXEC SQL                                                     03010002
              INCLUDE TBNAME                                            03020002
           END-EXEC.                                                    03030002
                                                                        
           EXEC SQL                                                     03050002
              INCLUDE TBCNTCCS                                          03060002
           END-EXEC.                                                    03070002
                                                                        
           EXEC SQL                                                     03090002
              INCLUDE TBCNTACT                                          03100002
           END-EXEC.                                                    03110002
                                                                        
           EXEC SQL                                                     03130002
              INCLUDE TBCSADRX                                          03140002
           END-EXEC.                                                    03150002
                                                                        
           EXEC SQL                                                     03170002
              INCLUDE TBADRFRE                                          03180002
           END-EXEC.                                                    03190002
                                                                        
           EXEC SQL                                                     03210002
              INCLUDE SQLCA                                             03220002
           END-EXEC.                                                    03230002
                                                                        
           EXEC SQL                                                     03250002
              INCLUDE TBMODEL                                           03260002
           END-EXEC.                                                    03270002
                                                                        
           EXEC SQL                                                     03290002
              INCLUDE TBNAMEID                                          03300002
           END-EXEC.                                                    03310002
                                                                        
           EXEC SQL                                                     03330002
              INCLUDE TBCSTCTL                                          03340002
           END-EXEC.                                                    03350002
                                                                        
           EXEC SQL                                                     03370002
              INCLUDE TBLORVDT                                          03380002
           END-EXEC.                                                    03390002
                                                                        
           EXEC SQL                                                     03410002
              INCLUDE TBUTLENV                                          03420002
           END-EXEC.                                                    03430002
                                                                        
           EXEC SQL                                                     03450002
              INCLUDE TBCITGT                                           03460002
           END-EXEC.                                                    03470002
                                                                        
           EXEC SQL                                                     03490002
              INCLUDE TBSODAT                                           03500002
           END-EXEC.                                                    03510002
                                                                        
C26959     EXEC SQL                                                     03650002
C26959        INCLUDE TBREGPRF                                          03660002
C26959     END-EXEC.                                                    03670002
                                                                        
T27707     EXEC SQL                                                     03690002
T27707        INCLUDE TBPWDHNT                                          03700002
T27707     END-EXEC.                                                    03710002
                                                                        
T27707     EXEC SQL                                                     03730002
T27707        INCLUDE TBCSTEML                                          03740002
T27707     END-EXEC.                                                    03750002
                                                                        
      ******************************************************************03810000
      * INCLUDE CSS_JOB_PARM, G6                                        03820000
      ******************************************************************03830000
C30135     EXEC SQL                                                     03840002
C30135        INCLUDE TBJBPARM                                          03850002
C30135     END-EXEC.                                                    03860002
                                                                        
C30135     EXEC SQL                                                     03880002
C30135        INCLUDE TBTXCNTL                                          03890002
C30135     END-EXEC.                                                    03900002
                                                                        
C30135     EXEC SQL                                                     03920002
C30135        INCLUDE TBTXRATE                                          03930002
C30135     END-EXEC.                                                    03940002
                                                                        
C30135     EXEC SQL                                                     03960002
C30135        INCLUDE TBTXUSE                                           03970002
C30135     END-EXEC.                                                    03980002
                                                                        
C30135     EXEC SQL                                                     04000002
C30135        INCLUDE TBFRNCRD                                          04010002
C30135     END-EXEC.                                                    04020002
                                                                        
C30135     EXEC SQL                                                     04040002
C30135        INCLUDE TBSBLMSG                                          04050002
C30135     END-EXEC.                                                    04060002
                                                                        
C30695     EXEC SQL                                                     04080002
C30695        INCLUDE TBUMPLAN                                          04090002
C30695     END-EXEC.                                                    04100002
                                                                        
C36267     EXEC SQL                                                     04160002
C36267        INCLUDE TBZIPSUB                                          04170002
C36267     END-EXEC.                                                    04180002
                                                                        
C33702******************************************************************04200000
C33702* INCLUDE CSS_LOC_OFF_CYC_RT                                      04210000
C33702******************************************************************04220000
C33702     EXEC SQL                                                     04230002
C33702        INCLUDE TBLCOFRT                                          04240002
C33702     END-EXEC.                                                    04250002
                                                                        
      ******************************************************************04270000
      * INCLUDE CRM_OFF_MKT_TIER, DU                                    04280000
      ******************************************************************04290000
C34569     EXEC SQL                                                     04300002
C34569        INCLUDE TBOFFMKT                                          04310002
C34569     END-EXEC.                                                    04320002
                                                                        
      ******************************************************************04340000
      * INCLUDE CRM_OFFER_OPTION, E9                                    04350000
      ******************************************************************04360000
C34569     EXEC SQL                                                     04370002
C34569        INCLUDE TBOFFOPT                                          04380002
C34569     END-EXEC.                                                    04390002
                                                                        
      ******************************************************************04410000
      * INCLUDE CSS_MKT_VAL_TRANS, V5                                   04420000
      ******************************************************************04430000
C34569     EXEC SQL                                                     04440002
C34569        INCLUDE TBMRKVLT                                          04450002
C34569     END-EXEC.                                                    04460002
                                                                        
           EXEC SQL                                                     04560002
              INCLUDE CWS0090A                                          04570002
           END-EXEC.                                                    04580002
                                                                        
           EXEC SQL                                                     04600002
              INCLUDE CWS0091A                                          04610002
           END-EXEC.                                                    04620002
                                                                        
           EXEC SQL                                                     04640002
              INCLUDE CWS0093A                                          04650002
           END-EXEC.                                                    04660002
                                                                        
           EXEC SQL                                                     04680002
              INCLUDE CWS00094                                          04690002
           END-EXEC.                                                    04700002
                                                                        
           EXEC SQL                                                     04720002
              INCLUDE CWS0126A                                          04730002
           END-EXEC.                                                    04740002
                                                                        
           EXEC SQL                                                     04760002
              INCLUDE CWS0037A                                          04770002
           END-EXEC.                                                    04780002
                                                                        
           EXEC SQL                                                     04800002
              INCLUDE CWS0203A                                          04810002
           END-EXEC.                                                    04820002
                                                                        
           EXEC SQL                                                     04840002
              INCLUDE CWS0054A                                          04850002
           END-EXEC.                                                    04860002
                                                                        
C30135     EXEC SQL                                                     04880002
C30135        INCLUDE CWS0037F                                          04890002
C30135     END-EXEC.                                                    04900002
                                                                        
C30677     EXEC SQL                                                     04920002
C30677        INCLUDE CWS00099                                          04930002
C30677     END-EXEC.                                                    04940002
                                                                        
ACT106     EXEC SQL                                                     04950100
ACT106        INCLUDE CWS00077                                          04950200
ACT106     END-EXEC.                                                    04950300
                                                                        
                                                                        
      ******************************************************************04970000
      *    COBOL WORKING STORAGE COPY BOOKS                            *04980000
      ******************************************************************04990000
           COPY CWS00011.                                               05010002
           COPY CWS00019.                                               05020002
           COPY CWS00056.                                               05040002
           COPY CWS00303.                                               05050002
C34569     COPY CWS00326.                                               05060002
                                                                        
REARCH     COPY CCA00004.                                               05110002
                                                                        
                                                                        
      ******************************************************************05140000
      *    WORK AREAS                                                  *05150000
      ******************************************************************05160000
                                                                        
       01  WS-MISC.                                                     
           05  PROGRAM-NAME             PIC X(08) VALUE 'S380    '.     
           05  WS-EMPTY-DATE            PIC X(10) VALUE '0000-00-00'.   
           05  WS-SYSTEM                PIC X(07) VALUE 'SYSTEM '.      
           05  WS-INSERT                PIC X(01) VALUE 'I'.            
           05  WS-UPDATE                PIC X(01) VALUE 'U'.            
           05  WS-MKSW-CODE             PIC X(04) VALUE 'MKSW'.         
           05  WS-FORMATTED-ADDRESS     PIC X(01) VALUE 'F'.            
           05  WS-COMMENT-LEN-203       PIC X(04) VALUE '0   '.         
           05  WS-COMPANY-NO            PIC X(02) VALUE '01'.           
           05  WS-MASTER                PIC X(01) VALUE 'M'.            
           05  WS-MONTHLY               PIC X(03) VALUE 'M01'.          
           05  WS-CYCLE-21              PIC X(02) VALUE '21'.           
AMG        05  WS-CHECK-XREF-ACCT       PIC X(01) VALUE 'N'.            
AMG        05  WS-XREF-ROW-EXISTS       PIC S9(9) COMP VALUE +1.        
           05  WS-SEB-ROW-EXISTS        PIC S9(9) COMP VALUE +2.        
ACN        05  WS-DEFAULT-RATE-SCHED    PIC X(03) VALUE 'ACN'.          
ACN        05  WS-MASTER-RATE-SCHED     PIC X(03) VALUE SPACES.         
ACN        05  WS-HIGH-PRIORITY         PIC X(01) VALUE 'H'.            
ACN        05  WS-LINE-1                PIC X(48) VALUE                 
ACN            'GO TO PREMISE INFORMATION (PANEL077) AND UPDATE '.      
ACN        05  WS-LINE-2                PIC X(46) VALUE                 
ACN            'FREEFORM INFORMATION INTO FORMATTED ADDRESS.  '.        
ACN        05  WS-LINE-3                PIC X(50) VALUE                 
ACN            'ADDRESS ON ACN AGREEMENT IS AS FOLLOWS:  (LINE 1) '.    
ACN        05  WS-LINE-4                PIC X(10) VALUE ' (LINE 2) '.   
ACN        05  WS-LINE-5                PIC X(10) VALUE ' (LINE 3) '.   
           05  WS-SKIP-ACCT-CHECK       PIC X(01) VALUE 'N'.            
C34569     05  WS-CIS-VALUE.                                            
C34569         10  WS-TIER-ACCT-TYPE-CD PIC X(01) VALUE SPACES.         
C34569         10  WS-TIER-RANKING      PIC X(03) VALUE SPACES.         
C34569     05  WS-TIER-RANKING-RED      PIC S9(4) USAGE COMP.           
C34569     05  SCSCA326                 PIC X(08) VALUE 'SCSCA326'.     
C34569     05  MCSCB326                 PIC X(08) VALUE 'MCSCB326'.     
ACT106     05  MCSCB077                 PIC X(08) VALUE 'MCSCB077'.     
ACT106     05  WS-MCSCB077-RET-CODE     PIC S9(04) COMP VALUE 0.        
C34569     05  WS-CURRENT-TS-RED.                                       
C34569         10  WS-CURRENT-DT        PIC X(10) VALUE SPACES.         
C34569         10  WS-CURRENT-DASH-1    PIC X(01) VALUE '-'.            
C34569         10  WS-CURRENT-TIME      PIC X(08) VALUE SPACES.         
C34569         10  WS-CURRENT-DOT-1     PIC X(01) VALUE '.'.            
C34569         10  WS-CURRENT-REST      PIC X(06) VALUE SPACES.         
                                                                        
       01  WS-LITERALS-380.                                             
           05  WS-Y                     PIC X(01) VALUE 'Y'.            
           05  WS-N                     PIC X(01) VALUE 'N'.            
           05  WS-U                     PIC X(01) VALUE 'U'.            
                                                                        
       01  WS-SWITCHES-380.                                             
           05  ALL-DONE-SW              PIC X(01) VALUE 'N'.            
               88 NOT-ALL-DONE                    VALUE 'N'.            
               88 ALL-DONE                        VALUE 'Y'.            
           05  SEND-DONE-SW             PIC X(01) VALUE 'Y'.            
               88 SEND-DONE-ERROR                 VALUE 'N'.            
               88 SEND-DONE-OK                    VALUE 'Y'.            
           05  SW-RESULTS               PIC X(01) VALUE 'Y'.            
               88 NO-MORE-RESULTS                 VALUE 'N'.            
               88 MORE-RESULTS                    VALUE 'Y'.            
           05  SW-FETCH                 PIC X(01) VALUE 'Y'.            
               88 NO-MORE-ROWS                    VALUE 'N'.            
               88 MORE-ROWS                       VALUE 'Y'.            
AMG        05  SW-DUPLICATE             PIC X(01) VALUE 'Y'.            
AMG            88 ACCT-DUPLICATE                  VALUE 'Y'.            
AMG            88 ACCT-NOT-DUPLICATE              VALUE 'N'.            
                                                                        
       01  WS-RPC-D0000440.                                             
           05  WS-INSERT-RPC            PIC X(23)                       
                VALUE 'csrddat.dbo.pd_D0000440'.                        
           05  WS-RPC-LEN               PIC S9(9) COMP VALUE +23.       
           05  WS-STRLEN                PIC S9(9) COMP VALUE +0.        
           05  WS-MSGLIMIT              PIC S9(9) COMP VALUE +5.        
           05  WS-USER-ID               PIC X(07) VALUE SPACES.         
           05  WS-PASSWORD.                                             
               49  WS-PASSWORD-LEN      PIC S9(4) COMP SYNC VALUE +0.   
               49  WS-PASSWORD-TEXT     PIC X(15) VALUE SPACES.         
           05  WS-SERVER.                                               
               49  WS-SERVER-LEN        PIC S9(4) COMP SYNC VALUE +0.   
               49  WS-SERVER-TEXT       PIC X(17) VALUE SPACES.         
           05  WS-PREMISE-NO-440        PIC X(10) VALUE SPACES.         
           05  WS-ACCOUNT-NO-440        PIC X(13) VALUE SPACES.         
           05  WS-LOCAL-OFFICE-440      PIC X(03) VALUE SPACES.         
           05  WS-REV-DIST-CD-440       PIC X(03) VALUE SPACES.         
T19795     05  WS-REQUESTER-INFO-440    PIC X(40) VALUE SPACES.         
                                                                        
       01  CS-LIB-MISC-FIELDS.                                          
           05  WS-CSL-CMD-HANDLE       pIC S9(9) COMP VALUE +0.         
           05  WS-CSL-CON-HANDLE       PIC S9(9) COMP VALUE +0.         
           05  WS-CSL-CTX-HANDLE       PIC S9(9) COMP VALUE +0.         
           05  WS-CSL-RC               PIC S9(9) COMP.                  
           05  WS-CSL-RESTYPE          PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-ITEM-NUM             PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-COPIED               PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-COPIED-NULL          PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-INDICATOR            PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-INDICATOR-NULL       PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-NUMROWS              PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-RPC-RC               PIC S9(9) COMP SYNC VALUE +0.    
           05  WS-RPC-SUCCESS          PIC S9(9) COMP SYNC VALUE +0.    
                                                                        
       01  GW-LIB-MISC-FIELDS.                                          
           05  GWL-STATUS-SUBCODE           PIC S9(9) COMP.             
                                                                        
       01  PARM-FIELDS.                                                 
           05  PARM-L                   PIC S9(9) COMP.                 
CVT000*    05  PARM-ID1                 PIC S9(9) COMP VALUE 1.         06200000
           05  PARM-USER-ID             PIC X(07) VALUE SPACES.         
           05  PARM-PASSWORD.                                           
               49  PARM-PASSWORD-LEN    PIC S9(4) COMP SYNC VALUE +0.   
               49  PARM-PASSWORD-TEXT   PIC X(15) VALUE SPACES.         
           05  PARM-SERVER.                                             
               49  PARM-SERVER-LEN      PIC S9(4) COMP SYNC VALUE +0.   
               49  PARM-SERVER-TEXT     PIC X(17) VALUE SPACES.         
           05  PARM-ORIG-DIST-ACCT-NO   PIC X(20) VALUE SPACES.         
           05  PARM-COMPANY-NO          PIC X(02) VALUE SPACES.         
           05  PARM-AFF-COMPANY-NO      PIC X(02) VALUE SPACES.         
           05  PARM-DIST-COMPANY-NO     PIC X(02) VALUE SPACES.         
           05  PARM-LOCAL-OFFICE-380    PIC X(03) VALUE SPACES.         
           05  PARM-REV-DIST-CD-380     PIC X(03) VALUE SPACES.         
           05  PARM-VARIABLE-DATA.                                      
               10  PARM-REQUESTER-INFO  PIC X(40) VALUE SPACES.         
               10  PARM-ID-TYPE         PIC X(12) VALUE SPACES.         
               10  PARM-ID-NUMBER       PIC X(19) VALUE SPACES.         
               10  PARM-DATE-OF-ISSUE   PIC X(10) VALUE SPACES.         
               10  PARM-STATE           PIC X(02) VALUE SPACES.         
               10  PARM-FEDERAL-TAX-ID  PIC X(09) VALUE SPACES.         
                                                                        
           05  PARM-WEB-VARIABLE-DATA-1.                                
               10  PARM-WEB-REQUESTER-1 PIC X(40) VALUE SPACES.         
               10  PARM-ELEC-AFFL-CD    PIC X(03) VALUE SPACES.         
                                                                        
           05  PARM-WEB-VARIABLE-DATA-2.                                
               10  PARM-SEB-ACCOUNT-NO  PIC X(13) VALUE SPACES.         
               10  PARM-WEB-REQUESTER-2 PIC X(40) VALUE SPACES.         
                                                                        
C34569     05  PARM-WEB-VARIABLE-DATA-3.                                
C34569         10  PARM-WEB-REQUESTER-3 PIC X(40) VALUE SPACES.         
C34569         10  PARM-AGL-RATE-PLAN   PIC X(03) VALUE SPACES.         
                                                                        
           05  WS-SEB-ACCOUNT-NO        PIC X(13) VALUE SPACES.         
           05  WS-SEB-ACCOUNT-NO-NUM REDEFINES                          
               WS-SEB-ACCOUNT-NO        PIC 9(13).                      
                                                                        
           05  WS-TEMP-DIST-ACCT-NO     PIC X(20) VALUE SPACES.         
           05  WS-SERV-ORDER-NO         PIC X(13) VALUE SPACES.         
                                                                        
ACN        05  PARM-LANDLORD-ACCT-NO    PIC X(13) VALUE SPACES.         
ACN        05  PARM-LANDLORD-ACCT-NO-NUM REDEFINES                      
ACN            PARM-LANDLORD-ACCT-NO    PIC 9(13).                      
           05  PARM-LANDLORD-CUST-NO    PIC X(10) VALUE SPACES.         
           05  PARM-MST-SUB-ACCT-IND    PIC X(01) VALUE SPACES.         
           05  PARM-CREATE-SET-ORDER-FLAG PIC X(01) VALUE SPACES.       
           05  PARM-CREATE-MKSW-OUT-FLAG PIC X(01) VALUE SPACES.        
           05  PARM-UPD-PREMISE-NO      PIC X(10) VALUE SPACES.         
           05  PARM-UPD-CUSTOMER-NO     PIC X(10) VALUE SPACES.         
ACN        05  PARM-LL-FREEFORM-ADDR.                                   
ACN            10  LL-ADDR-LINE-1       PIC X(28) VALUE SPACES.         
ACN            10  LL-ADDR-LINE-2       PIC X(28) VALUE SPACES.         
ACN            10  LL-ADDR-LINE-3       PIC X(28) VALUE SPACES.         
C30122     05  PARM-ORIGINATION-CD      PIC X(01) VALUE SPACES.         
P00778     05  PARM-AGL-CUST-NO         PIC X(09) VALUE SPACES.         
P00778     05  PARM-AGL-PREM-NO         PIC X(09) VALUE SPACES.         
                                                                        
       01  WS-DATAFMT.                                                  
           05 WS-NM-PARM               PIC X(132).                      
           05 WS-NMLEM-PARM            PIC S9(9) COMP SYNC.             
           05 WS-DATATYPE-PARM         PIC S9(9) COMP SYNC.             
           05 WS-FORMT-PARM            PIC S9(9) COMP SYNC.             
           05 WS-MAXLENGTH-PARM        PIC S9(9) COMP SYNC.             
           05 WS-SCALE-PARM            PIC S9(9) COMP SYNC.             
           05 WS-PRECISION-PARM        PIC S9(9) COMP SYNC.             
           05 WS-FNTSTATUS-PARM        PIC S9(9) COMP SYNC.             
           05 WS-FMTCOUNT-PARM         PIC S9(9) COMP SYNC.             
           05 WS-USERTYPE-PARM         PIC S9(9) COMP SYNC.             
           05 WS-LOCALE-PARM           PIC S9(9) COMP SYNC.             
                                                                        
       01  WS-DATAFMT-BIND.                                             
           05 WS-NM-BIND               PIC X(132).                      
           05 WS-NMLEM-BIND            PIC S9(9) COMP SYNC.             
           05 WS-DATATYPE-BIND         PIC S9(9) COMP SYNC.             
           05 WS-FORMT-BIND            PIC S9(9) COMP SYNC.             
           05 WS-MAXLENGTH-BIND        PIC S9(9) COMP SYNC.             
           05 WS-SCALE-BIND            PIC S9(9) COMP SYNC.             
           05 WS-PRECISION-BIND        PIC S9(9) COMP SYNC.             
           05 WS-FNTSTATUS-BIND        PIC S9(9) COMP SYNC.             
           05 WS-FMTCOUNT-BIND         PIC S9(9) COMP SYNC.             
           05 WS-USERTYPE-BIND         PIC S9(9) COMP SYNC.             
           05 WS-LOCALE-BIND           PIC S9(9) COMP SYNC.             
                                                                        
       01  WS-SERVER-MSG.                                               
           05 WS-SM-MSGNO              PIC S9(9) COMP SYNC.             
           05 WS-SM-STATE              PIC S9(9) COMP SYNC.             
           05 WS-SM-SEVERITY           PIC S9(9) COMP SYNC.             
           05 WS-SM-TEXT               PIC X(256).                      
           05 WS-SM-TEXT-LEN           PIC S9(9) COMP SYNC.             
           05 WS-SM-SVRNAME            PIC X(256).                      
           05 WS-SM-SVRNAME-LEN        PIC S9(9) COMP SYNC.             
           05 WS-SM-PROC               PIC X(256).                      
           05 WS-SM-PROC-LEN           PIC S9(9) COMP SYNC.             
           05 WS-SM-LINE               PIC S9(9) COMP SYNC.             
           05 WS-SM-STATUS             PIC S9(9) COMP SYNC.             
                                                                        
       01  WS-CLIENT-MSG.                                               
           05 WS-CM-SEVERITY           PIC S9(9) COMP SYNC.             
           05 WS-CM-OC-MSGNO           PIC S9(9) COMP SYNC.             
           05 WS-CM-OC-MSGTEXT         PIC X(256).                      
           05 WS-SM-OC-MSGTEXT-LEN     PIC S9(9) COMP SYNC.             
           05 WS-CM-OS-MSGNO           PIC S9(9) COMP SYNC.             
           05 WS-CM-OS-MSGTEXT         PIC X(256).                      
           05 WS-CM-OS-MSGTEXT-LEN     PIC S9(9) COMP SYNC.             
           05 WS-CM-STATUS             PIC S9(9) COMP SYNC.             
                                                                        
       01  WS-MSGNO                    PIC S9(9) COMP VALUE +1.         
       01  WS-DATALEN                  PIC S9(9) COMP SYNC VALUE +0.    
       01  WS-INDIC                    PIC S9(9) COMP SYNC VALUE +0.    
       01  WS-RETURN-STATUS            PIC S9(4) COMP VALUE +0.         
       01  WS-FINAL                    PIC X(5) VALUE 'FINAL'.          
      *01  WS-FINAL-CALL-AREA          PIC X(1724).                     07320000
a04473 01  WS-FINAL-CALL-AREA          PIC X(10000).                    
                                                                        
       01  GTT-RETURN-FIELDS.                                           
           05  RS-RETURN-CODE               PIC S9(9) COMP VALUE 0.     
           05   S-RETURN-CODE               PIC S9(9) COMP VALUE 0.     
           05  RS-ACCOUNT-NO-380            PIC X(13) VALUE SPACES.     
           05  RS-PREMISE-NO-380            PIC X(10) VALUE SPACES.     
           05  RS-CUSTOMER-NO-380           PIC X(10) VALUE SPACES.     
                                                                        
       01  CN-COLUMN-NAMES-380.                                         
           05  CN-RETURN-CODE               PIC X(11) VALUE             
                                                   'RETURN_CODE'.       
           05  CN-ACCOUNT-NO-380            PIC X(10) VALUE             
                                                   'ACCOUNT_NO'.        
           05  CN-PREMISE-NO-380            PIC X(10) VALUE             
                                                   'PREMISE_NO'.        
           05  CN-CUSTOMER-NO-380            PIC X(11) VALUE            
                                                   'CUSTOMER_NO'.       
                                                                        
       01  SNA-FIELDS.                                                  
           05  SNA-SUBC                     PIC S9(9) COMP.             
                                                                        
                                                                        
       01  WORK-FIELDS.                                                 
           05  WRK-DONE-STATUS              PIC S9(9) COMP.             
                                                                        
REARCH****** DB2 COMMUNICATION REQUIREMENT **************************** 07590000
REARCH*01  LOC1            USAGE IS SQL TYPE IS                         
REARCH*                    RESULT-SET-LOCATOR VARYING.                  
                                                                        
      *                                                                 07630000
HPCCDM*EJECT                                                            07640000
                                                                        
                                                                        
CVT000     EXEC SQL                                                     07670000
CVT000         INCLUDE CWSX0010                                         07680000
CVT000     END-EXEC.                                                    07690000
CVT000                                                                  
CVT000     EXEC SQL                                                     07710000
CVT000         INCLUDE CWSSP001                                         07720000
CVT000     END-EXEC.                                                    07730000
MSQ001        EXEC SQL
MSQ001          DECLARE C2 CURSOR
MSQ001          FOR CALL CSR00440                                       
REARCH                 ( :WS-PREMISE-NO-440
                  , :WS-ACCOUNT-NO-440
                  , :WS-LOCAL-OFFICE-440
                  , :WS-REV-DIST-CD-440
                  , :WS-REQUESTER-INFO-440
                  )
MSQ001        END-EXEC.
          
CVT000                                                                  
CVT000 LINKAGE SECTION.                                                 
CVT000 01  LINK-USER-ID             PIC X(07)                .          
CVT000 01  LINK-PASSWORD            PIC X(15)                .          
CVT000 01  LINK-SERVER              PIC X(17)                .          
CVT000 01  LINK-ORG-DST-ACT-NO      PIC X(20)                .          
CVT000 01  LINK-COMPANY-NO          PIC X(02)                .          
CVT000 01  LINK-AFF-COMPANY-NO      PIC X(02)                .          
CVT000 01  LINK-DST-COMP-NO         PIC X(02)                .          
CVT000 01  LINK-LCL-OFF-380         PIC X(03)                .          
CVT000 01  LINK-REVDISTCD-380       PIC X(03)                .          
CVT000 01  LINK-VARIABLE-DATA       PIC X(92)                .          
CVT000 01  LINK-WEB-VAR-DATA-1      PIC X(43)                .          
CVT000 01  LINK-WEB-VAR-DATA-2      PIC X(53)                .          
CVT000 01  LINK-LNDLRD-ACCT-NO      PIC X(13)                .          
CVT000 01  LINK-LANDLORD-CUST-N     PIC X(10)                .          
CVT000 01  LINK-MST-SUB-ACCT-IN     PIC X(01)                .          
CVT000 01  LINK-CREATE-SET-ORDE     PIC X(01)                .          
CVT000 01  LINK-CREATE-MKSW-OUT     PIC X(01)                .          
CVT000 01  LINK-UPD-PREMISE-NO      PIC X(10)                .          
CVT000 01  LINK-UPD-CUSTOMER-NO     PIC X(10)                .          
CVT000 01  LINK-LL-FREEFORM-ADD     PIC X(84)                .          
CVT000 01  LINK-PREMISE-NO-037      PIC X(10)                .          
CVT000 01  LINK-ADDR-PREFIX-1-0     PIC X(3)                 .          
CVT000 01  LINK-ADDR-PREFIX-2-0     PIC X(2)                 .          
CVT000 01  LINK-HOUSE-NO-037        PIC X(5)                 .          
CVT000 01  LINK-STREET-LOCATIO1     PIC X(4)                 .          
CVT000 01  LINK-STREET-LOCATIO2     PIC X(11)                .          
CVT000 01  LINK-STREET-NAME-037     PIC X(16)                .          
CVT000 01  LINK-STREET-SUFFIX-0     PIC X(4)                 .          
CVT000 01  LINK-ADDR-SUFFIX-037     PIC X(2)                 .          
CVT000 01  LINK-ZIP-CODE-037        PIC X(5)                 .          
CVT000 01  LINK-ZIP-CODE-TOKEN-037  PIC X(1)                 .          
CVT000 01  LINK-ZIP-CODE-PLUS-F     PIC X(4)                 .          
CVT000 01  LINK-ZIP-CODE-TOKEN      PIC X(1)                 .          
CVT000 01  LINK-CITY-037            PIC X(26)                .          
CVT000 01  LINK-STATE-037           PIC X(02)                .          
CVT000 01  LINK-LOCAL-OFFICE-0      PIC X(3)                 .          
CVT000 01  LINK-CITY-GATE-ID-0      PIC X(7)                 .          
CVT000 01  LINK-FIRST-NAME-203      PIC X(15)                .          
CVT000 01  LINK-MIDDLE-NAME-20      PIC X(15)                .          
CVT000 01  LINK-LAST-NAME-203       PIC X(20)                .          
CVT000 01  LINK-SUFFIX-203          PIC X(03)                .          
CVT000 01  LINK-FULL-NAME-203       PIC X(50)                .          
CVT000 01  LINK-BUSINESS-NAME-2     PIC X(50)                .          
CVT000 01  LINK-CUST-HOME-PHONE     PIC X(10)                .          
CVT000 01  LINK-SSN-203             PIC X(09)                .          
CVT000 01  LINK-CUST-BUS-PHONE      PIC X(10)                .          
CVT000 01  LINK-ORIGINATION-CD      PIC X(01)                .          
P00778 01  LINK-AGL-CUST-NO         PIC X(09)                .          
P00778 01  LINK-AGL-PREM-NO         Pic X(09)                .          
                                                                        
CVT000 PROCEDURE DIVISION USING                                         
CVT000          LINK-USER-ID                                            
CVT000         ,LINK-PASSWORD                                           
CVT000         ,LINK-SERVER                                             
CVT000         ,LINK-MST-SUB-ACCT-IN                                    
CVT000         ,LINK-CREATE-SET-ORDE                                    
CVT000         ,LINK-CREATE-MKSW-OUT                                    
CVT000         ,LINK-ORG-DST-ACT-NO                                     
CVT000         ,LINK-LNDLRD-ACCT-NO                                     
CVT000         ,LINK-LANDLORD-CUST-N                                    
CVT000         ,LINK-COMPANY-NO                                         
CVT000         ,LINK-AFF-COMPANY-NO                                     
CVT000         ,LINK-DST-COMP-NO                                        
CVT000         ,LINK-LCL-OFF-380                                        
CVT000         ,LINK-REVDISTCD-380                                      
CVT000         ,LINK-ADDR-PREFIX-1-0                                    
CVT000         ,LINK-ADDR-PREFIX-2-0                                    
CVT000         ,LINK-STREET-LOCATIO1                                    
CVT000         ,LINK-STREET-LOCATIO2                                    
CVT000         ,LINK-HOUSE-NO-037                                       
CVT000         ,LINK-STREET-NAME-037                                    
CVT000         ,LINK-STREET-SUFFIX-0                                    
CVT000         ,LINK-ADDR-SUFFIX-037                                    
CVT000         ,LINK-ZIP-CODE-037                                       
CVT000         ,LINK-ZIP-CODE-TOKEN-037                                 
CVT000         ,LINK-CITY-037                                           
CVT000         ,LINK-STATE-037                                          
CVT000         ,LINK-CITY-GATE-ID-0                                     
CVT000         ,LINK-FIRST-NAME-203                                     
CVT000         ,LINK-MIDDLE-NAME-20                                     
CVT000         ,LINK-LAST-NAME-203                                      
CVT000         ,LINK-SUFFIX-203                                         
CVT000         ,LINK-FULL-NAME-203                                      
CVT000         ,LINK-BUSINESS-NAME-2                                    
CVT000         ,LINK-CUST-HOME-PHONE                                    
CVT000         ,LINK-SSN-203                                            
CVT000         ,LINK-CUST-BUS-PHONE                                     
CVT000         ,LINK-VARIABLE-DATA                                      
CVT000         ,LINK-UPD-PREMISE-NO                                     
CVT000         ,LINK-UPD-CUSTOMER-NO                                    
CVT000         ,LINK-LL-FREEFORM-ADD                                    
CVT000         ,LINK-ORIGINATION-CD                                     
P00778         ,LINK-AGL-CUST-NO                                        
P00778         ,LINK-AGL-PREM-NO                                        
CVT000         .                                                        
CVT000     EXEC SQL                                                     
CVT000         WHENEVER SQLWARNING                                      
CVT000             CONTINUE                                             
CVT000     END-EXEC.                                                    
CVT000                                                                  
CVT000     EXEC SQL                                                     
CVT000         WHENEVER SQLERROR                                        
CVT000             CONTINUE                                             
CVT000     END-EXEC.                                                    
CVT000                                                                  
CVT000     EXEC SQL                                                     
CVT000         WHENEVER NOT FOUND                                       
CVT000             CONTINUE                                             
CVT000     END-EXEC.                                                    
                                                                        
      ******************************************************************08860000
      * 0000-MAINLINE                                                  *08870000
      *     CONTROLS THE MAIN PATH OF THE PROGRAM                      *08880000
      ******************************************************************08890000
       0000-MAINLINE.                                                   
                                                                        
           PERFORM 0100-INITIALIZE            THRU 0100-EXIT.           
           PERFORM 1000-PROCESS-INPUT         THRU 1000-EXIT.           
           PERFORM 2000-PROCESS-OUTPUT        THRU 2000-EXIT.           
           PERFORM 9999-END-PROGRAM           THRU 9999-EXIT.           
                                                                        
       0000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************09000000
      * 0100-INITIALIZE                                                *09010000
      *     1. ESTABLISH GATEWAY ENVIRONMENT (TDINIT)                  *09020000
      *     2. ACCEPT CLIENT REQUEST/ESTABLISH SNA HANDLE (TDACCEPT)   *09030000
      *     3. DETERMINE IF CLIENT HAS SENT AN RPC PARAMETER (TDRESULT)*09040000
      ******************************************************************09050000
       0100-INITIALIZE.                                                 
                                                                        
           MOVE '0100'                        TO ACTIVE-PARAGRAPH.      
                                                                        
CVT000     EXEC SQL                                                     
CVT000       DECLARE C1 CURSOR  FOR                          
CVT000       SELECT                                                     
CVT000        :RS-RETURN-CODE              AS    RETURN_CODE            
CVT000       ,:RS-ACCOUNT-NO-380           AS    ACCOUNT_NO_380         
CVT000       ,:RS-PREMISE-NO-380           AS    PREMISE_NO_380         
CVT000       ,:RS-CUSTOMER-NO-380          AS    CUSTOMER_NO_380        
CVT000          FROM CIS.SYSDUMMY1                                   
CVT000     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ027
MFA-TR*    EXEC SQL                                                     09100000
MFA-TR*      DECLARE C1 CURSOR WITH RETURN FOR                          09110000
MFA-TR*      SELECT                                                     09120000
MFA-TR*       :RS-RETURN-CODE              AS    RETURN_CODE            09130000
MFA-TR*      ,:RS-ACCOUNT-NO-380           AS    ACCOUNT_NO_380         09140000
MFA-TR*      ,:RS-PREMISE-NO-380           AS    PREMISE_NO_380         09150000
MFA-TR*      ,:RS-CUSTOMER-NO-380          AS    CUSTOMER_NO_380        09160000
MFA-TR*         FROM SYSIBM.SYSDUMMY1                                   09170000
MFA-TR*    END-EXEC.                                                    09180000
CVT000     MOVE LINK-USER-ID              TO PARM-USER-ID             . 
CVT000     MOVE LINK-PASSWORD             TO PARM-PASSWORD            . 
CVT000     MOVE LINK-SERVER               TO PARM-SERVER              . 
CVT000     MOVE LINK-MST-SUB-ACCT-IN      TO PARM-MST-SUB-ACCT-IND    . 
CVT000     MOVE LINK-CREATE-SET-ORDE    TO PARM-CREATE-SET-ORDER-FLAG . 
CVT000     MOVE LINK-CREATE-MKSW-OUT    TO PARM-CREATE-MKSW-OUT-FLAG  . 
CVT000     MOVE LINK-ORG-DST-ACT-NO     TO PARM-ORIG-DIST-ACCT-NO     . 
CVT000     MOVE LINK-LANDLORD-CUST-N      TO PARM-LANDLORD-CUST-NO    . 
CVT000     MOVE LINK-COMPANY-NO           TO PARM-COMPANY-NO          . 
CVT000     MOVE LINK-AFF-COMPANY-NO       TO PARM-AFF-COMPANY-NO      . 
CVT000     MOVE LINK-DST-COMP-NO          TO PARM-DIST-COMPANY-NO     . 
CVT000     MOVE LINK-LCL-OFF-380          TO PARM-LOCAL-OFFICE-380    . 
CVT000     MOVE LINK-REVDISTCD-380        TO PARM-REV-DIST-CD-380     . 
CVT000     MOVE LINK-ADDR-PREFIX-1-0      TO PARM-ADDR-PREFIX-1-037   . 
CVT000     MOVE LINK-ADDR-PREFIX-2-0      TO PARM-ADDR-PREFIX-2-037   . 
CVT000     MOVE LINK-STREET-LOCATIO1    TO PARM-STREET-LOCATION-1-037 . 
CVT000     MOVE LINK-STREET-LOCATIO2    TO PARM-STREET-LOCATION-2-037 . 
CVT000     MOVE LINK-HOUSE-NO-037         TO PARM-HOUSE-NO-037        . 
CVT000     MOVE LINK-STREET-NAME-037      TO PARM-STREET-NAME-037     . 
CVT000     MOVE LINK-STREET-SUFFIX-0      TO PARM-STREET-SUFFIX-037   . 
CVT000     MOVE LINK-ADDR-SUFFIX-037      TO PARM-ADDR-SUFFIX-037     . 
CVT000     MOVE LINK-ZIP-CODE-037         TO PARM-ZIP-CODE-037        . 
CVT000     MOVE LINK-ZIP-CODE-TOKEN-037   TO PARM-ZIP-CODE-TOKEN-037  . 
CVT000     MOVE LINK-CITY-037             TO PARM-CITY-037            . 
CVT000     MOVE LINK-STATE-037            TO PARM-STATE-037           . 
CVT000     MOVE LINK-CITY-GATE-ID-0       TO PARM-CITY-GATE-ID-037    . 
CVT000     MOVE LINK-FIRST-NAME-203       TO PARM-FIRST-NAME-203      . 
CVT000     MOVE LINK-MIDDLE-NAME-20       TO PARM-MIDDLE-NAME-203     . 
CVT000     MOVE LINK-LAST-NAME-203        TO PARM-LAST-NAME-203       . 
CVT000     MOVE LINK-SUFFIX-203           TO PARM-SUFFIX-203          . 
CVT000     MOVE LINK-FULL-NAME-203        TO PARM-FULL-NAME-203       . 
CVT000     MOVE LINK-BUSINESS-NAME-2      TO PARM-BUSINESS-NAME-203   . 
CVT000     MOVE LINK-CUST-HOME-PHONE      TO PARM-CUST-HOME-PHONE-203 . 
CVT000     MOVE LINK-SSN-203              TO PARM-SSN-203             . 
CVT000     MOVE LINK-CUST-BUS-PHONE       TO PARM-CUST-BUS-PHONE-203  . 
CVT000     MOVE LINK-VARIABLE-DATA        TO PARM-VARIABLE-DATA       . 
CVT000     MOVE LINK-UPD-PREMISE-NO       TO PARM-UPD-PREMISE-NO      . 
CVT000     MOVE LINK-UPD-CUSTOMER-NO      TO PARM-UPD-CUSTOMER-NO     . 
CVT000     MOVE LINK-LL-FREEFORM-ADD      TO PARM-LL-FREEFORM-ADDR    . 
CVT000     MOVE LINK-ORIGINATION-CD       TO PARM-ORIGINATION-CD      . 
P00778     MOVE LINK-AGL-CUST-NO TO PARM-AGL-CUST-NO.                   
P00778     MOVE LINK-AGL-PREM-NO TO PARM-AGL-PREM-NO.                   
C34569     INITIALIZE LS-MCSCB326-CALL-TYPE                             
C34569                LS-MCSCB326-ONLINE-CALL                           
C34569                LS-MCSCB326-RET-FIELDS                            
C34569                ABEND-FILE.                                       
                                                                        
       0100-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************09690000
      * 1000-PROCESS-INPUT.                                            *09700000
      *     1. RECEIVE PARMS.                                          *09710000
      ******************************************************************09720000
       1000-PROCESS-INPUT.                                              
                                                                        
           MOVE '1000'                        TO ACTIVE-PARAGRAPH.      
           PERFORM 1200-SET-ALL-PARMS         THRU 1200-EXIT.           
                                                                        
       1000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ***************************************************************** 09810000
      * 1200-SET-ALL-PARMS                                            * 09820000
      *     SET ALL "PARM-" VARIABLES SO THAT CPD0037A, CPD0203A, AND * 09830000
      *     CPD0054A CAN BE USED PROPERLY.                            * 09840000
      ***************************************************************** 09850000
       1200-SET-ALL-PARMS.                                              
                                                                        
ACN   * IF THERE IS NO ZIP CODE TOKEN PASSED UP, FIND IT                09880000
ACN        IF PARM-ZIP-CODE-TOKEN-037 EQUAL SPACES                      
ACN           PERFORM 8545-GET-ZIP-CODE-TOKEN    THRU 8545-EXIT         
ACN        END-IF.                                                      
                                                                        
ACN   * IF THERE IS NO REV DIST CODE PASSED UP, FIND IT                 09930000
ACN        IF PARM-REV-DIST-CD-380 EQUAL SPACES                         
ACN           PERFORM 8555-GET-REV-DIST-CODE     THRU 8555-EXIT         
ACN        END-IF.                                                      
                                                                        
      ***** SET PARMS FOR CPD0037A                                      09980000
           MOVE PARM-UPD-PREMISE-NO      TO PARM-PREMISE-NO-037.        
           MOVE PROGRAM-NAME             TO PARM-PANEL-NO-037.          
           MOVE WS-Y                     TO PARM-BYPASS-037.            
           MOVE WS-FORMATTED-ADDRESS     TO PARM-ADDR-USAGE-CD-037.     
           MOVE WS-COMPANY-NO            TO PARM-COMPANY-NO-037.        
           MOVE WS-EMPTY-DATE            TO PARM-GAS-LEAK-SURVEY-DT-037.
           MOVE WS-SYSTEM                TO PARM-USERID-037.            
           MOVE PARM-LOCAL-OFFICE-380    TO PARM-LOCAL-OFFICE-037.      
           MOVE PARM-REV-DIST-CD-380     TO PARM-REV-DISTRICT-CD-037.   
AMG        MOVE '0'                      TO PARM-READ-ROUTE-037.        
      *****                                                             10090000
           MOVE PARM-ADDR-PREFIX-1-037        TO RS-ADDR-PREFIX-1-037.  
           MOVE PARM-ADDR-PREFIX-2-037        TO RS-ADDR-PREFIX-2-037.  
           MOVE PARM-ADDR-SUFFIX-037          TO RS-ADDR-SUFFIX-037.    
           MOVE PARM-ADDRESS-OVERFLOW-037     TO RS-ADDR-OVERFLOW-037.  
           MOVE PARM-HOUSE-NO-037             TO RS-HOUSE-NO-037.       
           MOVE PARM-STREET-LOCATION-1-037    TO                        
                                              RS-STREET-LOCATION-1-037. 
           MOVE PARM-STREET-LOCATION-2-037    TO                        
                                              RS-STREET-LOCATION-2-037. 
           MOVE PARM-STREET-NAME-037          TO RS-STREET-NAME-037.    
           MOVE PARM-STREET-SUFFIX-037        TO RS-STREET-SUFFIX-037.  
           MOVE PARM-CITY-037                 TO RS-CITY-037.           
           MOVE PARM-STATE-037                TO RS-STATE-037.          
           MOVE PARM-ZIP-CODE-037             TO RS-ZIP-CODE-037.       
           MOVE PARM-ZIP-CODE-PLUS-FOUR-037   TO RS-ZIP-CODE-PLUS-4-037.
           MOVE PARM-CARRIER-ROUTE-037        TO RS-CARRIER-ROUTE-037.  
           MOVE PARM-LOCAL-OFFICE-380         TO PARM-LOCAL-OFFICE-037. 
           MOVE PARM-REV-DIST-CD-380        TO PARM-REV-DISTRICT-CD-037.
AGL   *    MOVE PARM-CITY-GATE-ID-037         TO C0-CITY-GATE-ID.       10280000
AGL   *    MOVE PARM-LOCAL-OFFICE-037         TO C0-LOCAL-OFFICE.       10290000
                                                                        
      ***** SET PARMS FOR CPD0203A                                      10310000
           MOVE PARM-UPD-CUSTOMER-NO     TO PARM-CUSTOMER-NO-203.       
           MOVE PARM-LOCAL-OFFICE-380    TO PARM-LOCAL-OFFICE-203.      
           MOVE WS-COMPANY-NO            TO PARM-COMPANY-NO-203.        
           MOVE WS-SYSTEM                TO PARM-USERID-203.            
           MOVE WS-COMMENT-LEN-203       TO PARM-COMMENT-LEN-203.       
           MOVE PARM-FEDERAL-TAX-ID      TO PARM-TAX-ID-203.            
           MOVE PARM-LOCAL-OFFICE-380    TO PARM-LOCAL-OFFICE-203.      
           IF PARM-ID-TYPE = 'LICENSE     '                             
              MOVE PARM-ID-NUMBER        TO PARM-LICENSE-NO-203         
              MOVE PARM-DATE-OF-ISSUE    TO PARM-DRVR-LIC-ISS-DT-203    
              MOVE PARM-STATE            TO PARM-CODE-STATE-ID-203      
           ELSE                                                         
              MOVE PARM-ID-TYPE          TO PARM-OTHER-ID-TYPE-203      
              MOVE PARM-ID-NUMBER (1:16) TO PARM-OTHER-ID-203           
           END-IF.                                                      
      *****                                                             10470000
           MOVE PARM-CUSTOMER-NO-RED-203 TO PARM-CUSTOMER-NO-NUM-203.   
           MOVE PARM-COMMENT-LEN-RED-203 TO PARM-COMMENT-LEN-NUM-203.   
                                                                        
      ***** SET PARMS FOR CPD0054A                                      10510000
           MOVE WS-SYSTEM                TO PARM-USERID-054.            
           MOVE WS-COMPANY-NO            TO PARM-COMPANY-NO-054.        
      *****                                                             10540000
           MOVE PARM-PREMISE-NO-RED-054  TO WS-PREMISE-NO-NUM.          
                                                                        
      ***** SET PARMS FOR PD_D0000440                                   10570000
           MOVE PARM-USER-ID             TO WS-USER-ID.                 
           MOVE PARM-PASSWORD            TO WS-PASSWORD.                
           MOVE PARM-SERVER              TO WS-SERVER.                  
                                                                        
           MOVE PARM-VARIABLE-DATA       TO PARM-WEB-VARIABLE-DATA-1    
                                            PARM-WEB-VARIABLE-DATA-2    
                                            PARM-WEB-VARIABLE-DATA-3.   
                                                                        
       1200-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************10690000
      * 2000-PROCESS-OUTPUT.                                           *10700000
      *     1. DESCRIBE RESULT SET                                     *10710000
      *     2. UPDATE DB2 DATA                                         *10720000
      *     3. BUILD RESULT SET                                        *10730000
      *     4. SEND RESULT SET                                         *10740000
      ******************************************************************10750000
       2000-PROCESS-OUTPUT.                                             
                                                                        
           MOVE '2000'                        TO ACTIVE-PARAGRAPH.      
                                                                        
      **************************************************************    10800000
      * IF THE 'SET-ORDER' FLAG IS SET TO 'A', THEN S380 IS BEING  *    10810000
      * CALLED FROM THE CUSTOMER SIGN-UP PAGE AND IS HANDLED       *    10820000
      * DIFFERENTLY THAN IT IS WHEN IT IS CALLED FROM THE PBTD.    *    10830000
      * THAN IT IS WHEN IT IS CALLED FORM THE PBTRANSINDRIVER.     *    10840000
      **************************************************************    10850000
           IF PARM-CREATE-SET-ORDER-FLAG = 'A'                          
              PERFORM 2210-BUILD-RESULT       THRU 2210-EXIT            
           ELSE                                                         
              PERFORM 2200-BUILD-RESULT       THRU 2200-EXIT            
           END-IF.                                                      
P00778         IF WS-PREMISE-NO > 0                                     
P00778         PERFORM 8590-SELECT-ACCT-INFO      THRU 8590-EXIT        
P00778         PERFORM 8630-UPDATE-AGL-CUST-NO    THRU 8630-EXIT        
P00778         PERFORM 8620-UPDATE-AGL-PREM-NO    THRU 8620-EXIT        
P00778         END-IF                                                   
                                                                        
           PERFORM 8100-SEND-RESULT           THRU 8100-EXIT.           
                                                                        
       2000-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ***************************************************************** 11020000
      *  2200-BUILD-RESULT                                            * 11030000
      ***************************************************************** 11040000
       2200-BUILD-RESULT.                                               
                                                                        
      ***************************************************************** 11070000
      * THERE ARE 4 POSSIBILITES REGARDING THE PARM-UPD-PREMISE-NO      11080000
      * AND THE PARM-UPD-CUSTOMER-NO.                                   11090000
      ***************************************************************** 11100000
      * 1.  PREMISE NO AND CUSTOMER NO ARE PROVIDED (BOTH > SPACES)     11110000
      *     THEY ARE UPDATED.  NO PENDING ACCT IS CREATED, NOTHING IS   11120000
      *     INSERTED INTO THE CSS_MKT_ACCT_XREF TABLE, NO OUTGOING      11130000
      *     MKSW IS CREATED, AND NO SET SERVICE ORDER IS CREATED.       11140000
      * 2.  JUST PREMISE NO IS PROVIDED (PARM-UPD-PREMISE-NO > SPACES)  11150000
      *     PREMISE INFO IS UPDATED.  NO PENDING ACCT IS CREATED,       11160000
      *     NOTHING IS INSERTED INTO THE CSS_MKT_ACCT_XREF TABLE, NO    11170000
      *     OUTGOING MKSW IS CREATED, AND NO SET SERVICE ORDER IS       11180000
      *     CREATED.                                                    11190000
      * 3.  JUST CUSTOMER NO IS PROVIDED (PARM-UPD-CUSTOMER-NO > SPACES)11200000
      *     CUSTOMER INFO IS UPDATED.  NO PENDING ACCT IS CREATED,      11210000
      *     NOTHING IS INSERTED INTO THE CSS_MKT_ACCT_XREF TABLE, NO    11220000
      *     OUTGOING MKSW IS CREATED, AND NO SET SERVICE ORDER IS       11230000
      *     CREATED.                                                    11240000
      * 4.  NEITHER IS PROVIDED                                         11250000
      *     NEW PREMISE IS CREATED, NEW CUSTOMER IS CREATED (IF NO      11260000
      *     LANDLORD CUSTOMER NO IS PROVIDED), NEW PENDING ACCT IS      11270000
      *     CREATED, AND RECORD IS INSERTED INTO CSS_MKT_ACCT_XREF.     11280000
      *     DEPENDING ON FLAGS, AN OUTGOING MKSW AND FM002 SERVICE      11290000
      *     ORDER MAY ALSO BE CREATED.                                  11300000
      ***************************************************************** 11310000
                                                                        
      ***************************************************************** 11330000
      * 1.  PREMISE NO AND CUSTOMER NO ARE PROVIDED (BOTH > SPACES)     11340000
      ***************************************************************** 11350000
                                                                        
           IF PARM-UPD-PREMISE-NO > SPACES AND                          
              PARM-UPD-CUSTOMER-NO > SPACES                             
                                                                        
              MOVE WS-UPDATE                  TO PARM-MODIFY-037        
              PERFORM 2150-BUILD-PREMISE-RESULT  THRU 2150-EXIT         
                                                                        
              MOVE WS-UPDATE                  TO PARM-UPDATE-TYPE-203   
              PERFORM 5000-BUILD-CUSTOMER-RESULT THRU 5000-EXIT         
                                                                        
           ELSE                                                         
                                                                        
      ***************************************************************** 11480000
      * 2.  JUST PREMISE NO IS PROVIDED (PARM-UPD-PREMISE-NO > SPACES)  11490000
      ***************************************************************** 11500000
              IF PARM-UPD-PREMISE-NO > SPACES                           
                 MOVE WS-UPDATE                  TO PARM-MODIFY-037     
                 PERFORM 2150-BUILD-PREMISE-RESULT  THRU 2150-EXIT      
              ELSE                                                      
                                                                        
      ***************************************************************** 11560000
      * 3.  JUST CUSTOMER NO IS PROVIDED (PARM-UPD-CUSTOMER-NO > SPACES)11570000
      ***************************************************************** 11580000
                 IF PARM-UPD-CUSTOMER-NO > SPACES                       
                    MOVE WS-UPDATE               TO PARM-UPDATE-TYPE-203
                    PERFORM 5000-BUILD-CUSTOMER-RESULT THRU 5000-EXIT   
                 ELSE                                                   
                                                                        
      ***************************************************************** 11640000
      * 4.  NEITHER IS PROVIDED                                         11650000
      ***************************************************************** 11660000
                                                                        
      * FIRST CHECK CSS_MKT_XREF_ACCT FOR THE DIFFERENT DUPLICATE       11680000
      * CONDITIONS.                                                     11690000
                                                                        
      * IF THE PARM-SEB-ACCOUNT-NO IS NUMERIC, THIS IS A WEB REQUEST    11710000
      * SO THE PARM-SEB-ACCOUNT-NO MUST BE MOVED INTO THE               11720000
      * PARM-ORIG-DIST-ACCT-NO VARIABLE.                                11730000
                    IF PARM-SEB-ACCOUNT-NO IS NUMERIC                   
                       MOVE PARM-ORIG-DIST-ACCT-NO TO                   
                                                  WS-TEMP-DIST-ACCT-NO  
                       MOVE PARM-SEB-ACCOUNT-NO    TO                   
                                                  PARM-ORIG-DIST-ACCT-NO
                    END-IF                                              
                                                                        
AMG                 PERFORM 8575-CHECK-DIST-ACCT-NO      THRU 8575-EXIT 
                                                                        
      * MOVE THE VARIABLES BACK TO THEIR ORIGINAL CONTENTS.             11830000
                    IF PARM-SEB-ACCOUNT-NO IS NUMERIC                   
                       MOVE WS-TEMP-DIST-ACCT-NO   TO                   
                                                  PARM-ORIG-DIST-ACCT-NO
                    END-IF                                              
                                                                        
      * THIS CHECK IS DONE TO SEE IF THE ACCOUNT IS A DUPLICATE         11890000
      * BECAUSE AN ORIS 2 TURN-ON/ORIS 12 TO TRANSACTION IS BEING       11900000
      * PROCESSED BY THE PBTRANSINDRIVER WHOSE ORIGINAL MKSW/TURN-ON    11910000
      * REQUEST WAS INITIATED BY THE CUSTOMER SIGN-UP WEB PAGE.         11920000
                                                                        
                    IF ACCT-DUPLICATE                  AND              
                       PARM-CREATE-MKSW-OUT-FLAG = 'N' AND              
                       XM-SIGN-UP-STATUS-CD = 'I'      AND              
                       PARM-SEB-ACCOUNT-NO IS NUMERIC                   
                                                                        
                       MOVE 'Y'                  TO WS-SKIP-ACCT-CHECK  
                       MOVE PARM-SEB-ACCOUNT-NO  TO WS-SEB-ACCOUNT-NO   
                       MOVE WS-SEB-ACCOUNT-NO-NUM                       
                                                 TO XM-ACCOUNT-NO       
                                                                        
                       PERFORM 2210-BUILD-RESULT THRU 2210-EXIT         
                                                                        
                       GO TO 2200-EXIT                                  
ACN                 END-IF                                              
                                                                        
      * IF ACCOUNT IS NOT A DUPLICATE AND THE PARM-SEB-ACCOUNT-NO IS    12090000
      * A DUPLICATE, THIS MEANS THAT THE SEB ACCOUNT NUMBER WAS         12100000
      * CREATED BY A MKSW OR TURN-ON REQEUST FROM THE WEB PAGE AND      12110000
      * IT RETURNED INCORRECTLY ON THE ORIS 02 OR ORIS 12 TO            12120000
      * TRANSACTION FROM AGL.  IF THIS IS THE CASE, RETURN +2.          12130000
                                                                        
                    IF ACCT-NOT-DUPLICATE AND                           
                       PARM-CREATE-MKSW-OUT-FLAG = 'N' AND              
                       XM-SIGN-UP-STATUS-CD = 'I' AND                   
                       PARM-SEB-ACCOUNT-NO IS NUMERIC                   
                                                                        
                       MOVE WS-SEB-ROW-EXISTS    TO RS-RETURN-CODE      
                                                                        
                       GO TO 2200-EXIT                                  
                    END-IF                                              
                                                                        
      * CHECK IF THE ACCOUNT IS A DUPLICATE.  IF THIS IS THE CASE,      12250000
      * RETURN +1.  IF NOT, CONTINUE WITH THE PROCESSING.               12260000
                                                                        
                    IF ACCT-DUPLICATE                                   
                       MOVE WS-XREF-ROW-EXISTS   TO RS-RETURN-CODE      
                    ELSE                                                
                       MOVE WS-INSERT            TO PARM-MODIFY-037     
                       PERFORM 2150-BUILD-PREMISE-RESULT                
                                                 THRU 2150-EXIT         
                       MOVE RS-PREMISE-NO-037    TO PARM-PREMISE-NO-054 
                                                                        
                       IF PARM-LANDLORD-CUST-NO EQUAL SPACES            
                          MOVE WS-INSERT         TO PARM-UPDATE-TYPE-203
                          PERFORM 5000-BUILD-CUSTOMER-RESULT            
                                                 THRU 5000-EXIT         
                          MOVE RS-CUSTOMER-NO-203                       
                                                 TO PARM-CUSTOMER-NO-054
                       ELSE                                             
                          PERFORM 8515-CHECK-CUSTOMER-NO                
                                                 THRU 8515-EXIT         
ACN                       IF (PARM-LANDLORD-ACCT-NO NOT = SPACES) AND   
ACN                          (PARM-LANDLORD-ACCT-NO-NUM NOT = ZEROES)   
ACN                          PERFORM 8535-GET-LANDLORD-RATE             
                                                 THRU 8535-EXIT         
                          END-IF                                        
                          MOVE PARM-LANDLORD-CUST-NO                    
                                                 TO PARM-CUSTOMER-NO-054
                       END-IF                                           
                                                                        
                       PERFORM 2204-BUILD-ACCOUNT-RESULT THRU 2204-EXIT 
                                                                        
                       MOVE SPACES               TO XM-SIGN-UP-STATUS-CD
                       PERFORM 2215-BUILD-MKT-ACCT-XREF                 
                                                 THRU 2215-EXIT         
                       IF PARM-MST-SUB-ACCT-IND = WS-MASTER             
                          PERFORM 8525-SET-MST-SUB-IND                  
                                                 THRU 8525-EXIT         
                       END-IF                                           
                                                                        
ACN                    IF PARM-LL-FREEFORM-ADDR > SPACES                
ACN                       PERFORM 2285-BUILD-ADDR-WORK-QUEUE            
                                                 THRU 2285-EXIT         
ACN                    END-IF                                           
                                                                        
                       IF PARM-CREATE-MKSW-OUT-FLAG = WS-Y              
                          PERFORM 2275-BUILD-MKT-TRANS-INFO             
                                                 THRU 2275-EXIT         
                       END-IF                                           
                                                                        
C34569* SEB RATE REARCH                                                 12740000
C34569* 1. GET RES/COMM INFO BASED ON AGL RATE;                         12750000
C34569* 2. DETERMINE OPTION_CD AND OFFER_CD                             12760000
C34569* 3. CALL SCSCSA 326 TO INSERT INTO CORRECT TABLES                12770000
                                                                        
C34569                 PERFORM 8600-GET-CRM-TIER-INFO THRU 8600-EXIT    
C34569                 PERFORM 8605-GET-OFFER-OPTION  THRU 8605-EXIT    
C34569                 PERFORM 8610-CALL-MCSCB326     THRU 8610-EXIT    
                                                                        
                       IF PARM-CREATE-SET-ORDER-FLAG = WS-Y             
                          MOVE RS-ACCOUNT-NO-054     TO                 
                                                   WS-ACCOUNT-NO-440    
                          MOVE RS-PREMISE-NO-037     TO                 
                                                   WS-PREMISE-NO-440    
                          MOVE PARM-LOCAL-OFFICE-380 TO                 
                                                   WS-LOCAL-OFFICE-440  
                          MOVE PARM-REV-DIST-CD-380  TO                 
                                                   WS-REV-DIST-CD-440   
T19795                    MOVE PARM-REQUESTER-INFO   TO                 
                                                   WS-REQUESTER-INFO-440
                          PERFORM 5150-BUILD-NEW-SO                     
                                                   THRU 5150-EXIT       
                       END-IF                                           
                                                                        
                       MOVE RS-PREMISE-NO-037      TO RS-PREMISE-NO-380 
                       MOVE RS-CUSTOMER-NO-203     TO RS-CUSTOMER-NO-380
                       MOVE RS-ACCOUNT-NO-054      TO RS-ACCOUNT-NO-380 
                    END-IF                                              
                 END-IF                                                 
              END-IF                                                    
           END-IF.                                                      
                                                                        
       2200-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ***************************************************************** 13090000
      *  2210-BUILD-RESULT                                            * 13100000
      ***************************************************************** 13110000
       2210-BUILD-RESULT.                                               
                                                                        
      * FIRST CHECK CSS_MKT_XREF_ACCT FOR DUPLICATE                     13140000
      * IF ACCOUNT IS A DUPLICATE, RETURN 1, ELSE PROCEED.              13150000
      * NO ACCOUNT NUMBER CHECK IS NEEDED WHEN CALLED FROM THE          13160000
      * CUSTOMER WEB SIGN-UP PAGE.                                      13170000
                                                                        
           IF PARM-ORIG-DIST-ACCT-NO NOT = 'WEB'                        
              IF WS-SKIP-ACCT-CHECK = 'N'                               
                 MOVE WS-N                       TO SW-DUPLICATE        
                 IF PARM-ORIG-DIST-ACCT-NO > SPACES                     
                    PERFORM 8575-CHECK-DIST-ACCT-NO                     
                                                 THRU 8575-EXIT         
                    IF ACCT-DUPLICATE                                   
                       MOVE WS-XREF-ROW-EXISTS   TO RS-RETURN-CODE      
                       GO TO 2210-EXIT                                  
                    END-IF                                              
                 ELSE                                                   
                    MOVE WS-XREF-ROW-EXISTS      TO RS-RETURN-CODE      
                    GO TO 2210-EXIT                                     
                 END-IF                                                 
      * OBTAIN THE ACCOUNT, CUSTOMER AND PREMISE NUMBER BASED ON THE    13330000
      * DIST_ACCT_NO PARAMETER.                                         13340000
              ELSE                                                      
                 PERFORM 8580-OBTAIN-ACCT-INFO                          
                                             THRU 8580-EXIT             
                                                                        
                 MOVE AT-CUSTOMER-NO         TO PARM-UPD-CUSTOMER-NO    
                                                PARM-CUSTOMER-NO-203    
                                                RS-CUSTOMER-NO-203      
                 MOVE PARM-CUSTOMER-NO-RED-203                          
                                             TO PARM-CUSTOMER-NO-NUM-203
                                                                        
                 MOVE AT-PREMISE-NO          TO PARM-UPD-PREMISE-NO     
                                                PARM-PREMISE-NO-037     
                                                RS-PREMISE-NO-037       
                 MOVE XM-ACCOUNT-NO          TO RS-ACCOUNT-NO-054       
              END-IF                                                    
           END-IF.                                                      
                                                                        
           IF PARM-UPD-PREMISE-NO > SPACES                              
              MOVE WS-UPDATE                     TO PARM-MODIFY-037     
              PERFORM 2150-BUILD-PREMISE-RESULT  THRU 2150-EXIT         
              MOVE RS-PREMISE-NO-037             TO PARM-PREMISE-NO-054 
                                                    RS-PREMISE-NO-037   
           ELSE                                                         
              MOVE WS-INSERT                     TO PARM-MODIFY-037     
              PERFORM 2150-BUILD-PREMISE-RESULT  THRU 2150-EXIT         
              MOVE RS-PREMISE-NO-037             TO PARM-PREMISE-NO-054 
           END-IF.                                                      
                                                                        
           IF PARM-LANDLORD-CUST-NO = SPACES                            
              IF PARM-UPD-CUSTOMER-NO > SPACES                          
                 MOVE WS-UPDATE                  TO PARM-UPDATE-TYPE-203
                 PERFORM 5000-BUILD-CUSTOMER-RESULT                     
                                                 THRU 5000-EXIT         
                 MOVE PARM-UPD-CUSTOMER-NO       TO PARM-CUSTOMER-NO-054
                                                 RS-CUSTOMER-NO-203     
              ELSE                                                      
                 MOVE WS-INSERT                  TO PARM-UPDATE-TYPE-203
                 PERFORM 5000-BUILD-CUSTOMER-RESULT                     
                                                 THRU 5000-EXIT         
                 MOVE RS-CUSTOMER-NO-203         TO PARM-CUSTOMER-NO-054
              END-IF                                                    
           ELSE                                                         
              PERFORM 8515-CHECK-CUSTOMER-NO     THRU 8515-EXIT         
                                                                        
              IF (PARM-LANDLORD-ACCT-NO NOT = SPACES) AND               
                 (PARM-LANDLORD-ACCT-NO-NUM NOT = ZEROES)               
                 PERFORM 8535-GET-LANDLORD-RATE  THRU 8535-EXIT         
              END-IF                                                    
                                                                        
              MOVE PARM-LANDLORD-CUST-NO         TO PARM-CUSTOMER-NO-054
                                                    PARM-UPD-CUSTOMER-NO
                                                    PARM-CUSTOMER-NO-203
                                                    RS-CUSTOMER-NO-203  
                                                    AT-CUSTOMER-NO      
              PERFORM 8530-UPD-AT-CUSTOMER       THRU 8530-EXIT         
           END-IF.                                                      
                                                                        
           IF WS-SKIP-ACCT-CHECK = 'N'                                  
              PERFORM 2204-BUILD-ACCOUNT-RESULT THRU 2204-EXIT          
                                                                        
              MOVE 'I'                          TO XM-SIGN-UP-STATUS-CD 
                                                                        
      * IF THE PARM-ORIG-DIST-ACCT-NO IS EQUAL TO 'WEB', THEN THIS IS   13970000
      * A CUST WEB PAGE REQUEST.  THEREFORE, THE SEB ACCOUNT NUMBER     13980000
      * MUST BE MOVED INTO THE PARM-ORIG-DIST-ACCT-NO VARIABLE.         13990000
              IF PARM-ORIG-DIST-ACCT-NO = 'WEB'                         
                 MOVE PARM-ORIG-DIST-ACCT-NO    TO                      
                                                  WS-TEMP-DIST-ACCT-NO  
                 MOVE RS-ACCOUNT-NO-054         TO                      
                                                  PARM-ORIG-DIST-ACCT-NO
              END-IF                                                    
                                                                        
              PERFORM 2215-BUILD-MKT-ACCT-XREF  THRU 2215-EXIT          
                                                                        
      * MOVE THE VARIABLES BACK TO THEIR ORIGINAL CONTENTS.             14090000
              IF WS-TEMP-DIST-ACCT-NO = 'WEB'                           
                 MOVE 'WEB'                     TO                      
                                                  PARM-ORIG-DIST-ACCT-NO
              END-IF                                                    
                                                                        
              MOVE RS-ACCOUNT-NO-054            TO WS-ACCOUNT-NO-440    
              MOVE RS-PREMISE-NO-037            TO WS-PREMISE-NO-440    
              MOVE PARM-LOCAL-OFFICE-380        TO WS-LOCAL-OFFICE-440  
              MOVE PARM-REV-DIST-CD-380         TO WS-REV-DIST-CD-440   
              MOVE PARM-REQUESTER-INFO          TO WS-REQUESTER-INFO-440
                                                                        
              PERFORM 5150-BUILD-NEW-SO         THRU 5150-EXIT          
           ELSE                                                         
      * UPDATE THE SIGN UP STATUS CODE FOR THE PROCESSED ORIS+          14230000
              MOVE 'C'                          TO XM-SIGN-UP-STATUS-CD 
                                                                        
              PERFORM 8501-UPDATE-MKT-XREF-TABLE THRU 8501-EXIT         
                                                                        
              IF PARM-MST-SUB-ACCT-IND = WS-MASTER                      
                 PERFORM 8525-SET-MST-SUB-IND       THRU 8525-EXIT      
              END-IF                                                    
                                                                        
              IF PARM-LL-FREEFORM-ADDR > SPACES                         
                 PERFORM 2285-BUILD-ADDR-WORK-QUEUE THRU 2285-EXIT      
              END-IF                                                    
           END-IF.                                                      
                                                                        
           MOVE RS-PREMISE-NO-037              TO RS-PREMISE-NO-380.    
           MOVE RS-CUSTOMER-NO-203             TO RS-CUSTOMER-NO-380.   
           MOVE RS-ACCOUNT-NO-054              TO RS-ACCOUNT-NO-380.    
                                                                        
           IF PARM-CREATE-MKSW-OUT-FLAG = WS-Y                          
              PERFORM 2275-BUILD-MKT-TRANS-INFO  THRU 2275-EXIT         
           END-IF.                                                      
                                                                        
       2210-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ***************************************************************** 14480000
      *  2215-BUILD-MKT-ACCT-XREF                                     * 14490000
      ***************************************************************** 14500000
       2215-BUILD-MKT-ACCT-XREF.                                        
                                                                        
           MOVE RS-ACCOUNT-NO-054             TO XM-ACCOUNT-NO.         
           MOVE PARM-COMPANY-NO               TO XM-COMPANY-NO.         
           MOVE PARM-AFF-COMPANY-NO           TO XM-AFF-COMPANY-NO.     
                                                                        
           IF PARM-CREATE-MKSW-OUT-FLAG = WS-Y                          
              MOVE PARM-ORIG-DIST-ACCT-NO     TO XM-ORIG-DIST-ACCT-NO   
              MOVE SPACES                     TO XM-DIST-ACCT-NO        
           ELSE                                                         
              MOVE SPACES                     TO XM-ORIG-DIST-ACCT-NO   
              MOVE PARM-ORIG-DIST-ACCT-NO     TO XM-DIST-ACCT-NO        
           END-IF.                                                      
                                                                        
ACN        IF PARM-MST-SUB-ACCT-IND EQUAL WS-MASTER                     
ACN           MOVE WS-DEFAULT-RATE-SCHED      TO XM-RATE-SCHEDULE       
ACN        ELSE                                                         
ACN           MOVE WS-MASTER-RATE-SCHED       TO XM-RATE-SCHEDULE       
ACN        END-IF.                                                      
                                                                        
           MOVE PARM-DIST-COMPANY-NO          TO XM-DIST-COMPANY-NO.    
           MOVE PARM-LOCAL-OFFICE-380         TO XM-MKT-POOL-GRP.       
C30122     MOVE PARM-ORIGINATION-CD           TO XM-ORIGINATION-CD.     
                                                                        
           PERFORM 8500-INSERT-MKT-XREF-TABLE THRU 8500-EXIT.           
                                                                        
       2215-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ***************************************************************** 14800000
      *  2275-BUILD-MKT-TRANS-INFO                                    * 14810000
      ***************************************************************** 14820000
       2275-BUILD-MKT-TRANS-INFO.                                       
                                                                        
           MOVE WS-MKSW-CODE                  TO TL-TRANS-ID-CD.        
           MOVE RS-ACCOUNT-NO-054             TO TL-ACCOUNT-NO.         
           MOVE WS-COMPANY-NO                 TO TL-COMPANY-NO.         
                                                                        
           IF PARM-ORIG-DIST-ACCT-NO = 'WEB'                            
              MOVE 56                   TO TL-TRANS-DATA-1-LEN          
              MOVE RS-ACCOUNT-NO-054    TO TL-TRANS-DATA-1-TEXT (1:13)  
              MOVE PARM-REQUESTER-INFO  TO TL-TRANS-DATA-1-TEXT (14:40) 
              MOVE PARM-ELEC-AFFL-CD    TO TL-TRANS-DATA-1-TEXT (54:3)  
              MOVE SPACES               TO TL-TRANS-DATA-1-TEXT (57:198)
           ELSE                                                         
              MOVE 40                   TO TL-TRANS-DATA-1-LEN          
              MOVE PARM-REQUESTER-INFO  TO TL-TRANS-DATA-1-TEXT (1:40)  
              MOVE SPACES               TO TL-TRANS-DATA-1-TEXT (41:214)
           END-IF.                                                      
                                                                        
           MOVE ZERO                             TO TL-TRANS-DATA-2-LEN 
           MOVE SPACES                           TO TL-TRANS-DATA-2-TEXT
           MOVE ZERO                             TO TL-TRANS-DATA-3-LEN 
           MOVE SPACES                           TO TL-TRANS-DATA-3-TEXT
           MOVE ZERO                             TO TL-TRANS-DATA-4-LEN 
           MOVE SPACES                           TO TL-TRANS-DATA-4-TEXT
                                                                        
           PERFORM 8505-INSERT-TRANS-INFO-TABLE  THRU 8505-EXIT.        
                                                                        
       2275-EXIT.                                                       
           EXIT.                                                        
                                                                        
ACN   ***************************************************************** 15130000
ACN   *  2285-BUILD-ADDR-WORK-QUEUE                                   * 15140000
ACN   ***************************************************************** 15150000
ACN    2285-BUILD-ADDR-WORK-QUEUE.                                      
ACN                                                                     
ACT106     MOVE ZEROES                     TO WS-77-SERV-ORDER-NO.      
ACT106     MOVE 178                        TO WS-77-CATEGORY-ID.        
ACT106     MOVE RS-ACCOUNT-NO-054          TO WS-77-ACCOUNT-NO.         
ACT106     MOVE RS-PREMISE-NO-037          TO WS-77-PREMISE-NO.         
ACT106     MOVE RS-CUSTOMER-NO-203         TO WS-77-CUSTOMER-NO.        
ACT106     MOVE WS-SYSTEM                  TO WS-77-USER-ID-ORIG.       
ACT106     MOVE '001'                      TO WS-77-RESP-AREA-ID.       
ACT106     MOVE PARM-LOCAL-OFFICE-380      TO WS-77-LOCAL-OFFICE.       
ACT106     MOVE '4'                        TO WS-77-ROUTE-CATEGORY.     
ACT106                                                                  
ACT106***  THE NEXT 8 LINES IS WHERE THE WORK QUEUE TEXT IS POPULATED   15290000
ACT106     MOVE WS-HIGH-PRIORITY           TO WS-77-PRIORITY.           
ACT106     MOVE WS-LINE-1                                               
ACT106                                 TO WS-77-COMMENTS-TEXT (1:48).   
ACT106     MOVE WS-LINE-2                                               
ACT106                                 TO WS-77-COMMENTS-TEXT (49:46).  
ACT106     MOVE WS-LINE-3                                               
ACT106                                 TO WS-77-COMMENTS-TEXT (95:50).  
ACT106     MOVE LL-ADDR-LINE-1                                          
ACT106                                 TO WS-77-COMMENTS-TEXT (145:28). 
ACT106     MOVE WS-LINE-4                                               
ACT106                                 TO WS-77-COMMENTS-TEXT (173:10). 
ACT106     MOVE LL-ADDR-LINE-2                                          
ACT106                                 TO WS-77-COMMENTS-TEXT (183:28). 
ACT106     MOVE WS-LINE-5                                               
ACT106                                 TO WS-77-COMMENTS-TEXT (211:10). 
ACT106     MOVE LL-ADDR-LINE-3                                          
ACT106                                 TO WS-77-COMMENTS-TEXT (221:28). 
ACT106     MOVE 248                        TO WS-77-COMMENTS-LEN.       
ACT106                                                                  
ACT106     MOVE SPACES                     TO WS-77-FREE-FORM-TXT.      
ACT106     MOVE ZEROES                     TO WS-77-FREE-FORM-LEN.      
ACN                                                                     
ACT106     PERFORM 8895-INSERT-WORK-QUEUE  THRU 8895-EXIT.              
ACN                                                                     
ACN    2285-EXIT.                                                       
ACN        EXIT.                                                        
                                                                        
REARCH***************************************************************** 15490000
REARCH*  5150-BUILD-NEW-SO                                            * 15500000
REARCH***************************************************************** 15510000
       5150-BUILD-NEW-SO.                                               
                                                                        
REARCH                                                                  
REARCH     PERFORM 5150A-BUILD-NEW-SO-DB2 THRU 5150A-EXIT.              
REARCH                                                                  
                                                                        
       5150-EXIT.                                                       
           EXIT.                                                        
                                                                        
REARCH***************************************************************** 15610000
REARCH*  5150A-BUILD-NEW-SO-DB2                                       * 15620000
REARCH***************************************************************** 15630000
REARCH 5150A-BUILD-NEW-SO-DB2.                                          
                                                                        
REARCH     MOVE '5150A'                  TO WS-ACTIVE-PARAGRAPH.        
                                                                        
REARCH*    EXEC SQL CALL CSR00440                                       
REARCH*                ( :WS-PREMISE-NO-440                             
REARCH*                 ,:WS-ACCOUNT-NO-440                             
REARCH*                 ,:WS-LOCAL-OFFICE-440                           
REARCH*                 ,:WS-REV-DIST-CD-440                            
REARCH*                 ,:WS-REQUESTER-INFO-440                         
REARCH*                )                                                
REARCH*    END-EXEC.                                                    

MSQ001        EXEC SQL
MSQ001          CLOSE C2
MSQ001        END-EXEC
MSQ001        EXEC SQL
MSQ001          OPEN C2
MSQ001        END-EXEC
MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

MSQ001        MOVE SQLCA TO MSQ001-SQLCABACK
MSQ001        MOVE 0 TO SQLD
MSQ001        EXEC SQL
MSQ001          DESCRIBE CURSOR C2 INTO :SQLDA
MSQ001        END-EXEC
MSQ001        MOVE MSQ001-SQLCABACK TO SQLCA
MSQ001        IF SQLD > 0 AND SQLCODE = 0 THEN
MSQ001          MOVE 466 TO SQLCODE
MSQ001        END-IF
REARCH     IF SQLCODE = 466 THEN                                        
REARCH*       EXEC SQL ASSOCIATE LOCATORS(:LOC1) WITH PROCEDURE         
REARCH*         CSR00440                                                
REARCH*       END-EXEC                                                  
REARCH*       EXEC SQL ALLOCATE C2 CURSOR FOR RESULT SET :LOC1          
REARCH*       END-EXEC                                                  
REARCH        EXEC SQL                                                  
REARCH           FETCH C2 INTO :WS-RETURN-STATUS,                       
REARCH                         :WS-SERV-ORDER-NO                        
REARCH        END-EXEC                                                  

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

REARCH        MOVE SQLCODE                  TO WS-ACTIVE-RETURN-CODE    
REARCH        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND   
REARCH           NEXT SENTENCE                                          
REARCH        ELSE                                                      
REARCH           MOVE 'CSR00440 DB2SP'          TO CMN-TABLE-1          
REARCH           MOVE 'CSR00440 DB2SP'          TO CMN-TABLE-2          
REARCH           MOVE 'WS-PREMISE-NO '          TO CMN-TABLE-ELEMENT-1  
REARCH           MOVE 'WS-ACCOUNT-NO '          TO CMN-TABLE-ELEMENT-2  
REARCH           MOVE WS-PREMISE-NO-440         TO CMN-HOSTVAR-ELEMENT-1
REARCH           MOVE WS-ACCOUNT-NO-440         TO CMN-HOSTVAR-ELEMENT-2
REARCH           PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT         
REARCH        END-IF                                                    
REARCH        EXEC SQL                                                  
REARCH          CLOSE C2                                                
REARCH        END-EXEC
MSQ017     CALL "MFASQLCA"
MSQ017       USING SQLCA, BY VALUE MFA-PROGRAM-ID, "0", "0", "0",
MSQ017       BY REFERENCE MFSQLMESSAGETEXT
MSQ017     END-CALL

                                                  
REARCH     END-IF.                                                      
                                                                        
REARCH 5150A-EXIT.                                                      
REARCH     EXIT.                                                        
                                                                        
      ******************************************************************16060000
      * 8500-INSERT-MKT-XREF-TABLE                                     *16070000
      ******************************************************************16080000
       8500-INSERT-MKT-XREF-TABLE.                                      
                                                                        
AMG        EXEC SQL                                                     
              INSERT INTO CSS_MKT_XREF_ACCT                             
                    (ACCOUNT_NO           ,                             
                     COMPANY_NO           ,                             
                     AFF_COMPANY_NO       ,                             
                     ORIG_DIST_ACCT_NO    ,                             
                     DIST_ACCT_NO         ,                             
                     DIST_COMPANY_NO      ,                             
                     MKT_POOL_GRP         ,                             
C30122               ORIGINATION_CD       ,                             
ACN                  RATE_SCHEDULE        ,                             
                     SIGN_UP_STATUS_CD)                                 
               VALUES                                                   
                   (:XM-ACCOUNT-NO        ,                             
                    :XM-COMPANY-NO        ,                             
                    :XM-AFF-COMPANY-NO    ,                             
                    :XM-ORIG-DIST-ACCT-NO ,                             
                    :XM-DIST-ACCT-NO      ,                             
                    :XM-DIST-COMPANY-NO   ,                             
                    :XM-MKT-POOL-GRP      ,                             
C30122              :XM-ORIGINATION-CD    ,                             
ACN                 :XM-RATE-SCHEDULE     ,                             
                    :XM-SIGN-UP-STATUS-CD)                              
           END-EXEC.                                                    

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE '8500'                    TO ACTIVE-PARAGRAPH       
               MOVE 'INSERT'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_MKT_XREF_ACCT'       TO TABLE-1                
               MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
               MOVE 'ORIG_DIST_ACCT_NO'       TO TABLE-ELEMENT-2        
               MOVE 'DIST_ACCT_NO'            TO TABLE-ELEMENT-3        
               MOVE XM-ACCOUNT-NO             TO HOSTVAR-ELEMENT-1      
               MOVE XM-ORIG-DIST-ACCT-NO      TO HOSTVAR-ELEMENT-2      
               MOVE XM-DIST-ACCT-NO           TO HOSTVAR-ELEMENT-3      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8500-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************16610000
      * 8501-UPDATE-MKT-XREF-TABLE                                     *16620000
      ******************************************************************16630000
       8501-UPDATE-MKT-XREF-TABLE.                                      
                                                                        
           IF PARM-MST-SUB-ACCT-IND EQUAL WS-MASTER                     
              MOVE WS-DEFAULT-RATE-SCHED      TO XM-RATE-SCHEDULE       
           ELSE                                                         
              MOVE WS-MASTER-RATE-SCHED       TO XM-RATE-SCHEDULE       
           END-IF.                                                      
                                                                        
           EXEC SQL                                                     
              UPDATE CSS_MKT_XREF_ACCT                                  
                 SET SIGN_UP_STATUS_CD = :XM-SIGN-UP-STATUS-CD,         
                     RATE_SCHEDULE     = :XM-RATE-SCHEDULE    ,         
                     DIST_ACCT_NO      = :PARM-ORIG-DIST-ACCT-NO        
               WHERE ACCOUNT_NO = :XM-ACCOUNT-NO                        
                 AND COMPANY_NO = :WS-COMPANY-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     16720000
MFA-TR*       UPDATE CSS_MKT_XREF_ACCT                                  16730000
MFA-TR*          SET SIGN_UP_STATUS_CD = :XM-SIGN-UP-STATUS-CD,         16740000
MFA-TR*              RATE_SCHEDULE     = :XM-RATE-SCHEDULE    ,         16750000
MFA-TR*              DIST_ACCT_NO      = :PARM-ORIG-DIST-ACCT-NO        16760000
MFA-TR*        WHERE ACCOUNT_NO = :XM-ACCOUNT-NO                        16770000
MFA-TR*          AND COMPANY_NO = :WS-COMPANY-NO                        16780000
MFA-TR*        QUERYNO 8501                                             16790000
MFA-TR*    END-EXEC.                                                    16800000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE '8501'                    TO ACTIVE-PARAGRAPH       
               MOVE 'UPDATE'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_MKT_XREF_ACCT'       TO TABLE-1                
               MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
               MOVE XM-ACCOUNT-NO             TO HOSTVAR-ELEMENT-1      
               MOVE 'COMPANY_NO'              TO TABLE-ELEMENT-2        
               MOVE WS-COMPANY-NO             TO HOSTVAR-ELEMENT-2      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8501-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************17050000
      * 8505-INSERT-TRANS-INFO-TABLE                                   *17060000
      ******************************************************************17070000
       8505-INSERT-TRANS-INFO-TABLE.                                    
                                                                        
           EXEC SQL                                                     
              INSERT INTO CSS_MKT_TRAN_INFO                             
                    (TRANS_ID_CD       ,                                
                     ACCOUNT_NO        ,                                
                     COMPANY_NO        ,                                
                     RECEIVED_TS       ,                                
                     TRANS_OCCURS_TS   ,                                
                     TRANS_DATA_1      ,                                
                     TRANS_DATA_2      ,                                
                     TRANS_DATA_3      ,                                
                     TRANS_DATA_4)                                      
               VALUES                                                   
                   (:TL-TRANS-ID-CD    ,                                
                    :TL-ACCOUNT-NO     ,                                
                    :TL-COMPANY-NO     ,                                
                    CIS.CURRENT$TIMESTAMP()  ,                                
                    CIS.CURRENT$TIMESTAMP()  ,                                
                    :TL-TRANS-DATA-1   ,                                
                    :TL-TRANS-DATA-2   ,                                
                    :TL-TRANS-DATA-3   ,                                
                    :TL-TRANS-DATA-4)                                   
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                     17100000
MFA-TR*       INSERT INTO CSS_MKT_TRAN_INFO                             17110000
MFA-TR*             (TRANS_ID_CD       ,                                17120000
MFA-TR*              ACCOUNT_NO        ,                                17130000
MFA-TR*              COMPANY_NO        ,                                17140000
MFA-TR*              RECEIVED_TS       ,                                17150000
MFA-TR*              TRANS_OCCURS_TS   ,                                17160000
MFA-TR*              TRANS_DATA_1      ,                                17170000
MFA-TR*              TRANS_DATA_2      ,                                17180000
MFA-TR*              TRANS_DATA_3      ,                                17190000
MFA-TR*              TRANS_DATA_4)                                      17200000
MFA-TR*        VALUES                                                   17210000
MFA-TR*            (:TL-TRANS-ID-CD    ,                                17220000
MFA-TR*             :TL-ACCOUNT-NO     ,                                17230000
MFA-TR*             :TL-COMPANY-NO     ,                                17240000
MFA-TR*             CURRENT TIMESTAMP  ,                                17250000
MFA-TR*             CURRENT TIMESTAMP  ,                                17260000
MFA-TR*             :TL-TRANS-DATA-1   ,                                17270000
MFA-TR*             :TL-TRANS-DATA-2   ,                                17280000
MFA-TR*             :TL-TRANS-DATA-3   ,                                17290000
MFA-TR*             :TL-TRANS-DATA-4)                                   17300000
MFA-TR*    END-EXEC.                                                    17310000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE '8505'                    TO ACTIVE-PARAGRAPH       
               MOVE 'INSERT'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_MKT_TRAN_INFO'       TO TABLE-1                
               MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
               MOVE 'TRANS_ID_CD'             TO TABLE-ELEMENT-2        
               MOVE 'TRANS_DATA_1'            TO TABLE-ELEMENT-3        
               MOVE 'TRANS_DATA_2'            TO TABLE-ELEMENT-4        
               MOVE RS-ACCOUNT-NO-054         TO HOSTVAR-ELEMENT-1      
               MOVE TL-TRANS-ID-CD            TO HOSTVAR-ELEMENT-2      
               MOVE TL-TRANS-DATA-1-TEXT (1:20) TO HOSTVAR-ELEMENT-3    
               MOVE TL-TRANS-DATA-2-TEXT (1:20) TO HOSTVAR-ELEMENT-4    
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8505-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************17600000
      * 8515-CHECK-CUSTOMER-NO                                         *17610000
      ******************************************************************17620000
       8515-CHECK-CUSTOMER-NO.                                          
                                                                        
           MOVE '8515'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           MOVE PARM-LANDLORD-CUST-NO         TO CU-CUSTOMER-NO.        
                                                                        
           EXEC SQL                                                     
              SELECT  CUSTOMER_NO                                       
                INTO  :CU-CUSTOMER-NO                                   
                FROM  CSS_CUSTOMER                                      
               WHERE  CUSTOMER_NO = :CU-CUSTOMER-NO                     
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     17690000
MFA-TR*       SELECT  CUSTOMER_NO                                       17700000
MFA-TR*         INTO  :CU-CUSTOMER-NO                                   17710000
MFA-TR*         FROM  CSS_CUSTOMER                                      17720000
MFA-TR*        WHERE  CUSTOMER_NO = :CU-CUSTOMER-NO                     17730000
MFA-TR*        QUERYNO 8515                                             17740000
MFA-TR*    END-EXEC.                                                    17750000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE 'SELECT'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_CUSTOMER'            TO TABLE-1                
               MOVE 'CUSTOMER_NO'             TO TABLE-ELEMENT-1        
               MOVE PARM-LANDLORD-CUST-NO     TO HOSTVAR-ELEMENT-1      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8515-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************17970000
      * 8525-SET-MST-SUB-IND                                           *17980000
      ******************************************************************17990000
       8525-SET-MST-SUB-IND.                                            
                                                                        
           MOVE '8525'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           MOVE RS-ACCOUNT-NO-054             TO AT-ACCOUNT-NO.         
           MOVE WS-MASTER                     TO AT-MST-SUB-ACCT-IND.   
           MOVE WS-CYCLE-21                   TO AT-BILL-CYCLE.         
           MOVE WS-ACTIVE                     TO AT-CODE-ACCT-STAT.     
           MOVE WS-A                          TO AT-CODE-STATUS-REASON. 
           MOVE WS-MONTHLY                    TO AT-CODE-BILL-FREQ.     
           MOVE WS-MASTER                     TO AT-CREDIT-GROUP.       
           MOVE 25                            TO AT-NO-MO-ONLINE-HIST.  
           MOVE '1'                           TO AT-PRINT-TYPE-CD.      
           MOVE 25                            TO AT-NO-MO-BILL-HIST.    
           MOVE WS-N                          TO AT-CT-METER-RATED-IND. 
                                                                        
           EXEC SQL                                                     
              UPDATE  CSS_ACCOUNT                                       
                 SET  NXT_BILL_NO           = 1,                        
                      CODE_PRNT_BLL_MST     = 'A',                      
                      ACCOUNT_TYPE_CODE     = 'B',                      
                      MST_SUB_ACCT_IND      = :AT-MST-SUB-ACCT-IND,     
                      BILL_CYCLE            = :AT-BILL-CYCLE,           
                      CODE_ACCT_STAT        = :AT-CODE-ACCT-STAT,       
                      CODE_STATUS_REASON    = :AT-CODE-STATUS-REASON,   
                      CODE_BILL_FREQ        = :AT-CODE-BILL-FREQ,       
                      CREDIT_GROUP          = :AT-CREDIT-GROUP,         
                      NO_MO_ONLINE_HIST     = :AT-NO-MO-ONLINE-HIST,    
                      PRINT_TYPE_CD         = :AT-PRINT-TYPE-CD,        
                      NO_MO_BILL_HIST       = :AT-NO-MO-BILL-HIST,      
                      CT_METER_RATED_IND    = :AT-CT-METER-RATED-IND    
               WHERE  ACCOUNT_NO            = :AT-ACCOUNT-NO            
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     18160000
MFA-TR*       UPDATE  CSS_ACCOUNT                                       18170000
MFA-TR*          SET  NXT_BILL_NO           = 1,                        18180000
MFA-TR*               CODE_PRNT_BLL_MST     = 'A',                      18190000
MFA-TR*               ACCOUNT_TYPE_CODE     = 'B',                      18200000
MFA-TR*               MST_SUB_ACCT_IND      = :AT-MST-SUB-ACCT-IND,     18210000
MFA-TR*               BILL_CYCLE            = :AT-BILL-CYCLE,           18220000
MFA-TR*               CODE_ACCT_STAT        = :AT-CODE-ACCT-STAT,       18230000
MFA-TR*               CODE_STATUS_REASON    = :AT-CODE-STATUS-REASON,   18240000
MFA-TR*               CODE_BILL_FREQ        = :AT-CODE-BILL-FREQ,       18250000
MFA-TR*               CREDIT_GROUP          = :AT-CREDIT-GROUP,         18260000
MFA-TR*               NO_MO_ONLINE_HIST     = :AT-NO-MO-ONLINE-HIST,    18270000
MFA-TR*               PRINT_TYPE_CD         = :AT-PRINT-TYPE-CD,        18280000
MFA-TR*               NO_MO_BILL_HIST       = :AT-NO-MO-BILL-HIST,      18290000
MFA-TR*               CT_METER_RATED_IND    = :AT-CT-METER-RATED-IND    18300000
MFA-TR*        WHERE  ACCOUNT_NO            = :AT-ACCOUNT-NO            18310000
MFA-TR*        QUERYNO 8525                                             18320000
MFA-TR*    END-EXEC.                                                    18330000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE 'UPDATE'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_ACCOUNT'             TO TABLE-1                
               MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
               MOVE AT-ACCOUNT-NO             TO HOSTVAR-ELEMENT-1      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8525-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************18550000
      * 8530-UPD-AT-CUSTOMER.                                          *18560000
      ******************************************************************18570000
       8530-UPD-AT-CUSTOMER.                                            
                                                                        
           MOVE '8530'                        TO ACTIVE-PARAGRAPH.      
                                                                        
           EXEC SQL                                                     
              UPDATE  CSS_ACCOUNT                                       
                 SET  CUSTOMER_NO = :AT-CUSTOMER-NO                     
               WHERE  ACCOUNT_NO = :AT-ACCOUNT-NO                       
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     18620000
MFA-TR*       UPDATE  CSS_ACCOUNT                                       18630000
MFA-TR*          SET  CUSTOMER_NO = :AT-CUSTOMER-NO                     18640000
MFA-TR*        WHERE  ACCOUNT_NO = :AT-ACCOUNT-NO                       18650000
MFA-TR*        QUERYNO 8530                                             18660000
MFA-TR*    END-EXEC.                                                    18670000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE 'UPDATE'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_ACCOUNT'             TO TABLE-1                
               MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
               MOVE AT-ACCOUNT-NO             TO HOSTVAR-ELEMENT-1      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8530-EXIT.                                                       
           EXIT.                                                        
                                                                        
ACN   ******************************************************************18890000
ACN   * 8535-GET-LANDLORD-RATE                                         *18900000
ACN   ******************************************************************18910000
ACN    8535-GET-LANDLORD-RATE.                                          
ACN                                                                     
ACN        MOVE '8535'                        TO ACTIVE-PARAGRAPH.      
ACN                                                                     
ACN        MOVE PARM-LANDLORD-ACCT-NO         TO XM-ACCOUNT-NO.         
ACN                                                                     
ACN        EXEC SQL                                                     
ACN           SELECT  RATE_SCHEDULE                                     
ACN             INTO  :XM-RATE-SCHEDULE                                 
ACN             FROM  CSS_MKT_XREF_ACCT                                 
ACN            WHERE  ACCOUNT_NO = :XM-ACCOUNT-NO                       
                                                            
ACN        END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     18980000
MFA-TR*       SELECT  RATE_SCHEDULE                                     18990000
MFA-TR*         INTO  :XM-RATE-SCHEDULE                                 19000000
MFA-TR*         FROM  CSS_MKT_XREF_ACCT                                 19010000
MFA-TR*        WHERE  ACCOUNT_NO = :XM-ACCOUNT-NO                       19020000
MFA-TR*        QUERYNO 8535                                             19030000
MFA-TR*    END-EXEC.                                                    19040000

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

ACN                                                                     
ACN        MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
ACN                                                                     
ACN        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
ACN            MOVE XM-RATE-SCHEDULE          TO WS-MASTER-RATE-SCHED   
ACN        ELSE                                                         
ACN            MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
ACN            MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
ACN            MOVE 'SELECT'                  TO ABEND-FUNCTION         
ACN            MOVE SPACES                    TO ABEND-SQL-PREDICATES   
ACN                                              ABEND-TABLES           
ACN            MOVE 'CSS_MKT_XREF_ACCT'       TO TABLE-1                
ACN            MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1        
ACN            MOVE PARM-LANDLORD-ACCT-NO     TO HOSTVAR-ELEMENT-1      
ACN            PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
ACN            PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
ACN        END-IF.                                                      
ACN                                                                     
ACN    8535-EXIT.                                                       
ACN        EXIT.                                                        
                                                                        
ACN   ******************************************************************19260000
ACN   * 8545-GET-ZIP-CODE-TOKEN                                        *19270000
ACN   ******************************************************************19280000
ACN    8545-GET-ZIP-CODE-TOKEN.                                         
ACN                                                                     
ACN        MOVE '8545'                        TO ACTIVE-PARAGRAPH.      
ACN                                                                     
ACN        MOVE PARM-ZIP-CODE-037             TO A4-ZIP-CODE.           
ACN        MOVE PARM-CITY-037                 TO A4-TOWN.               
ACN        MOVE PARM-STATE-037                TO A4-STATE.              
ACN                                                                     
ACN        EXEC SQL                                                     
ACN           SELECT  ZIP_CODE_TOKEN                                    
ACN             INTO  :A4-ZIP-CODE-TOKEN                                
ACN             FROM  CSS_ZIP_CODE                                      
ACN            WHERE  ZIP_CODE = :A4-ZIP-CODE                           
ACN              AND  TOWN     = :A4-TOWN                               
ACN              AND  STATE    = :A4-STATE                              
                                                            
ACN        END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     19370000
MFA-TR*       SELECT  ZIP_CODE_TOKEN                                    19380000
MFA-TR*         INTO  :A4-ZIP-CODE-TOKEN                                19390000
MFA-TR*         FROM  CSS_ZIP_CODE                                      19400000
MFA-TR*        WHERE  ZIP_CODE = :A4-ZIP-CODE                           19410000
MFA-TR*          AND  TOWN     = :A4-TOWN                               19420000
MFA-TR*          AND  STATE    = :A4-STATE                              19430000
MFA-TR*        QUERYNO 8545                                             19440000
MFA-TR*    END-EXEC.                                                    19450000

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

ACN                                                                     
ACN        MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
ACN                                                                     
ACN        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
ACN            MOVE A4-ZIP-CODE-TOKEN         TO PARM-ZIP-CODE-TOKEN-037
ACN        ELSE                                                         
ACN            MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
ACN            MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
ACN            MOVE 'SELECT'                  TO ABEND-FUNCTION         
ACN            MOVE SPACES                    TO ABEND-SQL-PREDICATES   
ACN                                              ABEND-TABLES           
ACN            MOVE 'CSS_ZIP_CODE'            TO TABLE-1                
ACN            MOVE 'ZIP_CODE'                TO TABLE-ELEMENT-1        
ACN            MOVE PARM-ZIP-CODE-037         TO HOSTVAR-ELEMENT-1      
ACN            MOVE 'TOWN'                    TO TABLE-ELEMENT-2        
ACN            MOVE PARM-CITY-037             TO HOSTVAR-ELEMENT-2      
ACN            MOVE 'STATE'                   TO TABLE-ELEMENT-3        
ACN            MOVE PARM-STATE-037            TO HOSTVAR-ELEMENT-3      
ACN            PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
ACN            PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
ACN        END-IF.                                                      
ACN                                                                     
ACN    8545-EXIT.                                                       
ACN        EXIT.                                                        
                                                                        
ACN   ******************************************************************19710000
ACN   * 8555-GET-REV-DIST-CODE                                         *19720000
ACN   ******************************************************************19730000
ACN    8555-GET-REV-DIST-CODE.                                          
ACN                                                                     
ACN        MOVE '8555'                        TO ACTIVE-PARAGRAPH.      
ACN                                                                     
ACN        MOVE PARM-LOCAL-OFFICE-380         TO T4-LOCAL-OFFICE.       
ACN                                                                     
ACN        EXEC SQL                                                     
ACN           SELECT  MAX(REV_DISTRICT_CD)                              
ACN             INTO  :T4-REV-DISTRICT-CD                               
ACN             FROM  CSS_LOCOFF_REVDIST                                
ACN            WHERE  LOCAL_OFFICE = :T4-LOCAL-OFFICE                   
                                                            
ACN        END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     19800000
MFA-TR*       SELECT  MAX(REV_DISTRICT_CD)                              19810000
MFA-TR*         INTO  :T4-REV-DISTRICT-CD                               19820000
MFA-TR*         FROM  CSS_LOCOFF_REVDIST                                19830000
MFA-TR*        WHERE  LOCAL_OFFICE = :T4-LOCAL-OFFICE                   19840000
MFA-TR*        QUERYNO 8555                                             19850000
MFA-TR*    END-EXEC.                                                    19860000

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

ACN                                                                     
ACN        MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
ACN                                                                     
ACN        IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
ACN            MOVE T4-REV-DISTRICT-CD        TO PARM-REV-DIST-CD-380   
ACN        ELSE                                                         
ACN            MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
ACN            MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
ACN            MOVE 'SELECT'                  TO ABEND-FUNCTION         
ACN            MOVE SPACES                    TO ABEND-SQL-PREDICATES   
ACN                                              ABEND-TABLES           
ACN            MOVE 'CSS_LOCOFF_REVDIST'      TO TABLE-1                
ACN            MOVE 'LOCAL_OFFICE'            TO TABLE-ELEMENT-1        
ACN            MOVE PARM-LOCAL-OFFICE-380     TO HOSTVAR-ELEMENT-1      
ACN            PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
ACN            PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
ACN        END-IF.                                                      
ACN                                                                     
ACN    8555-EXIT.                                                       
ACN        EXIT.                                                        
                                                                        
      ******************************************************************20700000
AMG   * 8575-CHECK-DIST-ACCT-NO                                        *20710000
AMG   ******************************************************************20720000
AMG    8575-CHECK-DIST-ACCT-NO.                                         
AMG                                                                     
AMG        EXEC SQL                                                     
AMG           SELECT  DISTINCT('Y')    ,                                
WMG                   SIGN_UP_STATUS_CD,                                
WMG                   ACCOUNT_NO                                        
AMG             INTO  :WS-CHECK-XREF-ACCT  ,                            
WMG                   :XM-SIGN-UP-STATUS-CD,                            
WMG                   :XM-ACCOUNT-NO                                    
AMG             FROM  CSS_MKT_XREF_ACCT                                 
AMG            WHERE  DIST_ACCT_NO      = :PARM-ORIG-DIST-ACCT-NO       
AMG               OR  ORIG_DIST_ACCT_NO = :PARM-ORIG-DIST-ACCT-NO       
                                                            
AMG        END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     20750000
MFA-TR*       SELECT  DISTINCT('Y')    ,                                20760000
MFA-TR*               SIGN_UP_STATUS_CD,                                20770000
MFA-TR*               ACCOUNT_NO                                        20780000
MFA-TR*         INTO  :WS-CHECK-XREF-ACCT  ,                            20790000
MFA-TR*               :XM-SIGN-UP-STATUS-CD,                            20800000
MFA-TR*               :XM-ACCOUNT-NO                                    20810000
MFA-TR*         FROM  CSS_MKT_XREF_ACCT                                 20820000
MFA-TR*        WHERE  DIST_ACCT_NO      = :PARM-ORIG-DIST-ACCT-NO       20830000
MFA-TR*           OR  ORIG_DIST_ACCT_NO = :PARM-ORIG-DIST-ACCT-NO       20840000
MFA-TR*        QUERYNO 8575                                             20850000
MFA-TR*    END-EXEC.                                                    20860000

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

AMG                                                                     
AMG        MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
AMG                                                                     
AMG        IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
AMG            MOVE WS-N                      TO SW-DUPLICATE           
AMG        ELSE                                                         
AMG            IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL               
AMG              MOVE WS-Y                      TO SW-DUPLICATE         
AMG            ELSE                                                     
AMG              MOVE PROGRAM-NAME              TO ABEND-PROGRAM        
AMG              MOVE '8575'                    TO ACTIVE-PARAGRAPH     
AMG              MOVE 'SELECT'                  TO ABEND-FUNCTION       
AMG              MOVE SPACES                    TO ABEND-SQL-PREDICATES 
AMG                                                ABEND-TABLES         
AMG              MOVE 'CSS_MKT_XREF_ACCT'       TO TABLE-1              
AMG              MOVE '(ORIG_)DIST_ACCT_NO'     TO TABLE-ELEMENT-1      
AMG              MOVE PARM-ORIG-DIST-ACCT-NO    TO HOSTVAR-ELEMENT-1    
AMG              PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT          
AMG              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT          
AMG            END-IF                                                   
AMG        END-IF.                                                      
AMG                                                                     
AMG    8575-EXIT.                                                       
AMG        EXIT.                                                        
                                                                        
      ******************************************************************21120000
      * 8580-OBTAIN-ACCT-INFO,                                         *21130000
      ******************************************************************21140000
       8580-OBTAIN-ACCT-INFO.                                           
                                                                        
           EXEC SQL                                                     
              SELECT CUSTOMER_NO,                                       
                     PREMISE_NO                                         
                INTO :AT-CUSTOMER-NO,                                   
                     :AT-PREMISE-NO                                     
                FROM CSS_ACCOUNT                                        
               WHERE ACCOUNT_NO = :XM-ACCOUNT-NO                        
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     21170000
MFA-TR*       SELECT CUSTOMER_NO,                                       21180000
MFA-TR*              PREMISE_NO                                         21190000
MFA-TR*         INTO :AT-CUSTOMER-NO,                                   21200000
MFA-TR*              :AT-PREMISE-NO                                     21210000
MFA-TR*         FROM CSS_ACCOUNT                                        21220000
MFA-TR*        WHERE ACCOUNT_NO = :XM-ACCOUNT-NO                        21230000
MFA-TR*        QUERYNO 8580                                             21240000
MFA-TR*    END-EXEC.                                                    21250000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE '8580'                    TO ACTIVE-PARAGRAPH        
              MOVE 'SELECT'                  TO ABEND-FUNCTION          
              MOVE SPACES                    TO ABEND-SQL-PREDICATES    
                                                ABEND-TABLES            
              MOVE 'CSS_ACCOUNT'             TO TABLE-1                 
              MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1         
              MOVE XM-ACCOUNT-NO             TO HOSTVAR-ELEMENT-1       
              PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       8580-EXIT.                                                       
           EXIT.                                                        
                                                                        
P00778******************************************************************21470000
P00778* 8590-SELECT-ACCT-INFO,                                         *21480000
P00778******************************************************************21490000
       8590-SELECT-ACCT-INFO.                                           
                                                                        
           MOVE WS-PREMISE-NO        TO AT-PREMISE-NO                   
                                                                        
           EXEC SQL                                                     
              SELECT TOP(1) CUSTOMER_NO,
              PREMISE_NO                                         
                INTO :AT-CUSTOMER-NO,                                   
                     :AT-PREMISE-NO                                     
                FROM CSS_ACCOUNT                                        
               WHERE PREMISE_NO = :AT-PREMISE-NO                        
               AND CODE_ACCT_STAT = 'P'                                 
                                                  
                                                            
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ020
MFA-TR*    EXEC SQL                                                     21540000
MFA-TR*       SELECT CUSTOMER_NO,                                       21550000
MFA-TR*              PREMISE_NO                                         21560000
MFA-TR*         INTO :AT-CUSTOMER-NO,                                   21570000
MFA-TR*              :AT-PREMISE-NO                                     21580000
MFA-TR*         FROM CSS_ACCOUNT                                        21590000
MFA-TR*        WHERE PREMISE_NO = :AT-PREMISE-NO                        21600000
MFA-TR*        AND CODE_ACCT_STAT = 'P'                                 21610000
MFA-TR*        FETCH FIRST 1 ROW ONLY                                   21620000
MFA-TR*        QUERYNO 8590                                             21630000
MFA-TR*    END-EXEC.                                                    21640000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
              NEXT SENTENCE                                             
           ELSE                                                         
              MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
              MOVE '8590'                    TO ACTIVE-PARAGRAPH        
              MOVE 'SELECT'                  TO ABEND-FUNCTION          
              MOVE SPACES                    TO ABEND-SQL-PREDICATES    
                                                ABEND-TABLES            
              MOVE 'CSS_ACCOUNT'             TO TABLE-1                 
              MOVE 'PREMISE_NO'              TO TABLE-ELEMENT-1         
              MOVE AT-PREMISE-NO             TO HOSTVAR-ELEMENT-1       
              PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
       8590-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************21870000
      * 8600-GET-CRM-TIER-INFO                                         *21880000
      ******************************************************************21890000
C34569 8600-GET-CRM-TIER-INFO.                                          
                                                                        
C34569     EXEC SQL                                                     
C34569        SELECT V5.CIS_VALUE                                       
C34569          INTO :V5-CIS-VALUE                                      
C34569          FROM CSS_MKT_VAL_TRANS V5                               
C34569         WHERE V5.MKT_ID_CD = 'AGL'                               
C34569           AND V5.VALUE_ID = 'H'                                  
C34569           AND V5.MKT_ID_VALUE = :PARM-AGL-RATE-PLAN              
                                                            
C34569     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     21920000
MFA-TR*       SELECT V5.CIS_VALUE                                       21930000
MFA-TR*         INTO :V5-CIS-VALUE                                      21940000
MFA-TR*         FROM CSS_MKT_VAL_TRANS V5                               21950000
MFA-TR*        WHERE V5.MKT_ID_CD = 'AGL'                               21960000
MFA-TR*          AND V5.VALUE_ID = 'H'                                  21970000
MFA-TR*          AND V5.MKT_ID_VALUE = :PARM-AGL-RATE-PLAN              21980000
MFA-TR*        QUERYNO 8600                                             21990000
MFA-TR*    END-EXEC.                                                    22000000

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

                                                                        
C34569     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
C34569     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C34569        MOVE V5-CIS-VALUE    TO WS-CIS-VALUE                      
C34569        MOVE WS-TIER-RANKING TO WS-TIER-RANKING-RED               
C34569     ELSE                                                         
C34569        MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
C34569        MOVE '8600'                    TO ACTIVE-PARAGRAPH        
C34569        MOVE 'SELECT'                  TO ABEND-FUNCTION          
C34569        MOVE SPACES                    TO ABEND-SQL-PREDICATES    
C34569                                          ABEND-TABLES            
C34569        MOVE 'CSS_MKT_VAL_TRANS'       TO TABLE-1                 
C34569        MOVE 'MKT_ID_CD'               TO TABLE-ELEMENT-1         
C34569        MOVE 'AGL'                     TO HOSTVAR-ELEMENT-1       
C34569        MOVE 'VALUE_ID'                TO TABLE-ELEMENT-2         
C34569        MOVE 'H'                       TO HOSTVAR-ELEMENT-2       
C34569        MOVE 'MKT_ID_VALUE'            TO TABLE-ELEMENT-3         
C34569        MOVE PARM-AGL-RATE-PLAN        TO HOSTVAR-ELEMENT-3       
C34569        PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
C34569        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
C34569     END-IF.                                                      
                                                                        
C34569 8600-EXIT.                                                       
C34569     EXIT.                                                        
                                                                        
      ******************************************************************22270000
      * 8605-GET-OFFER-OPTION                                          *22280000
      ******************************************************************22290000
C34569 8605-GET-OFFER-OPTION.                                           
                                                                        
C34569     MOVE WS-TIER-ACCT-TYPE-CD TO DU-TIER-ACCT-TYPE-CD            
C34569                                  WS-TIER-ACCT-TYPE-CD-O.         
C34569     MOVE WS-TIER-RANKING-RED  TO DU-MKT-TIER-RANKING.            
                                                                        
C34569     EXEC SQL                                                     
C34569        SELECT E9.OPTION_CD,                                      
C34569               E9.OFFER_CD                                        
C34569          INTO :E9-OPTION-CD,                                     
C34569               :E9-OFFER-CD                                       
C34569          FROM CRM_OFF_MKT_TIER DU,                               
C34569               CRM_OFFER_OPTION E9                                
C34569         WHERE DU.COMPANY_NO = E9.COMPANY_NO                      
C34569           AND E9.OFFER_CD = DU.OFFER_CD                          
C34569           AND DU.TIER_CUST_STAT_CD  = 'P'                        
C34569           AND DU.TIER_ACCT_TYPE_CD  = :DU-TIER-ACCT-TYPE-CD      
C34569           AND DU.MKT_TIER_RANKING   = :DU-MKT-TIER-RANKING       
C34569           AND DU.TIER_DEFLT_OFFR_CD = 'Y'                        
P00269           AND E9.OFFER_OPT_START_DT <= CAST(SYSDATETIMEOFFSET() 
           AS DATE)              
P00269           AND E9.OFFER_OPT_END_DT   >= CAST(SYSDATETIMEOFFSET() 
           AS DATE)              
P00473           AND DU.OFF_TIER_VSTART_TS <= CIS.CURRENT$TIMESTAMP()         
P00473           AND DU.OFF_TIER_VEND_TS   >= CIS.CURRENT$TIMESTAMP()         
P00473           AND DU.PROC_STATUS_CD = 'AC'                           
P00473           AND E9.OFF_OPT_VSTART_TS  <= CIS.CURRENT$TIMESTAMP()         
P00473           AND E9.OFF_OPT_VEND_TS    >= CIS.CURRENT$TIMESTAMP()         
P00473           AND E9.PROC_STATUS_CD = 'AC'                           
C34569           AND E9.OPTION_SORT_SEQ_NO =                            
C34569              (SELECT MAX(E92.OPTION_SORT_SEQ_NO)                 
C34569                 FROM CRM_OFFER_OPTION E92                        
C34569                WHERE E9.OFFER_CD = E92.OFFER_CD                  
P00269                  AND E92.OFFER_OPT_START_DT <= 
           CAST(SYSDATETIMEOFFSET() AS DATE)      
P00269                  AND E92.OFFER_OPT_END_DT   >= 
           CAST(SYSDATETIMEOFFSET() AS DATE)      
P00473                  AND E92.OFF_OPT_VSTART_TS  <= 
           CIS.CURRENT$TIMESTAMP() 
P00473                  AND E92.OFF_OPT_VEND_TS    >= 
           CIS.CURRENT$TIMESTAMP() 
P00473                  AND E92.PROC_STATUS_CD = 'AC')                  
                                                            
C34569     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ028
MFA-TR*    EXEC SQL                                                     22360000
MFA-TR*       SELECT E9.OPTION_CD,                                      22370000
MFA-TR*              E9.OFFER_CD                                        22380000
MFA-TR*         INTO :E9-OPTION-CD,                                     22390000
MFA-TR*              :E9-OFFER-CD                                       22400000
MFA-TR*         FROM CRM_OFF_MKT_TIER DU,                               22410000
MFA-TR*              CRM_OFFER_OPTION E9                                22420000
MFA-TR*        WHERE DU.COMPANY_NO = E9.COMPANY_NO                      22430000
MFA-TR*          AND E9.OFFER_CD = DU.OFFER_CD                          22440000
MFA-TR*          AND DU.TIER_CUST_STAT_CD  = 'P'                        22450000
MFA-TR*          AND DU.TIER_ACCT_TYPE_CD  = :DU-TIER-ACCT-TYPE-CD      22460000
MFA-TR*          AND DU.MKT_TIER_RANKING   = :DU-MKT-TIER-RANKING       22470000
MFA-TR*          AND DU.TIER_DEFLT_OFFR_CD = 'Y'                        22480000
MFA-TR*          AND E9.OFFER_OPT_START_DT <= CURRENT DATE              22490000
MFA-TR*          AND E9.OFFER_OPT_END_DT   >= CURRENT DATE              22500000
MFA-TR*          AND DU.OFF_TIER_VSTART_TS <= CURRENT TIMESTAMP         22510000
MFA-TR*          AND DU.OFF_TIER_VEND_TS   >= CURRENT TIMESTAMP         22520000
MFA-TR*          AND DU.PROC_STATUS_CD = 'AC'                           22530000
MFA-TR*          AND E9.OFF_OPT_VSTART_TS  <= CURRENT TIMESTAMP         22540000
MFA-TR*          AND E9.OFF_OPT_VEND_TS    >= CURRENT TIMESTAMP         22550000
MFA-TR*          AND E9.PROC_STATUS_CD = 'AC'                           22560000
MFA-TR*          AND E9.OPTION_SORT_SEQ_NO =                            22570000
MFA-TR*             (SELECT MAX(E92.OPTION_SORT_SEQ_NO)                 22580000
MFA-TR*                FROM CRM_OFFER_OPTION E92                        22590000
MFA-TR*               WHERE E9.OFFER_CD = E92.OFFER_CD                  22600000
MFA-TR*                 AND E92.OFFER_OPT_START_DT <= CURRENT DATE      22610000
MFA-TR*                 AND E92.OFFER_OPT_END_DT   >= CURRENT DATE      22620000
MFA-TR*                 AND E92.OFF_OPT_VSTART_TS  <= CURRENT TIMESTAMP 22630000
MFA-TR*                 AND E92.OFF_OPT_VEND_TS    >= CURRENT TIMESTAMP 22640000
MFA-TR*                 AND E92.PROC_STATUS_CD = 'AC')                  22650000
MFA-TR*        QUERYNO 8605                                             22660000
MFA-TR*    END-EXEC.                                                    22670000

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

                                                                        
C34569     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
C34569     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C34569        MOVE E9-OPTION-CD TO WS-OPTION-CD-O                       
C34569        MOVE E9-OFFER-CD  TO WS-OFFER-CD-O                        
C34569     ELSE                                                         
C34569        MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
C34569        MOVE '8605'                    TO ACTIVE-PARAGRAPH        
C34569        MOVE 'SELECT'                  TO ABEND-FUNCTION          
C34569        MOVE SPACES                    TO ABEND-SQL-PREDICATES    
C34569                                          ABEND-TABLES            
C34569        MOVE 'CRM_OFF_MKT_TIER'        TO TABLE-1                 
C34569        MOVE 'TIER_ACCT_TYPE_CD'       TO TABLE-ELEMENT-1         
C34569        MOVE DU-TIER-ACCT-TYPE-CD      TO HOSTVAR-ELEMENT-1       
C34569        MOVE 'MKT_TIER_RANKING'        TO TABLE-ELEMENT-2         
C34569        MOVE DU-MKT-TIER-RANKING       TO HOSTVAR-ELEMENT-2       
C34569        PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
C34569        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
C34569     END-IF.                                                      
                                                                        
C34569 8605-EXIT.                                                       
C34569     EXIT.                                                        
                                                                        
      ******************************************************************22920000
      * 8610-CALL-MCSCB326                                             *22930000
      ******************************************************************22940000
C34569 8610-CALL-MCSCB326.                                              
                                                                        
C34569     MOVE 'COMMONDATE'        TO G6-PROGRAM-NAME                  
C34569     MOVE 'CA00'              TO G6-CMND-CODE                     
C34569     MOVE '01'                TO G6-COMPANY-NO                    
C34569     MOVE 0                   TO G6-SEQ-NO                        
                                                                        
C34569     PERFORM 8615-GET-COMMON-DATE THRU 8615-EXIT.                 
                                                                        
C34569     MOVE RS-ACCOUNT-NO-054   TO WS-ACCOUNT-NO-O.                 
C34569     MOVE 'CSR02380'          TO WS-APPL-PGMID.                   
C34569     MOVE 'G'                 TO WS-CODE-UTIL-TYPE-O.             
C34569     MOVE '0001'              TO WS-IC-NO-O.                      
C34569     MOVE 'I'                 TO WS-PROCESS-CD-O.                 
C34569     MOVE 'N'                 TO WS-EXIT-FEE-FLAG-O.              
C34569     MOVE 'CSR02380'          TO LS-MCSCB326-CALL-TYPE.           
C34569     MOVE 'SYSTEM'            TO WS-CREATED-USER-ID-O.            
C34569     MOVE 'P'                 TO WS-TIER-CUST-STAT-CD-O.          
C34569     EVALUATE WS-TIER-ACCT-TYPE-CD                                
C34569         WHEN 'D'                                                 
C34569            MOVE '010' TO WS-CODE-REV-CLASS-O                     
C34569         WHEN 'S'                                                 
C34569            MOVE '020' TO WS-CODE-REV-CLASS-O                     
C34569         WHEN OTHER                                               
C34569            MOVE SPACES TO WS-CODE-REV-CLASS-O                    
C34569     END-EVALUATE.                                                
                                                                        
C34569     CALL MCSCB326 USING ABEND-FILE                               
C34569                        ,WS-WARNING-DATA-ELEMENTS                 
C34569                        ,LS-MCSCB326-CALL-TYPE                    
C34569                        ,LS-MCSCB326-ONLINE-CALL                  
C34569                        ,LS-MCSCB326-RET-FIELDS.                  
                                                                        
C34569     IF WS-ACTIVE-RETURN-CODE > ZEROES                            
C34569        MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
C34569        MOVE '8610'                    TO ACTIVE-PARAGRAPH        
C34569        MOVE 'CALL MCSCB326'           TO ABEND-FUNCTION          
C34569        MOVE SPACES                    TO ABEND-SQL-PREDICATES    
C34569                                          ABEND-TABLES            
C34569        MOVE 'ACCOUNT_NO'              TO TABLE-ELEMENT-1         
C34569        MOVE WS-ACCOUNT-NO-O           TO HOSTVAR-ELEMENT-1       
C34569        MOVE 'OPTION_CD'               TO TABLE-ELEMENT-2         
C34569        MOVE WS-OPTION-CD-O            TO HOSTVAR-ELEMENT-2       
C34569        MOVE 'OFEER_CD'                TO TABLE-ELEMENT-2         
C34569        MOVE WS-OFFER-CD-O             TO HOSTVAR-ELEMENT-2       
C34569        PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
C34569        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
                                                                        
C34569 8610-EXIT.                                                       
C34569     EXIT.                                                        
      ******************************************************************23460000
C34569* 8615-GET-COMMON-DATE.                                           23470000
      ******************************************************************23480000
C34569 8615-GET-COMMON-DATE.                                            
                                                                        
C34569     EXEC SQL                                                     
C34569        SELECT G6.PARM_DATA,                                      
C34569               REPLACE(REPLACE(CONVERT(CHAR(26), 
           CIS.CURRENT$TIMESTAMP(), 121), ' ', '-'), ':', '.')                 
C34569          INTO :G6-PARM-DATA,                                     
C34569               :WS-CURRENT-TIMESTAMP                              
C34569          FROM CSS_JOB_PARM G6 WITH(READUNCOMMITTED)                      
C34569         WHERE G6.PROGRAM_NAME   = :G6-PROGRAM-NAME               
C34569           AND G6.CMND_CODE      = :G6-CMND-CODE                  
C34569           AND G6.COMPANY_NO     = :G6-COMPANY-NO                 
C34569           AND G6.SEQ_NO         = :G6-SEQ-NO                     
C34569           AND G6.STATUS         = 'A'                            
C34569                                                           
                                                            
C34569     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR* MSQ022
MFA-TR* MSQ028
MFA-TR* MSQ061
MFA-TR*    EXEC SQL                                                     23510000
MFA-TR*       SELECT G6.PARM_DATA,                                      23520000
MFA-TR*              CURRENT TIMESTAMP                                  23530000
MFA-TR*         INTO :G6-PARM-DATA,                                     23540000
MFA-TR*              :WS-CURRENT-TIMESTAMP                              23550000
MFA-TR*         FROM CSS_JOB_PARM G6                                    23560000
MFA-TR*        WHERE G6.PROGRAM_NAME   = :G6-PROGRAM-NAME               23570000
MFA-TR*          AND G6.CMND_CODE      = :G6-CMND-CODE                  23580000
MFA-TR*          AND G6.COMPANY_NO     = :G6-COMPANY-NO                 23590000
MFA-TR*          AND G6.SEQ_NO         = :G6-SEQ-NO                     23600000
MFA-TR*          AND G6.STATUS         = 'A'                            23610000
MFA-TR*          WITH UR                                                23620000
MFA-TR*        QUERYNO 8615                                             23630000
MFA-TR*    END-EXEC.                                                    23640000

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

                                                                        
C34569     MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE. 
                                                                        
C34569     IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                   
C34569        MOVE G6-PARM-DATA    TO WS-OPT-AGRMT-EFF-DT-O             
C34569        MOVE WS-CURRENT-TIMESTAMP TO WS-CURRENT-TS-RED            
C34569        MOVE WS-CURRENT-TIME TO WS-OPT-AGRMT-EFF-TM-O             
C34569     ELSE                                                         
C34569        MOVE PROGRAM-NAME              TO ABEND-PROGRAM           
C34569        MOVE '8615'                    TO ACTIVE-PARAGRAPH        
C34569        MOVE 'SELECT'                  TO ABEND-FUNCTION          
C34569        MOVE SPACES                    TO ABEND-SQL-PREDICATES    
C34569                                          ABEND-TABLES            
C34569        MOVE 'CSS_JOB_PARM'            TO TABLE-1                 
C34569        MOVE 'PROGRAM_NAME'            TO TABLE-ELEMENT-1         
C34569        MOVE G6-PROGRAM-NAME           TO HOSTVAR-ELEMENT-1       
C34569        PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT             
C34569        PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
C34569     END-IF.                                                      
                                                                        
C34569 8615-EXIT.                                                       
C34569     EXIT.                                                        
                                                                        
                                                                        
P00778******************************************************************23890000
P00778* 8620-UPDATE-AGL-PREM-NO.                                        23900000
P00778******************************************************************23910000
       8620-UPDATE-AGL-PREM-NO.                                         
                                                                        
           MOVE  '8620'      TO WS-ACTIVE-PARAGRAPH.                    
           MOVE PARM-AGL-PREM-NO       TO PR-AGL-PREM-NO                
           MOVE WS-PREMISE-NO        TO PR-PREMISE-NO                   
                                                                        
           EXEC SQL                                                     
               UPDATE CSS_PREMISE                                       
                SET AGL_PREM_NO = :PR-AGL-PREM-NO                       
               WHERE PREMISE_NO  = :PR-PREMISE-NO                       
                                                            
            END-EXEC.                                                   

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     23980000
MFA-TR*        UPDATE CSS_PREMISE                                       23990000
MFA-TR*         SET AGL_PREM_NO = :PR-AGL-PREM-NO                       24000000
MFA-TR*        WHERE PREMISE_NO  = :PR-PREMISE-NO                       24010000
MFA-TR*        QUERYNO 8620                                             24020000
MFA-TR*     END-EXEC.                                                   24030000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE  
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE '8620'                    TO ACTIVE-PARAGRAPH       
               MOVE 'UPDATE'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_PREMISE'             TO TABLE-1                
               MOVE 'PREMISE-NO'             TO TABLE-ELEMENT-1         
               MOVE PR-PREMISE-NO             TO HOSTVAR-ELEMENT-1      
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8620-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
P00778******************************************************************24270000
P00778* 8630-UPDATE-AGL-CUST-NO.                                        24280000
P00778******************************************************************24290000
       8630-UPDATE-AGL-CUST-NO.                                         
                                                                        
           MOVE  '8630'      TO WS-ACTIVE-PARAGRAPH.                    
           MOVE PARM-AGL-CUST-NO       TO CU-AGL-CUST-NO                
           MOVE AT-CUSTOMER-NO         TO CU-CUSTOMER-NO                
                                                                        
           EXEC SQL                                                     
               UPDATE CSS_CUSTOMER                                      
                SET AGL_CUST_NO = :CU-AGL-CUST-NO                       
               WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                      
                                                            
            END-EXEC.                                                   

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ003
MFA-TR*    EXEC SQL                                                     24360000
MFA-TR*        UPDATE CSS_CUSTOMER                                      24370000
MFA-TR*         SET AGL_CUST_NO = :CU-AGL-CUST-NO                       24380000
MFA-TR*        WHERE CUSTOMER_NO = :CU-CUSTOMER-NO                      24390000
MFA-TR*        QUERYNO 8630                                             24400000
MFA-TR*     END-EXEC.                                                   24410000

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

                                                                        
           MOVE SQLCODE                       TO WS-ACTIVE-RETURN-CODE  
                                                                        
           IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL OR NOT-FOUND      
               NEXT SENTENCE                                            
           ELSE                                                         
               MOVE WS-ACTIVE-RETURN-CODE     TO RS-RETURN-CODE         
               MOVE PROGRAM-NAME              TO ABEND-PROGRAM          
               MOVE '8630'                    TO ACTIVE-PARAGRAPH       
               MOVE 'UPDATE'                  TO ABEND-FUNCTION         
               MOVE SPACES                    TO ABEND-SQL-PREDICATES   
                                                 ABEND-TABLES           
               MOVE 'CSS_CUSTOMER'            TO TABLE-1                
               MOVE 'CUSTOMER-NO'             TO TABLE-ELEMENT-1        
               MOVE CU-CUSTOMEr-NO             TO HOSTVAR-ELEMENT-1     
               PERFORM 9998-SEND-ERROR-RESULT THRU 9998-EXIT            
               PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT            
           END-IF.                                                      
                                                                        
       8630-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************24640000
      * 9700-END-OPEN-CLIENT                                           *24650000
      ******************************************************************24660000
       9700-END-OPEN-CLIENT.                                            
                                                                        
           MOVE '9700'                        TO ACTIVE-PARAGRAPH.      
                                                                        
       9710-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************24740000
      *  9000-SEND-ERROR-RESULT IS NOT BEING USED SINCE IT INITIALIZES *24750000
      *  GTT-RETURN-FIELDS. ALL RETURN FIELDS ARE REQUIRED TO SEND     *24760000
      *  BACK ERROR MESSAGES                                           *24770000
      ******************************************************************24780000
       9998-SEND-ERROR-RESULT.                                          
                                                                        
             MOVE 'N'           TO SEND-DONE-SW.                        
      *      INITIALIZE GTT-RETURN-FIELDS.                              24820000
             MOVE WS-ACTIVE-RETURN-CODE TO RS-RETURN-CODE.              
             PERFORM 8100-SEND-RESULT      THRU 8100-EXIT.              
             PERFORM 8900-SEND-DONE        THRU 8900-EXIT.              
                                                                        
       9998-EXIT.                                                       
             EXIT.                                                      
                                                                        
      ******************************************************************24900000
      *  BUILD PREMISE COPYBOOK.                                       *24910000
      ******************************************************************24920000
                                                                        
           EXEC SQL                                                     24940003
              INCLUDE CPD0037A                                          24950003
           END-EXEC.                                                    24960003
                                                                        
C30135     EXEC SQL                                                     24980003
C30135        INCLUDE CPD0037F                                          24990003
C30135     END-EXEC.                                                    25000003
                                                                        
      ******************************************************************25090000
      *  BUILD CUSTOMER COPYBOOK.                                      *25100000
      ******************************************************************25110000
                                                                        
           EXEC SQL                                                     25130003
              INCLUDE CPD0203A                                          25140003
           END-EXEC.                                                    25150003
                                                                        
      ******************************************************************25170000
      *  BUILD ACCOUNT COPYBOOK.                                       *25180000
      ******************************************************************25190000
                                                                        
           EXEC SQL                                                     25210003
              INCLUDE CPD0054A                                          25220003
           END-EXEC.                                                    25230003
                                                                        
           EXEC SQL                                                     25250003
              INCLUDE CPD00126                                          25260003
           END-EXEC.                                                    25270003
                                                                        
      ******************************************************************25290000
      *  JOURNALING COPYBOOK.                                          *25300000
      ******************************************************************25310000
                                                                        
           EXEC SQL                                                     25330003
              INCLUDE CPD00067                                          25340003
           END-EXEC.                                                    25350003
                                                                        
      ***************************************************************** 25370000
      * CHECK DIGIT ROUTINE COPYBOOKS.                                * 25380000
      ***************************************************************** 25390000
           COPY CPD00071.                                               25400002
           COPY CPD00013.                                               25410002
                                                                        
*T4158     EXEC SQL                                                     25430002
*T4158        INCLUDE CPD00091                                          25440002
*T4158     END-EXEC.                                                    25450002
                                                                        
*T4158     EXEC SQL                                                     25470002
*T4158        INCLUDE CPD00093                                          25480002
*T4158     END-EXEC.                                                    25490002
                                                                        
      ***************************************************************** 25580000
      * ADDRESS CONTROL COPYBOOK                                      * 25590000
      ***************************************************************** 25600000
           EXEC SQL                                                     25610002
              INCLUDE CPD00090                                          25620002
           END-EXEC.                                                    25630002
                                                                        
      ***************************************************************** 25650000
      * PREMISE CONTROL COPYBOOK                                      * 25660000
      ***************************************************************** 25670000
           EXEC SQL                                                     25680003
              INCLUDE CPD00094                                          25690003
           END-EXEC.                                                    25700003
                                                                        
           EXEC SQL                                                     25720003
              INCLUDE CPD00099                                          25730003
           END-EXEC.                                                    25740003
      ***************************************************************** 25741006
      * COPYBOOK FOR 6100-REDUCE-EMBEDDED-SPACES.                     * 25742006
      ***************************************************************** 25743006
           COPY CPD00004.                                               25744006
                                                                        
                                                                        
C30677******************************************************************25810000
C30677* 9700-PROCESS-ABEND.                                            *25820000
C30677* THIS PARAGRAPH DUPLICATES THE CODE IN CPD0023C, BECAUSE        *25830000
C30677* 9000-SEND PARA IS NOT APPLICABLE TO THIS PROGRAM               *25840000
C30677******************************************************************25850000
C30677 9700-PROCESS-ABEND.                                              
                                                                        
C30677     PERFORM 9000-SEND-ERROR-RESULT  THRU 9000-EXIT.              
C30677     PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT.              
                                                                        
C30677 9700-EXIT.                                                       
C30677     EXIT.                                                        
                                                                        
      ******************************************************************25940000
      * 9900 - JOURNALING / ERROR HANDLING ROUTINE                     *25950000
      ******************************************************************25960000
           EXEC SQL                                                     25970000
              INCLUDE CPDSP300                                          25980000
           END-EXEC.                                                    25990000
                                                                        
      ******************************************************************26010000
      *       END PROGRAM COPYLIB                                      *26020000
      ******************************************************************26030000
CVT000 8100-SEND-RESULT.                                                
CVT000       ADD 1 TO CTR-ROWS.                                         
CVT000 8100-EXIT.                                                       
CVT000        EXIT.                                                     
CVT000 0100A-DECLARE-GTT.                                               
CVT000       CONTINUE.                                                  
CVT000 0100A-EXIT.                                                      
CVT000        EXIT.                                                     
CVT000     EXEC SQL                                                     26120000
CVT000         INCLUDE CPD00320                                         26130000
CVT000     END-EXEC.                                                    26140000
