       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID.    CSR02324.                                         
COB303 DATE-WRITTEN.     FEB 5, 1996.                                   
       DATE-COMPILED.                                                   
                                                                        
CVT000******************************************************************00000100
CVT000*     - - - - - >   R P C   C O N V E R S I O N   < - - - - -    *00000200
CVT000*         S324 CONVERTED TO DB2 SP CSR02324 ON 03/07/2007        *00000300
CVT000*             -NOTE: AUTOMATED CONVERSION PROGRAM USED           *00000400
CVT000*                                                                *00000500
CVT000*                    CVT000 - CONVERTED CODE                     *00000501
CVT000*                    CVT004 - NEEDED REVIEW                      *00000502
CVT000*                    CVT999 - COMMENTED OUT CODE THAT CAN        *00000503
CVT000*                             POTENTIALLY BE DELETED             *00000510
CVT000*                                                                *00000520
CVT000******************************************************************00000600
      ******************************************************************00060000
      *                SOUTH CAROLINA ELECTRIC & GAS                   *00070000
      *                                                                *00080000
      *  THIS PROGRAM IS EXECUTED VIA A REMOTE PROCEDURE CALL (RPC).   *00090000
      *                                                                *00100000
      *  TRANID:        S324                                           *00110000
      *  PROGRAM:       S324                                           *00120000
      *  CALLING SP:    PD_D0000251                                    *00130000
      *                                                                *00140000
      ******************************************************************00150000
      *                 P R O G R A M  S U M M A R Y                   *00160000
      *                                                                *00170000
      *  THIS PROGRAM IS A REMOTE PROCEDURE CALL MADE FROM             *00180000
      *  DESKTOP 2000 VIA THE SYBASE NETGATEWAY.                       *00190000
      *  THIS PROGRAM RETRIEVES ROWS FROM THE FOLLOWING TABLES:        *00200000
      *  ACCOUNT, AR_CNTL, SURETY_BOND, GUARANTOR, DEP_ON_HAND, AND    *00210000
      *  CRED_COLL. THE DATA WILL REFRESH THE SO_DNP TABLE ON SYBASE   *00211000
      *  WITH THE UP-TO-DATE INFORMATION. IN THE CASE THE TABLE DOES   *00212000
      *  NOT CONTAIN A ROW, A ROW WILL BE GENERATED IN THE CSS_ERROR_  *00213000
      *  LOG AND THE SO_DNP ROW WILL NOT BE UPDATED.  ALSO, THE DNP    *00214000
      *  CALCULATION IS NOT BEING COMPARED AGAINST A LIMIT CHECK.      *00215000
      *  IF THE DNP BALANCE FALLS BELOW THE LIMIT CHECK, THE DNP       *00216000
      *  SHOULD NOT BE WORKED.  THIS PROGRAM IS NOT RESPONSIBLE FOR    *00217000
      *  DELETING THE DNP FROM SO_DNP TABLE.                           *00218000
      ******************************************************************00220000
      *                                                                *00230000
      *                     PROGRAM MODIFICATION LOG                   *00240000
      *                                                                *00250000
      *    DATE    INITIALS   COMMENTS                                 *00260000
      *  --------  --------   ---------------------------------------  *00270000
      *  02/05/96    JTH      CREATED.                                 *00280000
      *                                                                *00290000
PCR482*  03/05/97    MAD      MODIFIED PARAGRAPH 7620 TO RETURN ONLY   *00291000
      *                       DEPOSITS WHICH ARE 'BILLING' AND 'PAID'. *00292000
T10857*  05/13/97    AS       ADDED CALL TO CPD00068 TO CALCULATE      *00293000
T10857*  05/13/97    AS       AMOUNT-DISC-BALANCE.                     *00294000
T12460*  08/01/97    EMS      ADDED CSS_DNP DCLGEN FOR CPD68 CHANGES   *00295000
      *  02/05/98    LHO      TOOK OUT CODE THAT SENT MESSAGE OF NOT   *00296000
      *                       WHEN SELECTING CODE_NOTICE_TYPE FROM     *00297000
      *                       CSS-CRED-COLL. THIS WOULD HAPPEN FOR     *00298000
      *                       MANUAL DNPS, BECAUSE THE                 *00299000
      *                       WS-DATE-FRCST-DNP IS NULL FOR MANUAL DNPS*00299100
T16853*  06/24/98    EMS      ADDED CSS_AR_TRN_HST_DET DCLGEN FOR      *00299200
      *                       CPD00068 CHANGES.                        *00299300
T17071*  11/19/98    MDJ      ADDED INCLUDE TBCSTALT FOR CUST_ALERT FOR*00299400
      *                       CPD00068 CHANGES.                         00299500
CBSI  *  12/30/98    CBSI     ABEND LOG MODIFIED TO INCLUDE ALL THE    *        
CBSI  *              MADRAS   ABEND PARAMETERS                         *        
T20165*  06/22/99    SHF      RETRIEVED AT-LOCAL-OFFICE FOR CPD00068.  *        
T19557*  02/24/00    CBSI     COPYBOOK CDP00068 CHANGED TO SUB PROGRAM *        
T19557*              MADRAS   SCSCO068.                                *        
T22359*  06/21/00    MDJ      MADE CHANGES TO KEEP IDENTITY OF PROGRAM *        
      *                       CALLING SCSCO068 OR SCSCB068.  THERE IS  *        
      *                       SPECIFIC LOGIC IN CPD00068 FOR CERTAIN   *        
      *                       PROGRAMS WHICH WAS NOT BEING EXECUTED    *        
      *                       PROPERLY BECAUSE THE PROGRAM NAME WAS    *        
      *                       ALWAYS SCSCO068 OR SCSCB068.             *        
      *  04/10/03    DD       ADDED BANKRUPTCY_IND AND CODE_ACCT_STAT  *        
      *                       TO SELECT-ACCOUNT                        *        
C28788*  07/07/03    MDJ      GET IVR-EXEMPT-CD FOR CPD00068.          *        
      *  07/09/07  SRIKRISHNA CHANGE STATIC CALL MCSCB068 TO DYNAMIC   *        
A01016** 01/29/09    RC41079  ADDED CODE TO GET ARREARS CODE FROM THE  *        
      **                      FIRST CHARACTER OF ARREARS_HIST.         *        
      ******************************************************************00300000
      ******************************************************************00300000
      ******************************************************************00310000
      *                                                                *00320000
      *                ---- BASIC SEQUENCE STRUCTURE ----              *00330000
      *                                                                *00340000
      *  0000 - 0999  MAIN CONTROL PATH AND INITIALIZATION             *00350000
      *  1000 - 1999  INPUT PROCESSING CONTROL PATH                    *00360000
      *  2000 - 2999  OUTPUT PROCESSING CONTROL PATH                   *00370000
      *  3000 - 4999  NOT USED                                         *00380000
      *  5000 - 5999  COMMON PROGRAM MODULES                           *00390000
      *  6000 - 6999  COMMON SYSTEM MODULES                            *00400000
      *  7000 - 7999  INPUT MODULES                                    *00410000
      *  8000 - 8999  OUTPUT MODULES                                   *00420000
      *  9000 - 9999  TERMINATION,ABEND, MESSAGING MODULES             *00430000
      *                                                                *00440000
      ******************************************************************00450000
                                                                        
       ENVIRONMENT DIVISION.                                            
       DATA DIVISION.                                                   
       WORKING-STORAGE SECTION.                                         

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 'CSR02324'.
MSQ017     COPY MFASQLM.
                                                                        
       01  WS-START                                   PIC X(40) VALUE   
           'WORKING STORAGE FOR RPC S324 STARTS HERE'.                  
                                                                        
      ******************************************************************00540000
      *    DB2 INCLUDES                                                *00550000
      ******************************************************************00560000
                                                                        
           EXEC SQL                                                     00580000
              INCLUDE SQLCA                                             00590000
           END-EXEC.                                                    00600000
                                                                        
      *-------< INCLUDE CSS_ACCOUNT       >                             00620000
           EXEC SQL                                                     00630000
              INCLUDE TBACCT                                            00640000
           END-EXEC.                                                    00650000
      *                                                                         
C28788     EXEC SQL                                                             
C28788        INCLUDE TBUTLENV                                                  
C28788     END-EXEC.                                                            
                                                                        
      *-------< INCLUDE CSS_SURETY_BOND   >                             00702000
           EXEC SQL                                                     00703000
              INCLUDE TBSTYBND                                          00704000
           END-EXEC.                                                    00705000
                                                                        
      *-------< INCLUDE CSS_GUARANTOR     >                             00707000
           EXEC SQL                                                     00708000
              INCLUDE TBGTNTR                                           00709000
           END-EXEC.                                                    00709100
                                                                        
      *-------< INCLUDE CSS_CREDIT_PROFILE>                             00707000
           EXEC SQL                                                     00708000
              INCLUDE TBCRPROF                                          00709000
           END-EXEC.                                                    00709100
                                                                        
      *-------< INCLUDE CSS_DEP_ON_HAND   >                             00709300
           EXEC SQL                                                     00709400
              INCLUDE TBDEPHND                                          00709500
           END-EXEC.                                                    00709600
                                                                        
T10857*-------< INCLUDE CWS00068     >                                  00723000
T10857     EXEC SQL                                                     00730000
T10857        INCLUDE CWS00068                                          00740000
T10857     END-EXEC.                                                    00750000
                                                                        
      *-------< INCLUDE CWS00056           >                            00761000
           EXEC SQL                                                     00762000
              INCLUDE CWS00056                                          00763000
           END-EXEC.                                                    00764000
                                                                        
      ******************************************************************00770000
      *    COBOL WORKING STORAGE COPY BOOKS                            *00780000
      ******************************************************************00790000
                                                                        
      *--------< CONTAINS THE COBOL EQUATES NEEDED FOR USING THE >      00810000
      *--------< SYBASE OPEN SERVER FOR CICS FACILITIES.         >      00820000
CVT999*    COPY SYGWCOB.                                                00830000
      *--------< ADDED TO SUPPORT CICS RPCS >                           00840000
CVT999*    COPY SYDBCOB.                                                00850000
      *--------<COMMON SYSTEM AREA >                                    00860000
           COPY CCA00001.                                               00870000
      *--------< ERROR HANDLING >                                       00880000
CVT999*    COPY CWS00010.                                               00890000
      *--------< ERROR WORK AREA - SUPPORTS ONLINE/CSR JOURNALS >       00900000
           COPY CWS00027.                                               00910000
      *--------< SUPPORTS DB2 AND SQL ERROR CHECKING >                  00920000
           COPY CWS00303.                                               00930000
T19557*--------< LINKAGE SECTION VARIABLES FOR SCSCO068 >                       
T19557     COPY CWS0068L.                                               01680000
                                                                        
      ******************************************************************00950000
      *    WORK AREAS                                                  *00960000
      ******************************************************************00970000
                                                                        
       01  WS-MISC.                                                     
           05  PROGRAM-NAME            PIC X(08) VALUE 'S324    '.      
           05  MCSCB068                PIC X(08) VALUE 'MCSCB068'.      
           05  NULL-VALUE              PIC S9(09) COMP  VALUE -180.     
           05  WS-A                    PIC X(01) VALUE 'A'.             
           05  WS-B                    PIC X(01) VALUE 'B'.             
           05  WS-G                    PIC X(01) VALUE 'G'.             
T10857*    05  WS-AMT-DNP-BAL           PIC S9(09)V99 COMP-3 VALUE +0.  00990600
           05  WS-AMT-BOND              PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-IRR-LTR           PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-GUARANTEED        PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-DEP-ON-HAND       PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-SEC-BAL           PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-00                PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-30                PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-60                PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-AMT-90                PIC S9(09)V99 COMP-3 VALUE +0.  
           05  WS-DATE-85-DAYS-AGO      PIC X(10).                      
           05  WS-DATE-55-DAYS-AGO      PIC X(10).                      
           05  WS-DATE-25-DAYS-AGO      PIC X(10).                      
           05  WS-NULL-INDICATOR        PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-INDICATOR2       PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-INDICATOR3       PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-INDICATOR4       PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-DT-IND1          PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-DT-IND2          PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-DT-IND3          PIC S9(04) COMP VALUE ZEROES.   
           05  WS-NULL-DT-IND4          PIC S9(04) COMP VALUE ZEROES.   
           05  WS-CODE-ARREARS          PIC X(1)  VALUE SPACES.         
           05  WS-TABLE-ID              PIC X(20)  VALUE SPACES.        
           05  WS-MSG-TEXT              PIC X(30)  VALUE SPACES.        
           05  WS-ARREARS-HIST          PIC X(24)    VALUE SPACES.      
                                                                        
       01  GW-LIB-MISC-FIELDS.                                          
CVT999*    05  GWL-PROC                POINTER.                         01010000
CVT999*    05  GWL-INIT-HANDLE         POINTER.                         01020000
CVT999*    05  GWL-RC                  PIC S9(9) COMP.                  01030000
CVT999*    05  GWL-STATUS-NR           PIC S9(9) COMP.                  01040000
CVT999*    05  GWL-STATUS-DONE         PIC S9(9) COMP.                  01050000
CVT999*    05  GWL-STATUS-COUNT        PIC S9(9) COMP.                  01060000
CVT999*    05  GWL-STATUS-COMM         PIC S9(9) COMP.                  01070000
CVT999*    05  GWL-STATUS-RETURN-CODE  PIC S9(9) COMP.                  01080000
           05  GWL-STATUS-SUBCODE      PIC S9(9) COMP.                  
                                                                        
       01  FILLER                      PIC X(11) VALUE 'PARM FIELDS'.   
                                                                        
       01  PARM-FIELDS.                                                 
           05  PARM-L                  PIC S9(9) COMP.                  
CVT999*    05  PARM-ID1                PIC S9(9) COMP VALUE 1.          01150000
           05  PARM-ACCOUNT-NO         PIC X(13).                       
           05  PARM-ACCOUNT-NO-NUM REDEFINES PARM-ACCOUNT-NO            
                                       PIC 9(13).                       
           05  PARM-DATE-FRCST-DNP     PIC X(10).                       
                                                                        
       01  SNA-FIELDS.                                                  
           05  SNA-SUBC                PIC S9(9) COMP.                  
CVT999*    05  SNA-CONNECTION-NAME     PIC X(8)  VALUE SPACES.          01230000
                                                                        
       01  COUNTER-FIELDS.                                              
CVT999*    05  CTR-COLUMN              PIC S9(9) COMP VALUE 1.          01260000
CVT999*    05  CTR-ROWS                PIC S9(9) COMP VALUE 0.          01270000
           05  WS-ROW-COUNT            PIC S9(9) COMP VALUE 0.          
                                                                        
       01  WORK-FIELDS.                                                 
CVT999*    05  MAX-LENGTH-PARM         PIC S9(9) COMP.                  01310000
CVT999*    05  WRKLEN1                 PIC S9(9) COMP.                  01320000
CVT999*    05  WRKLEN2                 PIC S9(9) COMP.                  01330000
           05  WRK-DONE-STATUS         PIC S9(9) COMP.                  
                                                                        
       01  WS-MISC.                                                     
           05  WS-DATE-CCYY-MM-DD.                                      
               10  WS-DATE-CCYY       PIC X(04) VALUE SPACES.           
               10  FILLER             PIC X(01) VALUE SPACES.           
               10  WS-DATE-MM         PIC X(02) VALUE SPACES.           
               10  FILLER             PIC X(01) VALUE SPACES.           
               10  WS-DATE-DD         PIC X(02) VALUE SPACES.           
           05  WS-DATE-MM-DD-YYYY.                                      
               10  WS-DATE2-MM        PIC X(02) VALUE SPACES.           
               10  FILLER             PIC X(01) VALUE '/'.              
               10  WS-DATE2-DD        PIC X(02) VALUE SPACES.           
               10  FILLER             PIC X(01) VALUE '/'.              
               10  WS-DATE2-CCYY      PIC X(04) VALUE SPACES.           
                                                                        
       01  WS-FLAG-VALUES.                                              
           05  WS-YES                  PIC X(01) VALUE 'Y'.             
           05  WS-NO                   PIC X(01) VALUE 'N'.             
           05  WS-ACTIVE-CODE          PIC X(01) VALUE 'A'.             
                                                                        
       01  FILLER  PIC X(32) VALUE 'THIS IS THE ROW RETURN AREA.'.      
                                                                        
       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-TABLE-ID             PIC X(20)  VALUE SPACES.         
           05  RS-MSG-TEXT             PIC X(30)  VALUE SPACES.         
           05  RS-DATE-BILL-DAY-00     PIC X(10) VALUE SPACES.          
           05  RS-AMOUNT-DISC-BAL      PIC S9(9)V9(2) COMP-3 VALUE 0.   
           05  RS-AMOUNT-SECURITY      PIC S9(9)V9(2) COMP-3 VALUE 0.   
           05  RS-CREDIT-GROUP         PIC X(1)  VALUE SPACES.          
           05  RS-CODE-ARREARS         PIC X(1)  VALUE SPACES.          
           05  RS-CODE-DNP-TYPE        PIC X(1)  VALUE SPACES.          
                                                                        
CVT999*01  CNS-COLUMN-NAMES.                                            01710000
CVT999*    05  CNS-RETURN-CODE          PIC X(11) VALUE 'RETURN_CODE'.  01720000
CVT999*    05  CNS-TABLE-ID             PIC X(8)  VALUE 'TABLE_ID'.     01730000
CVT999*    05  CNS-MSG-TEXT             PIC X(8)  VALUE 'MSG_TEXT'.     01731000
CVT999*    05  CNS-DATE-BILL-DAY-00     PIC X(19)                       01740000
CVT999*                                 VALUE 'AT_DATE_BILL_DAY_00'.    01750000
CVT999*    05  CNS-AMOUNT-DISC-BAL      PIC X(18)                       01760000
CVT999*                                 VALUE 'DN_AMOUNT_DISC_BAL'.     01770000
CVT999*    05  CNS-AMOUNT-SECURITY      PIC X(18)                       01780000
CVT999*                                 VALUE 'DN_AMOUNT_SECURITY'.     01790000
CVT999*    05  CNS-CREDIT-GROUP         PIC X(15)                       01800000
CVT999*                                 VALUE 'AT_CREDIT_GROUP'.        01810000
CVT999*    05  CNS-CODE-ARREARS         PIC X(15)                       01820000
CVT999*                                 VALUE 'DN_CODE_ARREARS'.        01830000
CVT999*    05  CNS-CODE-DNP-TYPE        PIC X(16)                       01840000
CVT999*                                 VALUE 'DN_CODE_DNP_TYPE'.       01850000
CVT999*                                                                 01860000
       01  GENERAL-WORKING-STORAGE.                                     
COB305     05 WS-ACCOUNT-NO        PIC S9(13) USAGE COMP-3 VALUE 0.         
           05  WS-ACCOUNT-NO-CHAR     PIC X(13).                        
           05  WS-ACCOUNT-NO-INT      PIC 9(13).                        
COB305     05 WS-ACCOUNT-NO-CHK        PIC S9(13)V USAGE COMP-3 VALUE 0.        
           05  WS-DATE-FRCST-DNP      PIC X(10) VALUE SPACES.           
T19557     05  WS-EIBRESP             PIC S9(8)                         
T19557                                COMP SYNC VALUE ZERO.             
                                                                        
       01  SWITCHES.                                                    
           05  ALL-DONE-SW             PIC X(01) VALUE 'N'.             
               88 NOT-ALL-DONE                   VALUE 'N'.             
               88 ALL-DONE                       VALUE 'Y'.             
           05  SEND-DONE-SW            PIC X(01) VALUE 'Y'.             
               88 SEND-DONE-ERROR                VALUE 'N'.             
               88 SEND-DONE-OK                   VALUE 'Y'.             
                                                                        
                                                                        
HPCCDM*EJECT                                                            02000000
CVT000     EXEC SQL                                                     00000010
CVT000         INCLUDE CWSX0010                                         00000020
CVT000     END-EXEC.                                                    00000030
CVT000                                                                  
CVT000     EXEC SQL                                                     00000050
CVT000         INCLUDE CWSSP001                                         00000060
CVT000     END-EXEC.                                                    00000070
CVT000                                                                  
CVT000 LINKAGE SECTION.                                                 
CVT000 01  LINK-ACCOUNT-NO          PIC X(13)                .          
CVT000 01  LINK-DATE-FRCST-DNP      PIC X(10)                .          
                                                                        
CVT000 PROCEDURE DIVISION USING                                         
CVT000          LINK-ACCOUNT-NO                                         
CVT000         ,LINK-DATE-FRCST-DNP                                     
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.                                                    
CVT999*PROCEDURE DIVISION.                                              02010000
                                                                        
      ******************************************************************02030000
      * 0000-MAINLINE                                                  *02040000
      *     CALLS 0100-INITIALIZE                                      *02050000
      *           1000-PROCESS-INPUT                                   *02060000
      *           2000-PROCESS-OUTPUT                                  *02070000
      *           9999-END-PROGRAM                                     *02080000
      *                                                                *02090000
      *     CONTROLS THE MAIN PATH OF THE PROGRAM                      *02100000
      ******************************************************************02110000
                                                                        
       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.                                                        
                                                                        
      ******************************************************************02230000
      * 0100-INITIALIZE                                                *02240000
      *     CALLS 9000-SEND-ERROR-RESULT                               *02250000
      *           9900-SQL-ERROR-ROUTINE                               *02260000
      *                                                                *02270000
      *     CALLED FROM 0000-MAINLINE                                  *02280000
      *                                                                *02290000
      *     1. RESET DB2 ERROR HANDLERS                                *02300000
      *     2. ESTABLISH GATEWAY ENVIRONMENT (TDINIT)                  *02310000
      *     3. ACCEPT CLIENT REQUEST/ESTABLISH SNA HANDLE (TDACCEPT)   *02320000
      *     4. DETERMINE IF CLIENT HAS SENT AN RPC PARAMETER (TDRESULT)*02330000
      *                                                                *02340000
      ******************************************************************02350000
                                                                        
       0100-INITIALIZE.                                                 
                                                                        
           MOVE '0100'          TO ACTIVE-PARAGRAPH.                    
                                                                        
CVT999*    EXEC SQL WHENEVER SQLWARNING CONTINUE END-EXEC.              02410000
CVT999*    EXEC SQL WHENEVER SQLERROR   CONTINUE END-EXEC.              02420000
CVT999*    EXEC SQL WHENEVER NOT FOUND  CONTINUE END-EXEC.              02430000
                                                                        
CVT999*    CALL 'TDINIT'   USING DFHEIBLK, GWL-RC, GWL-INIT-HANDLE.     02450000
                                                                        
CVT999*    CALL 'TDACCEPT' USING GWL-PROC, GWL-RC, GWL-INIT-HANDLE,     02470000
CVT999*                          SNA-CONNECTION-NAME, SNA-SUBC.         02480000
                                                                        
CVT999*    CALL 'TDRESULT' USING GWL-PROC, GWL-RC.                      02500000
                                                                        
CVT999*    IF GWL-RC NOT = TDS-PARM-PRESENT                             02520000
CVT999*       MOVE PROGRAM-NAME    TO ABEND-PROGRAM                     02530000
CVT999*       MOVE 'TDRESULT - NO RPC PARM SENT' TO ABEND-FUNCTION      02540000
CVT999*       MOVE 'CICS TRANSACTION'   TO TABLE-1                      02550000
CVT999*       MOVE GWL-RC               TO WS-ACTIVE-RETURN-CODE        02560000
CVT999*       PERFORM 9000-SEND-ERROR-RESULT  THRU 9000-EXIT            02570000
CVT999*       PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT            02580000
CVT999*    END-IF.                                                      02590000
                                                                        
CVT000     EXEC SQL                                                     
CVT000       DECLARE C1 CURSOR  FOR                          
CVT000       SELECT                                                     
CVT000        :RS-RETURN-CODE              AS    RETURN_CODE            
CVT000       ,:RS-TABLE-ID                 AS    TABLE_ID               
CVT000       ,:RS-MSG-TEXT                 AS    MSG_TEXT               
CVT000       ,:RS-AMOUNT-DISC-BAL          AS    AMOUNT_DISC_BAL        
CVT000       ,:RS-AMOUNT-SECURITY          AS    AMOUNT_SECURITY        
CVT000       ,:RS-DATE-BILL-DAY-00         AS    DATE_BILL_DAY_00       
CVT000       ,:RS-CREDIT-GROUP             AS    CREDIT_GROUP           
CVT000       ,:RS-CODE-ARREARS             AS    CODE_ARREARS           
CVT000       ,:RS-CODE-DNP-TYPE            AS    CODE_DNP_TYPE          
CVT000          FROM CIS.SYSDUMMY1                                   
CVT000     END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ027
MFA-TR*    EXEC SQL                                                             
MFA-TR*      DECLARE C1 CURSOR WITH RETURN FOR                                  
MFA-TR*      SELECT                                                             
MFA-TR*       :RS-RETURN-CODE              AS    RETURN_CODE                    
MFA-TR*      ,:RS-TABLE-ID                 AS    TABLE_ID                       
MFA-TR*      ,:RS-MSG-TEXT                 AS    MSG_TEXT                       
MFA-TR*      ,:RS-AMOUNT-DISC-BAL          AS    AMOUNT_DISC_BAL                
MFA-TR*      ,:RS-AMOUNT-SECURITY          AS    AMOUNT_SECURITY                
MFA-TR*      ,:RS-DATE-BILL-DAY-00         AS    DATE_BILL_DAY_00               
MFA-TR*      ,:RS-CREDIT-GROUP             AS    CREDIT_GROUP                   
MFA-TR*      ,:RS-CODE-ARREARS             AS    CODE_ARREARS                   
MFA-TR*      ,:RS-CODE-DNP-TYPE            AS    CODE_DNP_TYPE                  
MFA-TR*         FROM SYSIBM.SYSDUMMY1                                           
MFA-TR*    END-EXEC.                                                            
CVT000     MOVE LINK-ACCOUNT-NO           TO PARM-ACCOUNT-NO          . 
CVT000     MOVE LINK-DATE-FRCST-DNP       TO PARM-DATE-FRCST-DNP      . 
       0100-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************02640000
      * 1000-PROCESS-INPUT                                             *02650000
      *     CALLS 1100-RECEIVE-PARMS                                   *02660000
      *                                                                *02670000
      *     CALLED FROM 0000-MAINLINE                                  *02680000
      *                                                                *02690000
      *     1. RECEIVE PARMS.                                          *02700000
      ******************************************************************02710000
       1000-PROCESS-INPUT.                                              
                                                                        
           PERFORM 1100-RECEIVE-PARMS THRU 1100-EXIT.                   
                                                                        
           MOVE PARM-ACCOUNT-NO         TO WS-ACCOUNT-NO-CHAR.          
           UNSTRING WS-ACCOUNT-NO-CHAR DELIMITED BY SPACES              
                                        INTO WS-ACCOUNT-NO-INT.         
           MOVE WS-ACCOUNT-NO-INT       TO WS-ACCOUNT-NO.               
           MOVE PARM-DATE-FRCST-DNP     TO WS-DATE-FRCST-DNP.           
                                                                        
           IF WS-DATE-FRCST-DNP = SPACES                                
              MOVE LOW-VALUES          TO WS-DATE-FRCST-DNP             
           END-IF.                                                      
                                                                        
       1000-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************02830000
      * 1100-RECEIVE-PARMS                                             *02840000
      *     CALLS TDRCVPRM                                             *02850000
      *                                                                *02860000
      *     CALLED FROM 1000-PROCESS-INPUT                             *02870000
      *                                                                *02880000
      *     GET THE PASSED PARMS FROM THE CLIENT                       *02890000
      ******************************************************************02900000
       1100-RECEIVE-PARMS.                                              
                                                                        
CVT999*    MOVE 1                                TO PARM-ID1.           02950000
CVT999*    MOVE LENGTH OF PARM-ACCOUNT-NO        TO MAX-LENGTH-PARM.    02960000
                                                                        
CVT999*    CALL 'TDRCVPRM' USING GWL-PROC,                              02980000
CVT999*                          GWL-RC,                                02990000
CVT999*                          PARM-ID1,                              03000000
CVT999*                          PARM-ACCOUNT-NO,                       03010000
CVT999*                          TDSCHAR,                               03020000
CVT999*                          MAX-LENGTH-PARM,                       03030000
CVT999*                          PARM-L.                                03040000
                                                                        
CVT999*    ADD  1                                TO PARM-ID1.           03070000
CVT999*    MOVE LENGTH OF PARM-DATE-FRCST-DNP    TO MAX-LENGTH-PARM.    03080000
                                                                        
CVT999*    CALL 'TDRCVPRM' USING GWL-PROC,                              03100000
CVT999*                          GWL-RC,                                03110000
CVT999*                          PARM-ID1,                              03120000
CVT999*                          PARM-DATE-FRCST-DNP,                   03130000
CVT999*                          TDSCHAR,                               03140000
CVT999*                          MAX-LENGTH-PARM,                       03150000
CVT999*                          PARM-L.                                03160000
                                                                        
       1100-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************03210000
      * 2000-PROCESS-OUTPUT.                                           *03220000
      *     CALLS 2100-DESCRIBE-RESULT                                 *03230000
      *           2300-BUILD-RESULT                                    *03240000
      *                                                                *03250000
      *      CALLED FROM 0000-MAINLINE                                 *03260000
      *                                                                *03270000
      *      SETS UP PARAMETERS TO BE RETURNED, POPULATES THE PARMS    *03280000
      *      AND SENDS THEN BACK                                       *03290000
      ******************************************************************03300000
       2000-PROCESS-OUTPUT.                                             
                                                                        
           PERFORM 2100-DESCRIBE-RESULT          THRU 2100-EXIT.        
           PERFORM 2300-BUILD-RESULT             THRU 2300-EXIT.        
                                                                        
       2000-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************03400000
      * 2100-DESCRIBE-RESULT                                           *03410000
      *                                                                *03420000
      *     CALLED FROM 2000-PROCESS-OUTPUT                            *03430000
      *                                                                *03440000
      *     DESCRIBE EACH RESULT FIELD TO THE CLIENT                   *03450000
      ******************************************************************03460000
       2100-DESCRIBE-RESULT.                                            
                                                                        
           PERFORM 2110-DESC-RET-CODE              THRU 2110-EXIT.      
           PERFORM 2115-DESC-TABLE-ID              THRU 2115-EXIT.      
           PERFORM 2120-DESC-MSG-TEXT              THRU 2120-EXIT.      
           PERFORM 2125-DESC-AMOUNT-DISC-BAL       THRU 2125-EXIT.      
           PERFORM 2130-DESC-AMOUNT-SECURITY       THRU 2130-EXIT.      
           PERFORM 2135-DESC-DATE-BILL-DAY-00      THRU 2135-EXIT.      
           PERFORM 2140-DESC-CREDIT-GROUP          THRU 2140-EXIT.      
           PERFORM 2145-DESC-CODE-ARREARS          THRU 2145-EXIT.      
           PERFORM 2150-DESC-CODE-DNP-TYPE         THRU 2150-EXIT.      
                                                                        
       2100-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************03620000
      * 2110-DESC-RET-CODE                                             *03630000
      *     CALLS       9100-CHECK-ERROR                               *03640000
      *                                                                *03650000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *03660000
      *                                                                *03670000
      *     DESCRIBE EACH RESULT FIELD TO THE CLIENT                   *03680000
      ******************************************************************03690000
       2110-DESC-RET-CODE.                                              
                                                                        
           MOVE '2110'                       TO ACTIVE-PARAGRAPH.       
CVT999*    MOVE 1                            TO CTR-COLUMN.             03740000
CVT999*    MOVE TDSINT4                      TO DB-HOST-TYPE.           03750000
CVT999*    MOVE TDSINT4                      TO DB-CLIENT-TYPE.         03760000
CVT999*    MOVE LENGTH OF RS-RETURN-CODE     TO WRKLEN1.                03770000
CVT999*    MOVE LENGTH OF CNS-RETURN-CODE    TO WRKLEN2.                03780000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              03800000
CVT999*                          GWL-RC,                                03810000
CVT999*                          CTR-COLUMN,                            03820000
CVT999*                          DB-HOST-TYPE,                          03830000
CVT999*                          WRKLEN1,                               03840000
CVT999*                          RS-RETURN-CODE,                        03850000
CVT999*                          DB-NULL-INDICATOR,                     03860000
CVT999*                          TDS-FALSE,                             03870000
CVT999*                          DB-CLIENT-TYPE,                        03880000
CVT999*                          WRKLEN1,                               03890000
CVT999*                          CNS-RETURN-CODE,                       03900000
CVT999*                          WRKLEN2.                               03910000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     03930000
                                                                        
       2110-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************03980000
      * 2115-DESC-TABLE-ID                                             *03990000
      *     CALLS       9100-CHECK-ERROR                               *04000000
      *                                                                *04010000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *04020000
      *                                                                *04030000
      *     DESCRIBE TABLE-ID    FIELD TO THE CLIENT                   *04040000
      ******************************************************************04050000
       2115-DESC-TABLE-ID.                                              
                                                                        
           MOVE '2115'                       TO ACTIVE-PARAGRAPH.       
CVT999*    ADD  1                            TO CTR-COLUMN.             04100000
CVT999*    MOVE TDSCHAR                      TO DB-HOST-TYPE.           04110000
CVT999*    MOVE TDSCHAR                      TO DB-CLIENT-TYPE.         04120000
CVT999*    MOVE LENGTH OF RS-TABLE-ID        TO WRKLEN1.                04130000
CVT999*    MOVE LENGTH OF CNS-TABLE-ID       TO WRKLEN2.                04140000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              04160000
CVT999*                          GWL-RC,                                04170000
CVT999*                          CTR-COLUMN,                            04180000
CVT999*                          DB-HOST-TYPE,                          04190000
CVT999*                          WRKLEN1,                               04200000
CVT999*                          RS-TABLE-ID,                           04210000
CVT999*                          DB-NULL-INDICATOR,                     04220000
CVT999*                          TDS-FALSE,                             04230000
CVT999*                          DB-CLIENT-TYPE,                        04240000
CVT999*                          WRKLEN1,                               04250000
CVT999*                          CNS-TABLE-ID,                          04260000
CVT999*                          WRKLEN2.                               04270000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     04290000
                                                                        
       2115-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************04340000
      * 2120-DESC-MSG-TEXT                                             *04350000
      *     CALLS       9100-CHECK-ERROR                               *04360000
      *                                                                *04370000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *04380000
      *                                                                *04390000
      *     DESCRIBE MSG-TEXT    FIELD TO THE CLIENT                   *04400000
      ******************************************************************04410000
       2120-DESC-MSG-TEXT.                                              
                                                                        
           MOVE '2120'                       TO ACTIVE-PARAGRAPH.       
CVT999*    ADD  1                            TO CTR-COLUMN.             04460000
CVT999*    MOVE TDSCHAR                      TO DB-HOST-TYPE.           04470000
CVT999*    MOVE TDSCHAR                      TO DB-CLIENT-TYPE.         04480000
CVT999*    MOVE LENGTH OF RS-MSG-TEXT        TO WRKLEN1.                04490000
CVT999*    MOVE LENGTH OF CNS-MSG-TEXT       TO WRKLEN2.                04500000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              04520000
CVT999*                          GWL-RC,                                04530000
CVT999*                          CTR-COLUMN,                            04540000
CVT999*                          DB-HOST-TYPE,                          04550000
CVT999*                          WRKLEN1,                               04560000
CVT999*                          RS-MSG-TEXT,                           04570000
CVT999*                          DB-NULL-INDICATOR,                     04580000
CVT999*                          TDS-FALSE,                             04590000
CVT999*                          DB-CLIENT-TYPE,                        04600000
CVT999*                          WRKLEN1,                               04610000
CVT999*                          CNS-MSG-TEXT,                          04620000
CVT999*                          WRKLEN2.                               04630000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     04650000
                                                                        
       2120-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************04722000
      * 2125-DESC-AMOUNT-DISC-BAL                                       04730000
      *     CALLS       TDESCRIB                                       *04740000
      *                 9100-CHECK-ERROR                               *04750000
      *                                                                *04760000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *04770000
      *                                                                *04780000
      *     DESCRIBE AMOUNT-DISC-BAL  RESULT FIELD TO THE CLIENT    *   04790000
      ******************************************************************04800000
       2125-DESC-AMOUNT-DISC-BAL.                                       
                                                                        
           MOVE '2125'                          TO ACTIVE-PARAGRAPH.    
CVT999*    ADD 1                                TO CTR-COLUMN.          04850000
CVT999*    MOVE TDSDECIMAL                      TO DB-HOST-TYPE.        04860000
CVT999*    MOVE TDSFLT8                         TO DB-CLIENT-TYPE.      04870000
CVT999*    MOVE LENGTH OF RS-AMOUNT-DISC-BAL TO WRKLEN1.                04880000
CVT999*    MOVE LENGTH OF CNS-AMOUNT-DISC-BAL TO WRKLEN2.               04890000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              04910000
CVT999*                          GWL-RC,                                04920000
CVT999*                          CTR-COLUMN,                            04930000
CVT999*                          DB-HOST-TYPE,                          04940000
CVT999*                          WRKLEN1,                               04950000
CVT999*                          RS-AMOUNT-DISC-BAL,                    04960000
CVT999*                          DB-NULL-INDICATOR,                     04970000
CVT999*                          TDS-FALSE,                             04980000
CVT999*                          DB-CLIENT-TYPE,                        04990000
CVT999*                          WRKLEN1,                               05000000
CVT999*                          CNS-AMOUNT-DISC-BAL,                   05010000
CVT999*                          WRKLEN2.                               05020000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     05040000
                                                                        
       2125-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************05090000
      * 2130-DESC-AMOUNT-SECURITY                                      *05100000
      *     CALLS       TDESCRIB                                       *05110000
      *                 TDSETBCD                                       *05120000
      *                 9100-CHECK-ERROR                               *05130000
      *                                                                *05140000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *05150000
      *                                                                *05160000
      *     DESCRIBE AMOUNT-SECURITY RESULT FIELD TO THE CLIENT     *   05170000
      ******************************************************************05180000
       2130-DESC-AMOUNT-SECURITY.                                       
                                                                        
           MOVE '2130'                           TO ACTIVE-PARAGRAPH.   
CVT999*    ADD  1                                TO CTR-COLUMN.         05230000
CVT999*    MOVE TDSDECIMAL                       TO DB-HOST-TYPE.       05240000
CVT999*    MOVE TDSFLT8                          TO DB-CLIENT-TYPE.     05250000
CVT999*    MOVE LENGTH OF RS-AMOUNT-SECURITY     TO WRKLEN1.            05260000
CVT999*    MOVE LENGTH OF CNS-AMOUNT-SECURITY TO WRKLEN2.               05270000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              05290000
CVT999*                          GWL-RC,                                05300000
CVT999*                          CTR-COLUMN,                            05310000
CVT999*                          DB-HOST-TYPE,                          05320000
CVT999*                          WRKLEN1,                               05330000
CVT999*                          RS-AMOUNT-SECURITY,                    05340000
CVT999*                          DB-NULL-INDICATOR,                     05350000
CVT999*                          TDS-FALSE,                             05360000
CVT999*                          DB-CLIENT-TYPE,                        05370000
CVT999*                          WRKLEN1,                               05380000
CVT999*                          CNS-AMOUNT-SECURITY,                   05390000
CVT999*                          WRKLEN2.                               05400000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     05420000
                                                                        
       2130-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************05461000
      * 2135-DESC-DATE-BILL-DAY-00                                     *05462000
      *     CALLS       TDESCRIB                                       *05463000
      *                 9100-CHECK-ERROR                               *05464000
      *                                                                *05465000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *05466000
      *                                                                *05467000
      *     DESCRIBE DATE-BILL-DAY-00  RESULT FIELD TO THE CLIENT   *   05468000
      ******************************************************************05469000
       2135-DESC-DATE-BILL-DAY-00.                                      
                                                                        
           MOVE '2135'                           TO ACTIVE-PARAGRAPH.   
CVT999*    ADD  1                                TO CTR-COLUMN.         05469500
CVT999*    MOVE TDSCHAR                          TO DB-HOST-TYPE.       05469600
CVT999*    MOVE TDSCHAR                          TO DB-CLIENT-TYPE.     05469700
CVT999*    MOVE LENGTH OF RS-DATE-BILL-DAY-00 TO WRKLEN1.               05469800
CVT999*    MOVE LENGTH OF CNS-DATE-BILL-DAY-00 TO WRKLEN2.              05469900
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              05471000
CVT999*                          GWL-RC,                                05472000
CVT999*                          CTR-COLUMN,                            05473000
CVT999*                          DB-HOST-TYPE,                          05474000
CVT999*                          WRKLEN1,                               05475000
CVT999*                          RS-DATE-BILL-DAY-00,                   05476000
CVT999*                          DB-NULL-INDICATOR,                     05477000
CVT999*                          TDS-FALSE,                             05478000
CVT999*                          DB-CLIENT-TYPE,                        05479000
CVT999*                          WRKLEN1,                               05479100
CVT999*                          CNS-DATE-BILL-DAY-00,                  05479200
CVT999*                          WRKLEN2.                               05479300
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     05479500
                                                                        
       2135-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************05480100
      * 2140-DESC-CREDIT-GROUP                                         *05481000
      *     CALLS       TDESCRIB                                       *05482000
      *                 9100-CHECK-ERROR                               *05483000
      *                                                                *05484000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *05485000
      *                                                                *05486000
      *     DESCRIBE CREDIT-GROUP    RESULT FIELD TO THE CLIENT     *   05487000
      ******************************************************************05488000
       2140-DESC-CREDIT-GROUP.                                          
                                                                        
           MOVE '2140'                          TO ACTIVE-PARAGRAPH.    
CVT999*    ADD 1                                TO CTR-COLUMN.          05489400
CVT999*    MOVE TDSCHAR                         TO DB-HOST-TYPE.        05489500
CVT999*    MOVE TDSCHAR                         TO DB-CLIENT-TYPE.      05489600
CVT999*    MOVE LENGTH OF RS-CREDIT-GROUP       TO WRKLEN1.             05489700
CVT999*    MOVE LENGTH OF CNS-CREDIT-GROUP       TO WRKLEN2.            05489800
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              05490000
CVT999*                          GWL-RC,                                05491000
CVT999*                          CTR-COLUMN,                            05492000
CVT999*                          DB-HOST-TYPE,                          05493000
CVT999*                          WRKLEN1,                               05494000
CVT999*                          RS-CREDIT-GROUP,                       05495000
CVT999*                          DB-NULL-INDICATOR,                     05496000
CVT999*                          TDS-FALSE,                             05497000
CVT999*                          DB-CLIENT-TYPE,                        05498000
CVT999*                          WRKLEN1,                               05499000
CVT999*                          CNS-CREDIT-GROUP,                      05499100
CVT999*                          WRKLEN2.                               05499200
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     05499400
                                                                        
       2140-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************05860000
      * 2145-DESC-CODE-ARREARS                                         *05870000
      *     CALLS       TDESCRIB                                       *05880000
      *                 9100-CHECK-ERROR                               *05890000
      *                                                                *05900000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *05910000
      *                                                                *05920000
      *     DESCRIBE CODE-ARREARS    RESULT FIELD TO THE CLIENT     *   05930000
      ******************************************************************05940000
       2145-DESC-CODE-ARREARS.                                          
                                                                        
           MOVE '2145'                          TO ACTIVE-PARAGRAPH.    
CVT999*    ADD 1                                TO CTR-COLUMN.          05990000
CVT999*    MOVE TDSCHAR                         TO DB-HOST-TYPE.        06000000
CVT999*    MOVE TDSCHAR                         TO DB-CLIENT-TYPE.      06010000
CVT999*    MOVE LENGTH OF RS-CODE-ARREARS       TO WRKLEN1.             06020000
CVT999*    MOVE LENGTH OF CNS-CODE-ARREARS       TO WRKLEN2.            06030000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              06050000
CVT999*                          GWL-RC,                                06060000
CVT999*                          CTR-COLUMN,                            06070000
CVT999*                          DB-HOST-TYPE,                          06080000
CVT999*                          WRKLEN1,                               06090000
CVT999*                          RS-CODE-ARREARS,                       06100000
CVT999*                          DB-NULL-INDICATOR,                     06110000
CVT999*                          TDS-FALSE,                             06120000
CVT999*                          DB-CLIENT-TYPE,                        06130000
CVT999*                          WRKLEN1,                               06140000
CVT999*                          CNS-CODE-ARREARS,                      06150000
CVT999*                          WRKLEN2.                               06160000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     06180000
                                                                        
       2145-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************06240000
      * 2150-DESC-CODE-DNP-TYPE                                        *06250000
      *     CALLS       TDESCRIB                                       *06260000
      *                 9100-CHECK-ERROR                               *06270000
      *                                                                *06280000
      *     CALLED FROM 2100-DESCRIBE-RESULT                           *06290000
      *                                                                *06300000
      *     DESCRIBE CODE-DNP-TYPE    RESULT FIELD TO THE CLIENT    *   06310000
      ******************************************************************06320000
       2150-DESC-CODE-DNP-TYPE.                                         
                                                                        
           MOVE '2150'                          TO ACTIVE-PARAGRAPH.    
CVT999*    ADD 1                                TO CTR-COLUMN.          06370000
CVT999*    MOVE TDSCHAR                         TO DB-HOST-TYPE.        06380000
CVT999*    MOVE TDSCHAR                         TO DB-CLIENT-TYPE.      06390000
CVT999*    MOVE LENGTH OF RS-CODE-DNP-TYPE TO WRKLEN1.                  06400000
CVT999*    MOVE LENGTH OF CNS-CODE-DNP-TYPE TO WRKLEN2.                 06410000
                                                                        
CVT999*    CALL 'TDESCRIB' USING GWL-PROC,                              06430000
CVT999*                          GWL-RC,                                06440000
CVT999*                          CTR-COLUMN,                            06450000
CVT999*                          DB-HOST-TYPE,                          06460000
CVT999*                          WRKLEN1,                               06470000
CVT999*                          RS-CODE-DNP-TYPE,                      06480000
CVT999*                          DB-NULL-INDICATOR,                     06490000
CVT999*                          TDS-FALSE,                             06500000
CVT999*                          DB-CLIENT-TYPE,                        06510000
CVT999*                          WRKLEN1,                               06520000
CVT999*                          CNS-CODE-DNP-TYPE,                     06530000
CVT999*                          WRKLEN2.                               06540000
                                                                        
CVT999*    PERFORM 9100-CHECK-ERROR THRU 9100-EXIT.                     06560000
                                                                        
       2150-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************06620000
      * 2300-BUILD-RESULT                                              *06630000
      *     CALLS                                                       06640000
      *                                                                 06650000
      *                                                                *06670000
      *     CALLED FROM 2000-PROCESS-OUTPUT                            *06680000
      *                                                                *06690000
      *     BUILD THE RESULT SET DESCRIBED ABOVE.                      *06700000
      ******************************************************************06710000
       2300-BUILD-RESULT.                                               
                                                                        
           MOVE '2300'                     TO ACTIVE-PARAGRAPH.         
                                                                        
           PERFORM 7300-SELECT-ACCOUNT     THRU 7300-EXIT.              
           IF WS-ACTIVE-RETURN-CODE = NOT-FOUND                         
              PERFORM 5700-SEND-RESULT     THRU 5700-EXIT               
              GO TO 2300-EXIT                                           
           END-IF.                                                      
T10857     MOVE AT-CODES-DATA-PRESENT      TO WS-CODES-DATA-PRESENT.    
           PERFORM 7100-GET-DAYS-AGO       THRU 7100-EXIT.              
           PERFORM 3100-CALCULATE-DNP-BAL  THRU 3100-EXIT.              
           PERFORM 3300-CALC-SECURITY      THRU 3300-EXIT.              
           PERFORM 3400-DETERMINE-AGING    THRU 3400-EXIT.              
                                                                        
           MOVE WS-AMT-DNP-BAL             TO RS-AMOUNT-DISC-BAL.       
           MOVE WS-AMT-SEC-BAL             TO RS-AMOUNT-SECURITY.       
           MOVE AT-DATE-BILL-DAY-00        TO RS-DATE-BILL-DAY-00.      
           MOVE AT-CREDIT-GROUP            TO RS-CREDIT-GROUP.          
           MOVE WS-CODE-ARREARS            TO RS-CODE-ARREARS.          
           MOVE SPACES                     TO RS-CODE-DNP-TYPE.         
                                                                        
           PERFORM 8100-SEND-RESULT        THRU 8100-EXIT.              
                                                                        
       2300-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
                                                                        
      ******************************************************************06980000
      * 3100-CALCULATE-DNP-BAL                                         *06990000
      *     CALLS 7400-SUM-UTL-CHARGE                                   07010000
      *                                                                *07020000
      *     CALLED FROM 2300-BUILD-RESULT                              *07030000
      *                                                                *07040000
      *     BUILD THE RESULT SET DESCRIBED ABOVE.                      *07050000
      ******************************************************************07060000
       3100-CALCULATE-DNP-BAL.                                          
                                                                        
      *--CALLING CPD00068 TO GET DISCONNECT BALANCE FOR DNP -->         07088800
           MOVE WS-ACCOUNT-NO       TO AT-ACCOUNT-NO.                   
           MOVE ZEROS               TO RS-AMOUNT-DISC-BAL.              
           MOVE WS-YES              TO CALC-DNP-BAL-SW                  
                                       CALC-ARREARS-SW                  
                                       CALC-BALANCE-SW.                 
T22359     MOVE PROGRAM-NAME               TO WS-CPD00068-CALLING-PGM.  
T19557     MOVE CWS00068-FIELDS            TO WS-CWS68-FIELDS-LK.       
T19557     MOVE WS-CODES-DATA-PRESENT      TO WS-CODES-DATA-PRESENT-LK. 
T19557     MOVE DCLCSS-ACCOUNT             TO WS-DCLCSS-ACCOUNT-LK.     
T19557     MOVE ABEND-FILE                 TO WS-ABEND-FILE-LK.         
T19557     MOVE RS-RETURN-CODE             TO WS-RETURN-CODE-LK.        
T19557     MOVE SPACES                     TO ABEND-FUNCTION .          
T19557     PERFORM 9500-CALL-CPD00068      THRU 9500-EXIT.              
T19557*    MOVE WS-CWS68-FIELDS-LK         TO CWS00068-FIELDS                   
T19557*    MOVE WS-ABEND-FILE-LK           TO ABEND-FILE                        
T19557*    MOVE WS-DCLCSS-ACCOUNT-LK       TO DCLCSS-ACCOUNT                    
T19557*    MOVE WS-CODES-DATA-PRESENT-LK   TO WS-CODES-DATA-PRESENT             
T19557*    MOVE WS-RETURN-CODE-LK          TO RS-RETURN-CODE                    
T19557     MOVE RS-RETURN-CODE             TO  WS-ACTIVE-RETURN-CODE,   
T19557                                        SQLCODE.                  
T19557     IF ABEND-FUNCTION  > SPACES                                  
T19557        PERFORM 9700-PROCESS-ABEND   THRU 9700-EXIT               
T19557     END-IF.                                                      
                                                                        
       3100-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************07093700
      * 3300-CALC-SECURITY                                             *07093800
      *     CALLS 7600-SUM-SURETY-BOND                                  07093900
      *           7605-SUM-IRR-LETTER                                  *07094000
      *           7610-SUM-GUARANTOR                                   *07094100
      *           7620-SUM-DEP-ON-HAND                                 *07094200
      *                                                                *07094300
      *     CALLED FROM 2300-BUILD-RESULT                              *07094400
      *                                                                *07094500
      *     BUILD THE RESULT SET DESCRIBED ABOVE.                      *07094600
      ******************************************************************07094700
       3300-CALC-SECURITY.                                              
                                                                        
           MOVE AT-ACCOUNT-NO TO SB-ACCOUNT-NO.                         
           MOVE WS-A          TO SB-CODE-BOND-TYPE.                     
           MOVE ZEROES        TO WS-AMT-BOND.                           
           PERFORM 7600-SUM-SURETY-BOND THRU 7600-EXIT.                 
                                                                        
           MOVE WS-B          TO SB-CODE-BOND-TYPE.                     
           MOVE ZEROES        TO WS-AMT-IRR-LTR.                        
           PERFORM 7605-SUM-IRR-LETTER THRU 7605-EXIT.                  
                                                                        
           MOVE AT-ACCOUNT-NO TO GU-ACCOUNT-NO.                         
           MOVE ZEROES        TO WS-AMT-GUARANTEED.                     
           PERFORM 7610-SUM-GUARANTOR THRU 7610-EXIT.                   
                                                                        
           MOVE AT-ACCOUNT-NO TO DO-ACCOUNT-NO.                         
           MOVE ZEROES        TO WS-AMT-DEP-ON-HAND.                    
           PERFORM 7620-SUM-DEP-ON-HAND THRU 7620-EXIT.                 
                                                                        
           COMPUTE WS-AMT-SEC-BAL = WS-AMT-BOND                         
                                  + WS-AMT-IRR-LTR                      
                                  + WS-AMT-GUARANTEED                   
                                  + WS-AMT-DEP-ON-HAND.                 
                                                                        
       3300-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************07098000
      * 3400-DETERMINE-AGING                                           *07098100
      *                                                                 07098200
      *     CALLS 7200-ARREARS-CODE                                     07098200
      *                                                                *07098300
      *                                                                *07098400
      *                                                                *07098500
      *                                                                *07098600
      *     CALLED FROM 2300-BUILD-RESULT                              *07098700
      *                                                                *07098800
      *     BUILD THE RESULT SET DESCRIBED ABOVE.                      *07098900
      ******************************************************************07099000
       3400-DETERMINE-AGING.                                            
                                                                        
           MOVE AT-ACCOUNT-NO TO                                        
                                 CZ-ACCOUNT-NO.                         
A01016     PERFORM 7200-ARREARS-CODE THRU 7200-EXIT.                    
A01016     MOVE WS-ARREARS-HIST(1:1) TO WS-CODE-ARREARS.                
                                                                        
       3400-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
                                                                        
      ******************************************************************07120000
      * 5700-SEND-RESULT                                               *07130000
      *     CALLS 8100-SEND-RESULT                                      07131000
      *                                                                *07140000
      *     CALLED FROM 2300-BUILD-RESULT                              *07150000
      *                                                                *07160000
      *     BUILD THE RESULT SET DESCRIBED ABOVE.                      *07170000
      ******************************************************************07171000
       5700-SEND-RESULT.                                                
                                                                        
           MOVE WS-ACTIVE-RETURN-CODE    TO RS-RETURN-CODE.             
           MOVE WS-TABLE-ID              TO RS-TABLE-ID.                
           MOVE WS-MSG-TEXT              TO RS-MSG-TEXT.                
                                                                        
           PERFORM 8100-SEND-RESULT      THRU 8100-EXIT.                
                                                                        
       5700-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************07470200
      * 7100-GET-DAYS-AGO.                                             *07470300
      *     CALLS       9000-SEND-ERROR-RESULT                         *07470400
      *                 9900-SQL-ERROR-ROUTINE                         *07470500
      *                                                                *07470600
      *     SELECT DATE FROM TODAY USING CSS_MODEL_SQL                 *07470700
      ******************************************************************07470800
       7100-GET-DAYS-AGO.                                               
                                                                        
           EXEC SQL                                                     
               SELECT DATEADD( DAY, -25, CAST(SYSDATETIMEOFFSET() 
           AS DATE) ),                           
                      DATEADD( DAY, -55, CAST(SYSDATETIMEOFFSET() 
           AS DATE) ),                           
                      DATEADD( DAY, -85, CAST(SYSDATETIMEOFFSET() 
           AS DATE) )                            
                 INTO :WS-DATE-25-DAYS-AGO,                             
                      :WS-DATE-55-DAYS-AGO,                             
                      :WS-DATE-85-DAYS-AGO                              
               FROM CSS_MODEL_SQL                                       
           END-EXEC.                                                    

MFA-TR* TRANSFORMATION LIST
MFA-TR* MSQ028
MFA-TR* MSQ044
MFA-TR*    EXEC SQL                                                     07472000
MFA-TR*        SELECT CURRENT DATE - 25 DAYS,                           07473000
MFA-TR*               CURRENT DATE - 55 DAYS,                           07474000
MFA-TR*               CURRENT DATE - 85 DAYS                            07475000
MFA-TR*          INTO :WS-DATE-25-DAYS-AGO,                             07476000
MFA-TR*               :WS-DATE-55-DAYS-AGO,                             07477000
MFA-TR*               :WS-DATE-85-DAYS-AGO                              07478000
MFA-TR*        FROM CSS_MODEL_SQL                                       07479000
MFA-TR*    END-EXEC.                                                    07479100

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 '7100'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_MODEL_SQL'       TO TABLE-1                     
                                            RS-TABLE-ID                 
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
CBSI          MOVE PARM-ACCOUNT-NO       TO HOSTVAR-ELEMENT-1           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT             
           END-IF.                                                      
       7100-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************07491300
      * 7200-ARREARS-CODE                                              *07492000
      *     CALLS       9000-SEND-ERROR-RESULT                         *07500000
      *                 9900-SQL-ERROR-ROUTINE                         *07510000
      *                                                                *07520000
      *     SELECT FROM CSS_CREDIT_PROFILE                             *07530000
      ******************************************************************07550000
A01016 7200-ARREARS-CODE.                                               
A01016     EXEC SQL                                                     
A01016         SELECT ARREARS_HIST                                      
A01016           INTO :WS-ARREARS-HIST                                  
A01016           FROM CSS_CREDIT_PROFILE                                
A01016          WHERE ACCOUNT_NO = :CZ-ACCOUNT-NO                       
A01016      END-EXEC.                                                   

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

A01016      MOVE SQLCODE TO WS-ACTIVE-RETURN-CODE RS-RETURN-CODE.       
A01016                                                                  
A01016      IF WS-ACTIVE-RETURN-CODE = SUCCESSFUL-CALL                  
A01016         NEXT SENTENCE                                            
A01016      ELSE                                                        
A01016         MOVE PROGRAM-NAME               TO ABEND-PROGRAM         
A01016         MOVE '7200'                     TO ACTIVE-PARAGRAPH      
A01016         MOVE 'SELECT ARREARS HIST'      TO TABLE-1               
A01016         MOVE 'CSS_CREDIT_PROFILE'       TO TABLE-2               
A01016         MOVE 'ACCOUNT_NO'               TO TABLE-ELEMENT-1       
A01016         MOVE CZ-ACCOUNT-NO              TO HOSTVAR-ELEMENT-1     
A01016         PERFORM 9000-SEND-ERROR-RESULT  THRU 9000-EXIT           
A01016         PERFORM 9900-SQL-ERROR-ROUTINE  THRU 9900-EXIT           
A01016      END-IF.                                                     
A01016 7200-EXIT.                                                       
A01016     EXIT.                                                        
                                                                        
      ******************************************************************07491300
      * 7300-SELECT-ACCOUNT                                            *07492000
      *     CALLS       9000-SEND-ERROR-RESULT                         *07500000
      *                 9900-SQL-ERROR-ROUTINE                         *07510000
      *                                                                *07520000
      *     SELECT FROM CSS_ACCOUNT                                    *07530000
      ******************************************************************07550000
       7300-SELECT-ACCOUNT.                                             
           EXEC SQL                                                     
                SELECT ACCOUNT_NO,                                      
                       CREDIT_GROUP,                                    
                       CODES_DATA_PRESENT,                              
                       DATE_BILL_DAY_00,       DATE_BILL_DAY_30,        
                       DATE_BILL_DAY_60,       DATE_BILL_DAY_90,        
T10857                 NOTICE_EXEMPT_CD,                                
T10857                 CODE_DISC_OK,                                    
T10857                 COMPANY_NO,                                      
T20165                 LOCAL_OFFICE,                                    
                       CODE_ACCT_STAT,                                  
                       BANKRUPTCY_IND,                                  
C28788                 IVR_EXEMPT_CD                                    
                INTO   :AT-ACCOUNT-NO,                                  
                       :AT-CREDIT-GROUP,                                
                       :AT-CODES-DATA-PRESENT,                          
                       :AT-DATE-BILL-DAY-00 :WS-NULL-DT-IND1,            
                       :AT-DATE-BILL-DAY-30 :WS-NULL-DT-IND2,            
                       :AT-DATE-BILL-DAY-60 :WS-NULL-DT-IND3,            
                       :AT-DATE-BILL-DAY-90 :WS-NULL-DT-IND4,            
                       :AT-NOTICE-EXEMPT-CD,                            
                       :AT-CODE-DISC-OK,                                
                       :AT-COMPANY-NO,                                  
T20165                 :AT-LOCAL-OFFICE,                                
                       :AT-CODE-ACCT-STAT,                              
                       :AT-BANKRUPTCY-IND,                              
C28788                 :AT-IVR-EXEMPT-CD                                
                FROM CSS_ACCOUNT                                        
                WHERE ACCOUNT_NO = :WS-ACCOUNT-NO                       
           END-EXEC.                                                    

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

                                                                        
           MOVE 'NO ACCOUNT-NO EXIST IN ACCOUNT' TO WS-MSG-TEXT         
           MOVE 'CSS_ACCOUNT'         TO WS-TABLE-ID                    
           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 '7300'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_ACCOUNT'         TO TABLE-1                     
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
CBSI          MOVE WS-ACCOUNT-NO         TO HOSTVAR-ELEMENT-1           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT
           END-IF.            
       7300-EXIT.                                                       
           EXIT.                                                        
                                                                        
                                                                        
      ******************************************************************07955800
      * 7600-SUM-SURETY-BOND                                           *07955900
      *     CALLS       9000-SEND-ERROR-RESULT                         *07956000
      *                 9900-SQL-ERROR-ROUTINE                         *07956100
      *                                                                *07956200
      *     FETCH AMT-DISC_BAL AND SECURITY, CODE_ARREARS AND          *07956300
      *     DNP_TYPE FROM CSS_DNP                                      *07956400
      ******************************************************************07956500
       7600-SUM-SURETY-BOND.                                            
           EXEC SQL                                                     
              SELECT SUM(AMT_BOND)                                      
                INTO :WS-AMT-BOND :WS-NULL-INDICATOR                     
              FROM CSS_SURETY_BOND                                      
              WHERE ACCOUNT_NO = :SB-ACCOUNT-NO                         
                AND CODE_BOND_TYPE = :SB-CODE-BOND-TYPE                 
                AND CODE_STATUS IN ('A','P')                            
           END-EXEC.                                                    

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

                                                                        
           MOVE 'CSS_SURETY_BOND'     TO WS-TABLE-ID                    
           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 '7600'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_SURETY_BOND'     TO TABLE-1                     
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
CBSI          MOVE 'CODE_BOND_TYPE'      TO TABLE-ELEMENT-2             
              MOVE SB-ACCOUNT-NO         TO HOSTVAR-ELEMENT-1           
              MOVE SB-CODE-BOND-TYPE     TO HOSTVAR-ELEMENT-2           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT
           END-IF.            
       7600-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************07959700
      * 7605-SUM-IRR-LETTER                                            *07959800
      *     CALLS       9000-SEND-ERROR-RESULT                         *07959900
      *                 9900-SQL-ERROR-ROUTINE                         *07960000
      *                                                                *07960100
      ******************************************************************07960200
       7605-SUM-IRR-LETTER.                                             
           EXEC SQL                                                     
              SELECT SUM(AMT_BOND)                                      
                INTO :WS-AMT-IRR-LTR :WS-NULL-INDICATOR                  
              FROM CSS_SURETY_BOND                                      
              WHERE ACCOUNT_NO = :SB-ACCOUNT-NO                         
                AND CODE_BOND_TYPE = :SB-CODE-BOND-TYPE                 
                AND CODE_STATUS IN ('A','P')                            
           END-EXEC.                                                    

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

                                                                        
           MOVE 'CSS_SURETY_BOND'     TO WS-TABLE-ID                    
           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 '7605'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_SURETY_BOND'     TO TABLE-1                     
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
CBSI          MOVE 'CODE_BOND_TYPE'      TO TABLE-ELEMENT-2             
              MOVE SB-ACCOUNT-NO         TO HOSTVAR-ELEMENT-1           
              MOVE SB-CODE-BOND-TYPE     TO HOSTVAR-ELEMENT-2           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT
           END-IF.            
       7605-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************07963200
      * 7610-SUM-GUARANTOR                                             *07963300
      *     CALLS       9000-SEND-ERROR-RESULT                         *07963400
      *                 9900-SQL-ERROR-ROUTINE                         *07963500
      *                                                                *07963600
      ******************************************************************07963700
       7610-SUM-GUARANTOR.                                              
           EXEC SQL                                                     
              SELECT SUM(AMOUNT_GUARANTEED)                             
                INTO :WS-AMT-GUARANTEED :WS-NULL-INDICATOR               
              FROM CSS_GUARANTOR                                        
              WHERE ACCOUNT_NO = :GU-ACCOUNT-NO                         
           END-EXEC.                                                    

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

                                                                        
           MOVE 'CSS_GUARANTOR'       TO WS-TABLE-ID                    
           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 '7610'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_GUARANTOR'       TO TABLE-1                     
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
              MOVE GU-ACCOUNT-NO         TO HOSTVAR-ELEMENT-1           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT
           END-IF.            
       7610-EXIT.                                                       
           EXIT.                                                        
                                                                        
      ******************************************************************07966600
      * 7620-SUM-DEP-ON-HAND                                           *07966700
      *     CALLS       9000-SEND-ERROR-RESULT                         *07966800
      *                 9900-SQL-ERROR-ROUTINE                         *07966900
      *                                                                *07967000
      ******************************************************************07967100
       7620-SUM-DEP-ON-HAND.                                            
           EXEC SQL                                                     
              SELECT SUM(AMT_DEPOSIT)                                   
                INTO :WS-AMT-DEP-ON-HAND :WS-NULL-INDICATOR              
              FROM CSS_DEP_ON_HAND                                      
              WHERE ACCOUNT_NO = :DO-ACCOUNT-NO                         
                AND (DEPOSIT_STATUS_CD = 'A'                            
                 OR  DEPOSIT_STATUS_CD = 'P')                           
           END-EXEC.                                                    

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

                                                                        
           MOVE 'CSS_DEP_ON_HAND'     TO WS-TABLE-ID                    
           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 '7620'                TO ACTIVE-PARAGRAPH            
              MOVE 'SELECT'              TO ABEND-FUNCTION              
              MOVE SPACES                TO ABEND-SQL-PREDICATES        
                                            ABEND-TABLES                
              MOVE 'CSS_DEP_ON_HAND'     TO TABLE-1                     
CBSI          MOVE 'ACCOUNT_NO'          TO TABLE-ELEMENT-1             
              MOVE DO-ACCOUNT-NO         TO HOSTVAR-ELEMENT-1           
              PERFORM 9000-SEND-ERROR-RESULT THRU 9000-EXIT             
              PERFORM 9900-SQL-ERROR-ROUTINE THRU 9900-EXIT
           END-IF.            
       7620-EXIT.                                                       
           EXIT.                                                        
                                                                        
T19557 9500-CALL-CPD00068.                                              
T19557                                                                  
CVT999*    EXEC CICS LINK                                                       
CVT000         CALL  MCSCB068  USING CWS00068-FIELDS,                   
CVT000                               WS-CODES-DATA-PRESENT,             
CVT000                               DCLCSS-ACCOUNT,                    
CVT000                               ABEND-FILE,                        
CVT000                               RS-RETURN-CODE.                    
CVT999*              PROGRAM ('SCSCO068')                                       
CVT999*              COMMAREA (WS-CPD68-LINK-RECORD)                            
CVT999*              LENGTH (LENGTH OF WS-CPD68-LINK-RECORD)                    
CVT999*              RESP (WS-EIBRESP)                                          
CVT999*    END-EXEC                                                             
CVT999*                                                                         
CVT999*    IF WS-EIBRESP = DFHRESP(NORMAL)                                      
CVT999*       CONTINUE                                                          
CVT999*    ELSE                                                                 
CVT999*       MOVE -1                         TO RS-RETURN-CODE                 
CVT999*       MOVE RS-RETURN-CODE             TO WS-ACTIVE-RETURN-CODE,         
CVT999*                                          SQLCODE                        
CVT999*       MOVE PROGRAM-NAME               TO ABEND-PROGRAM                  
CVT999*       MOVE '9500'                     TO ACTIVE-PARAGRAPH               
CVT999*       MOVE 'LINKFAIL'                 TO ABEND-FUNCTION                 
CVT999*       PERFORM 9700-PROCESS-ABEND      THRU 9700-EXIT                    
CVT999*    END-IF.                                                              
T19557                                                                  
T19557 9500-EXIT.                                                       
T19557     EXIT.                                                        
                                                                        
      ******************************************************************07970000
      * 9900- JOURNALING / ERROR HANDLING INCLUDE *                     07970100
      ******************************************************************07970200
           EXEC SQL                                                     07970300
              INCLUDE CPDSP300                                          07971000
           END-EXEC.                                                    07980000
                                                                        
           EXEC SQL                                                     07991000
              INCLUDE CPD0023C                                          07992000
           END-EXEC.                                                    07993000
                                                                        
      ******************************************************************08000000
      *       END PROGRAM COPYLIB                                      *08010000
      ******************************************************************08020000
CVT999*    COPY CPD00302.                                               08030000
                                                                        
CVT000 8100-SEND-RESULT.                                                
CVT000       ADD 1 TO CTR-ROWS.                                         
CVT000 8100-EXIT.                                                       
CVT000        EXIT.                                                     
CVT000     EXEC SQL                                                     00000100
CVT000         INCLUDE CPD00321                                         00000200
CVT000     END-EXEC.                                                    00000300
