Sunteți pe pagina 1din 20

*----------------------------------------------------------------

* COMPANIA : BBV PERU - BCO CONTINENTAL


* SISTEMA : ALTAMIRA
* APLICATIVO : COMERCIO EXTERIOR CORPORATIVO
* MODULO : ARQUITECTURA E INTERFASES
* SUB-MODULO : TARIFARIO ESTANDAR
* NOMBRE : XC2CY240
*****************************************************************
* XC2CY240 *
* -------- *
* *
* DETALLE DEL PROCESO: *
* *
* -> MANTENIMIENTO DE TIPO DE CALCULO *
*---------------------------------------------------------------*
* - MODIFICACIONES - *
* FECHA USER DESCRIPCION *
*------------------------------------------------------------- *
* 24-05-2001 C621A PARRAFOS,ERRORES,QG1CABC *
*---------------------------------------------------------------*
* 27-01-14 |XA50351| | LA MODIFICACION CONSISTE EN GRABAR *
* CDA INFORMATICA |P53757 | UN LOG CON LOS DATOS DE PANTALLA *
* | | | PARA TRAZABILIDAD CUANDO SE REALI- *
* | | | ZA UN ALTA, UNA BAJA, O MODIF. *
*---------------------------------------------------------------*
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. XC2CY240.
DATE-WRITTEN. 09/08/2001.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
*****************************************************************
* DATA DIVISION *
* *
*****************************************************************
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*------------------------*
*********** IDENTIFICADOR DE INICIO DE WORKING STORAGE **********
01 LT-INICIO-WS.
05 LT-INICIO-W PIC X(40) VALUE
'*** INICIO WORKING STORAGE (XC2CY240) **'.
P53757*********** COPY PARA GRABACION DE LOGS DE TRAZABILIDAD **********
| 01 W-QR5CLOG0 PIC X(08) VALUE 'QR5CLOG0'.
| COPY QRWCLOGT.
P53757 COPY XCWCTR54.
********************* COPYS COBOL *******************************
COPY DFHAID.
01 QGECABC-01.
COPY QGECABC.
*
************** COPY DE LA RUTINA TC2C1000 ***********************
************** TABLAS COORPORATIVAS ***********************
01 W-TCWC0000.
COPY TCWC0000.
COPY TCTC1130.
************** COPY DE LA RUTINA XC7CQ000 ***********************
************** TABLA INTERNAS COMEXT CORP ***********************
01 W-XC7CQ000 PIC X(08) VALUE 'XC7CQ000'.
01 W-XCWCQ000.
COPY XCWCQ000.
************* COPY PARA GRABACION DE LOGS *********************
01 W-XC7CTLG0 PIC X(08) VALUE 'XC7CTLG0'.
01 W-XCWCTLG0.
COPY XCWCTLG0.

************************** SWITCHES *****************************


01 SWITCHES.
05 SW-TECLA PIC X(2) VALUE ' '.
88 PFENTER VALUE '00'.
88 PF2 VALUE '02'.
88 PF3 VALUE '03'.
88 PF4 VALUE '04'.
88 PF6 VALUE '06'.
88 PF7 VALUE '07'.
88 PF8 VALUE '08'.
88 PF10 VALUE '10'.
88 SPF10 VALUE '20'.
88 CLEAR VALUE '99'.
05 SW-EXISTE PIC X(02).
05 SW-CAMBIO-CLAVE PIC X(02).
*********************** CONSTANTES*******************************
COPY XCWCQPA.
*********************** VARIABLES *******************************
01 W-CURRENT-DATE PIC X(26).
01 W-VARIABLES.
P53757 05 W-ID-EVENTO PIC S9(9) COMP.
| 05 W-TIPO-EVENTO PIC X(02).
P53757 05 W-ANTES-DESPUES PIC X(01).
05 W-ACCION PIC X(03).
05 W-ERROR PIC X(40).
05 W-SQLERR PIC X(07).
05 W-SQLCODE PIC +9(03).
05 W-SQLERRM PIC X(70).
05 W-TABLA PIC X(08).
05 W-OBJETO-ERROR PIC X(08).
05 W-PROGRAMA PIC X(08).
05 W-REFERENCIA PIC X(20).
05 W-XCNCY24.
15 W-CTIPCAL PIC X(02).
15 W-CTIPCALL PIC S9(4) COMP.
15 W-DTIPCAL PIC X(35).
15 W-DTIPCALL PIC S9(4) COMP.
15 W-DFORMUL PIC X(50).
15 W-DFORMULL PIC S9(4) COMP.
15 W-CMONTAS PIC X(01).
15 W-CMONTASL PIC S9(4) COMP.
15 W-CFIJTAS PIC X(01).
15 W-CFIJTASL PIC S9(4) COMP.
15 W-YINTERE PIC X(01).
15 W-YINTEREL PIC S9(4) COMP.
15 W-YVARIAB PIC X(01).
15 W-YVARIABL PIC S9(4) COMP.
15 W-YACTIVA PIC X(01).
15 W-YACTIVAL PIC S9(4) COMP.
05 WMAX-CTIPCAL PIC X(02).
05 WMAX-CTIPCAL-NUM PIC 9(02).
05 W-XCNCY24-INI PIC X(1000).
***************** DECLARACION DE TABLAS DB2 *********************
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL INCLUDE XCGTY22 END-EXEC.
*********** IDENTIFICADOR DE FINAL DE WORKING STORAGE ***********
01 LT-FINAL-WS.
05 LT-FINAL-W PIC X(40) VALUE
'*** FINAL WORKING STORAGE (XC2CY240) ***'.
* *
LINKAGE SECTION.
*===============
01 DFHCOMMAREA.
COPY QGECCAA.
COPY XCECCMA.
COPY XCECYCA.
COPY XCNCY24.
*
*****************************************************************
* *
* PROCEDURE DIVISION *
* *
*****************************************************************
*
PROCEDURE DIVISION.
*
PERFORM 100000-INICIO-PROGRAMA.
PERFORM 200000-PROCESO-PROGRAMA.
PERFORM 300000-FIN-PROGRAMA.
*
*****************************************************************
* *
* 100000-INICIO-PROGRAMA *
* *
*****************************************************************
*
100000-INICIO-PROGRAMA.
*
INITIALIZE QGECABC.
*
EXEC SQL
SET :W-CURRENT-DATE = CURRENT TIMESTAMP
END-EXEC

EVALUATE SQLCODE
WHEN ZEROS
CONTINUE
WHEN OTHER
MOVE 'SET TSTA' TO W-OBJETO-ERROR
MOVE 'OBTIENE TIMESTAMP' TO W-REFERENCIA
PERFORM 999999-ERROR-DB2
END-EVALUATE
EXEC CICS
IGNORE CONDITION ERROR
END-EXEC.
IF EIBRESP NOT EQUAL DFHRESP(NORMAL)
MOVE 'ERROR CICS XC2CY240' TO ABC-REFERENCIA
MOVE 'XC2CY240' TO ABC-OBJETO-ERROR
PERFORM 999999-ERROR-CICS
END-IF.
SET ADDRESS OF XCNCY24 TO CAA-PTR-COPYIN.
SET ADDRESS OF XCECCMA TO CAA-PTRDATA.
*
IF CAA-CASO = 'R'
MOVE CAA-DATOS TO XYCA-CLAVE-Y24
MOVE ' ' TO CAA-CASO
END-IF.
*
*****************************************************************
* *
* 200000-PROCESO-PROGRAMA *
* *
* LOS PASOS A DAR EN ESTE PARRAFO SON LOS SIGUIENTES: *
* *
* DECIDIR ENTRE LOS DOS ESTADOS POSIBLES *
* *
* - INICIO *
* - CONTINUACION *
* - CONFIRMACION *
*****************************************************************
*
200000-PROCESO-PROGRAMA.
*
EVALUATE TRUE
WHEN CAA-88-ESTADO-INICIO
PERFORM 210000-ESTADO-INICIO
WHEN CAA-88-ESTADO-CONTIN
PERFORM 220000-ESTADO-CONTINUACION
WHEN CAA-88-ESTADO-CONFIR
PERFORM 230000-ESTADO-CONFIRMACION
END-EVALUATE.
*
*****************************************************************
* *
* 210000-ESTADO-INICIO *
* *
*****************************************************************
210000-ESTADO-INICIO.
*
MOVE XCNCY24 TO W-XCNCY24-INI.
MOVE LOW-VALUES TO XCNCY24.
MOVE XYCA-CTIPCAL TO Y24-CTIPCAL.
PERFORM 211000-LOW-POR-RAYAS-BLANCOS.
MOVE XYCA-CTIPCAL TO W-CTIPCAL.
IF XYCA-YALTA EQUAL 'S'
MOVE 'N' TO XYCA-YALTA
IF XYCA-CTIPCAL EQUAL SPACES OR
XYCA-CTIPCAL EQUAL LOW-VALUES
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'CODIGO CALCULO ' TO CAA-VAR1-AVISO1
MOVE -1 TO W-CTIPCALL
PERFORM 300000-FIN-PROGRAMA
ELSE
PERFORM 222210-ACCESAR-XCDTY22
IF SW-EXISTE EQUAL 'SI'
MOVE 'XCE0014' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO' TO CAA-VAR1-ERROR
MOVE XYCA-CTIPCAL TO CAA-VAR2-ERROR
PERFORM 300000-FIN-PROGRAMA
END-IF
END-IF
ELSE
PERFORM 222100-VALIDA-CLAVE
PERFORM 222200-CONSULTAR-DATOS
END-IF.
MOVE -1 TO W-CTIPCALL.
*-----------------------------*
211000-LOW-POR-RAYAS-BLANCOS.
*-----------------------------*
INSPECT Y24-CTIPCAL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-DTIPCAL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-DFORMUL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-CMONTAS REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-CFIJTAS REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-YINTERE REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-YVARIAB REPLACING ALL LOW-VALUES BY SPACES.
INSPECT Y24-YACTIVA REPLACING ALL LOW-VALUES BY SPACES.
*--------------------*
222100-VALIDA-CLAVE.
*--------------------*
MOVE LOW-VALUES TO XYCA-CTIPCAL.
PERFORM 222120-VALIDA-CTIPCAL-INF.
PERFORM 222130-CARGA-COMMAREA.
*-------------------------*
222120-VALIDA-CTIPCAL-INF.
*-------------------------*
MOVE Y24-CTIPCAL TO W-CTIPCAL.
INSPECT W-CTIPCAL REPLACING ALL '_' BY SPACES.
IF W-CTIPCAL EQUAL SPACES OR
W-CTIPCAL EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO' TO CAA-VAR1-ERROR
MOVE -1 TO W-CTIPCALL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*----------------------*
222130-CARGA-COMMAREA.
*----------------------*
MOVE Y24-CTIPCAL TO W-CTIPCAL.
INSPECT W-CTIPCAL REPLACING ALL '_' BY SPACES.
MOVE W-CTIPCAL TO XYCA-CTIPCAL.
*
*-----------------------------*
*
*****************************************************************
* *
* 220000-ESTADO-CONTINUACION *
* *
* EQUIVALENTE A 'RECIBIR MAPA' *
* *
* 1. VALIDAR CAMPOS VARIABLES DE MAPA *
* 2. VALIDAR TECLA PULSADA (PF3 O INTRO VALIDARS) *
* CUALQUIER OTRO CASO MOSTRARA MENSAJE DE ERROR *
* 3. INDICARA A ARQUITECTURA CUAL ES LA SIGUIENTE TRANSACCION *
* SEGUN INFORMACION DE ENTRADA *
* *
*****************************************************************
*
220000-ESTADO-CONTINUACION.
*
PERFORM 221000-CARGAR-WORKA-PANTALLA
PERFORM 221000-COMPARAR-CLAVE.
MOVE CAA-TECLA TO SW-TECLA.
EVALUATE TRUE
WHEN PFENTER
PERFORM 222000-CONSULTA-VALIDACION
WHEN PF2
PERFORM 223000-MODIFICACION
WHEN PF3
PERFORM 224000-ALTA
WHEN PF4
PERFORM 225000-LIMPIAR
WHEN PF6
PERFORM 226000-DAR-DE-BAJA
WHEN SPF10
PERFORM 229000-MOVER-AUDITORIA
WHEN OTHER
MOVE 'XCE0001' TO CAA-COD-ERROR
END-EVALUATE.
MOVE -1 TO W-CTIPCALL.
*---------------------*
222000-CONSULTA-VALIDACION.
*--------------------------*
*
IF SW-CAMBIO-CLAVE = 'SI'
PERFORM 222100-VALIDA-CLAVE
PERFORM 222200-CONSULTAR-DATOS
PERFORM 222300-VALIDA-DATOS
MOVE 'XCA0001' TO CAA-COD-AVISO1
MOVE 'CONSULTA' TO CAA-VAR1-AVISO1
ELSE
PERFORM 221000-CARGAR-WORKA-PANTALLA
PERFORM 222300-VALIDA-DATOS
PERFORM 222400-MENSAJE-VALIDACION
END-IF.
*--------------------------*
222400-MENSAJE-VALIDACION.
*--------------------------*
PERFORM 222210-ACCESAR-XCDTY22
IF SW-EXISTE = 'SI'
MOVE 'XCA0007' TO CAA-COD-AVISO1
MOVE 'PARA MODIFICACION' TO CAA-VAR1-AVISO1
ELSE
MOVE 'XCA0007' TO CAA-COD-AVISO1
MOVE 'PARA ALTA' TO CAA-VAR1-AVISO1
END-IF.
*
*
*---------------------*
221000-CARGAR-WORKA-PANTALLA.
*---------------------*
MOVE Y24-CTIPCAL TO W-CTIPCAL.
MOVE Y24-DTIPCAL TO W-DTIPCAL.
MOVE Y24-DFORMUL TO W-DFORMUL.
MOVE Y24-CMONTAS TO W-CMONTAS.
MOVE Y24-CFIJTAS TO W-CFIJTAS.
MOVE Y24-YINTERE TO W-YINTERE.
MOVE Y24-YVARIAB TO W-YVARIAB.
MOVE Y24-YACTIVA TO W-YACTIVA.
INSPECT W-CTIPCAL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-DTIPCAL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-DFORMUL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-CMONTAS REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-CFIJTAS REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-YINTERE REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-YVARIAB REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-CTIPCAL REPLACING ALL '_' BY SPACES.
INSPECT W-DTIPCAL REPLACING ALL '_' BY SPACES.
INSPECT W-DFORMUL REPLACING ALL '_' BY SPACES.
INSPECT W-CMONTAS REPLACING ALL '_' BY SPACES.
INSPECT W-CFIJTAS REPLACING ALL '_' BY SPACES.
INSPECT W-YINTERE REPLACING ALL '_' BY SPACES.
INSPECT W-YVARIAB REPLACING ALL '_' BY SPACES.
*---------------------*
221000-COMPARAR-CLAVE.
*---------------------*
MOVE Y24-CTIPCAL TO W-CTIPCAL.
INSPECT W-CTIPCAL REPLACING ALL LOW-VALUES BY SPACES.
INSPECT W-CTIPCAL REPLACING ALL '_' BY SPACES.
IF W-CTIPCAL EQUAL XYCA-CTIPCAL
MOVE 'NO' TO SW-CAMBIO-CLAVE
ELSE
MOVE 'SI' TO SW-CAMBIO-CLAVE
END-IF.
* *****
******************************************************************
* *
*
*---------------------*
222200-CONSULTAR-DATOS.
*---------------------*
PERFORM 222210-ACCESAR-XCDTY22.
IF SW-EXISTE = 'SI'
MOVE TY22-XC-DTIPCAL TO W-DTIPCAL
MOVE TY22-XC-DFORMUL TO W-DFORMUL
MOVE TY22-XC-CMONTAS TO W-CMONTAS
MOVE TY22-XC-CFIJTAB TO W-CFIJTAS
MOVE TY22-XC-YINTERE TO W-YINTERE
MOVE TY22-XC-YVARIAB TO W-YVARIAB
MOVE TY22-XC-YACTIVA TO W-YACTIVA
ELSE
MOVE 'XCE0013' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO' TO CAA-VAR1-ERROR
MOVE -1 TO W-CTIPCALL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*---------------------*
222210-ACCESAR-XCDTY22.
*---------------------*
PERFORM 222211-CARGA-CLAVE-XCDTY22.
EXEC SQL
SELECT
TY22_XC_DTIPCAL,
TY22_XC_DFORMUL,
TY22_XC_CMONTAS,
TY22_XC_CFIJTAB,
TY22_XC_YINTERE,
TY22_XC_YVARIAB,
TY22_XC_YACTIVA,
TY22_XC_CENTALT,
TY22_XC_COFIALT,
TY22_XC_CTERALT,
TY22_XC_CUSUALT,
TY22_XC_FTSTALT,
TY22_XC_CENTUMO,
TY22_XC_COFIUMO,
TY22_XC_CTERUMO,
TY22_XC_CUSUUMO,
TY22_XC_FTSTUMO
INTO
:TY22-XC-DTIPCAL,
:TY22-XC-DFORMUL,
:TY22-XC-CMONTAS,
:TY22-XC-CFIJTAB,
:TY22-XC-YINTERE,
:TY22-XC-YVARIAB,
:TY22-XC-YACTIVA,
:TY22-XC-CENTALT,
:TY22-XC-COFIALT,
:TY22-XC-CTERALT,
:TY22-XC-CUSUALT,
:TY22-XC-FTSTALT,
:TY22-XC-CENTUMO,
:TY22-XC-COFIUMO,
:TY22-XC-CTERUMO,
:TY22-XC-CUSUUMO,
:TY22-XC-FTSTUMO
FROM XCDTY22
WHERE TY22_XC_CTIPCAL =: TY22-XC-CTIPCAL
END-EXEC.
EVALUATE SQLCODE
WHEN ZEROS
MOVE 'SI' TO SW-EXISTE
WHEN +100
MOVE 'NO' TO SW-EXISTE
WHEN OTHER
MOVE SQLCODE TO W-SQLCODE
MOVE SQLERRM TO W-SQLERRM
MOVE 'XCDTY22' TO W-TABLA
MOVE 'XC2CY240' TO W-PROGRAMA
MOVE 'ACCESAR-XCDTY22' TO W-REFERENCIA
MOVE -1 TO W-CTIPCALL
PERFORM 999999-ERROR-DB2
END-EVALUATE.
*----------------------------*
222211-CARGA-CLAVE-XCDTY22.
*----------------------------*
MOVE W-CTIPCAL TO TY22-XC-CTIPCAL.
*---------------------*
222300-VALIDA-DATOS.
*---------------------*
PERFORM 222310-VALIDAR-DTIPCAL.
PERFORM 222310-VALIDAR-DFORMUL.
PERFORM 222310-VALIDAR-CMONTAS.
PERFORM 222310-VALIDAR-CFIJTAS.
PERFORM 222310-VALIDAR-YINTERE.
PERFORM 222310-VALIDAR-YVARIAB.
PERFORM 222310-VALIDAR-YACTIVA.
*-------------------------*
222310-VALIDAR-DTIPCAL.
*-------------------------*

IF W-DTIPCAL EQUAL SPACES OR


W-DTIPCAL EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'DESCRIPCION CALCULO' TO CAA-VAR1-ERROR
MOVE -1 TO W-DTIPCALL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-DFORMUL.
*-------------------------*
IF W-DFORMUL EQUAL SPACES OR
W-DFORMUL EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'DESCRIPCION DE' TO CAA-VAR1-ERROR
MOVE 'FORMULA' TO CAA-VAR2-ERROR
MOVE -1 TO W-DFORMULL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-CMONTAS.
*-------------------------*
IF W-CMONTAS EQUAL SPACES OR
W-CMONTAS EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'COD MONTO/TASA ' TO CAA-VAR1-ERROR
MOVE -1 TO W-CMONTASL
PERFORM 300000-FIN-PROGRAMA
END-IF.
IF W-CMONTAS NOT EQUAL 'M' AND 'T'
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'M = MONTO / T = TASA' TO CAA-VAR1-AVISO1
MOVE -1 TO W-CMONTASL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-CFIJTAS.
*-------------------------*
IF W-CFIJTAS EQUAL SPACES OR
W-CFIJTAS EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'COD FIJO / TASA ' TO CAA-VAR1-ERROR
MOVE -1 TO W-CFIJTASL
PERFORM 300000-FIN-PROGRAMA
END-IF.
IF W-CFIJTAS NOT EQUAL 'F' AND 'T'
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'F = FIJO / T = TASA' TO CAA-VAR1-AVISO1
MOVE -1 TO W-CFIJTASL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-YINTERE.
*-------------------------*
IF W-YINTERE EQUAL SPACES OR
W-YINTERE EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'INDICADOR DE INTERES' TO CAA-VAR1-ERROR
MOVE -1 TO W-YINTEREL
PERFORM 300000-FIN-PROGRAMA
END-IF.
IF W-YINTERE NOT EQUAL 'S' AND 'N'
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'S = SI / O = NO' TO CAA-VAR1-AVISO1
MOVE -1 TO W-YINTEREL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-YVARIAB.
*-------------------------*
IF W-YVARIAB EQUAL SPACES OR
W-YVARIAB EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'INDICADOR DE VARIABL' TO CAA-VAR1-ERROR
MOVE -1 TO W-YVARIABL
PERFORM 300000-FIN-PROGRAMA
END-IF.
IF W-YVARIAB NOT EQUAL 'S' AND 'N'
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'S = SI / O = NO' TO CAA-VAR1-AVISO1
MOVE -1 TO W-YVARIABL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*-------------------------*
222310-VALIDAR-YACTIVA.
*-------------------------*
IF W-YACTIVA EQUAL SPACES OR
W-YACTIVA EQUAL LOW-VALUES
MOVE 'XCE0006' TO CAA-COD-ERROR
MOVE 'INDICADOR DE ACTIVA ' TO CAA-VAR1-ERROR
MOVE -1 TO W-YACTIVAL
PERFORM 300000-FIN-PROGRAMA
END-IF.
IF W-YACTIVA NOT EQUAL 'S' AND 'N'
MOVE 'XCA0011' TO CAA-COD-AVISO1
MOVE 'S = SI / O = NO' TO CAA-VAR1-AVISO1
MOVE -1 TO W-YACTIVAL
PERFORM 300000-FIN-PROGRAMA
END-IF.
******************************************************************
******************************************************************
* *
* 223000-MODIFICACION *
* *
******************************************************************
223000-MODIFICACION.
*
IF SW-CAMBIO-CLAVE = 'NO'
PERFORM 221000-CARGAR-WORKA-PANTALLA
PERFORM 222300-VALIDA-DATOS
P53757 PERFORM 223400-MODIF-ANTES-TRAZAB
PERFORM 223100-MODIFICA-XCDTY22
P53757 PERFORM 223500-MODIF-DESPUES-TRAZAB
ELSE
JM0525 MOVE 'XCA0003' TO CAA-COD-AVISO1
MOVE ' INTRO ' TO CAA-VAR1-AVISO1
MOVE 'VALIDAR CLAVE' TO CAA-VAR2-AVISO1
END-IF.
*------------------------*
223100-MODIFICA-XCDTY22.
*------------------------*
MOVE 'MOD' TO W-ACCION.
PERFORM 222211-CARGA-CLAVE-XCDTY22.
PERFORM 224120-CARGA-DATOS-XCDTY22.
PERFORM 224140-AUDITORIA-UMO-XCDTY22.
EXEC SQL
UPDATE XCDTY22
SET TY22_XC_DTIPCAL =: TY22-XC-DTIPCAL,
TY22_XC_DFORMUL =: TY22-XC-DFORMUL,
TY22_XC_CMONTAS =: TY22-XC-CMONTAS,
TY22_XC_CFIJTAB =: TY22-XC-CFIJTAB,
TY22_XC_YINTERE =: TY22-XC-YINTERE,
TY22_XC_YVARIAB =: TY22-XC-YVARIAB,
TY22_XC_YACTIVA =: TY22-XC-YACTIVA,
TY22_XC_CENTUMO =: TY22-XC-CENTUMO,
TY22_XC_COFIUMO =: TY22-XC-COFIUMO,
TY22_XC_CTERUMO =: TY22-XC-CTERUMO,
TY22_XC_CUSUUMO =: TY22-XC-CUSUUMO,
TY22_XC_FTSTUMO = CURRENT TIMESTAMP
WHERE
TY22_XC_CTIPCAL =: TY22-XC-CTIPCAL
END-EXEC.
EVALUATE SQLCODE
WHEN ZEROS
MOVE 'XCA0001' TO CAA-COD-AVISO1
MOVE 'MODIFICACION' TO CAA-VAR1-AVISO1
WHEN +100
MOVE 'XCE0013' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO' TO CAA-VAR1-ERROR
WHEN OTHER
MOVE SQLCODE TO W-SQLCODE
MOVE SQLERRM TO W-SQLERRM
MOVE 'XCDTY22' TO W-TABLA
MOVE 'XC2CY240' TO W-PROGRAMA
MOVE 'MODIFICA-XCDTY22' TO W-REFERENCIA
MOVE -1 TO W-CTIPCALL
PERFORM 999999-ERROR-DB2
END-EVALUATE.
*
P53757*---------------------*
| 223400-MODIF-ANTES-TRAZAB.
| *---------------------*
| PERFORM 222210-ACCESAR-XCDTY22
| MOVE TY22-XC-CTIPCAL TO TR54-CTIPCAL
| MOVE TY22-XC-DTIPCAL TO TR54-DTIPCAL
| MOVE TY22-XC-DFORMUL TO TR54-DFORMUL
| MOVE TY22-XC-CMONTAS TO TR54-CMONTAS
| MOVE TY22-XC-CFIJTAB TO TR54-CFIJTAS
| MOVE TY22-XC-YINTERE TO TR54-YINTERE
| MOVE TY22-XC-YVARIAB TO TR54-YVARIAB
| MOVE TY22-XC-YACTIVA TO TR54-YACTIVA
| MOVE 11111 TO W-ID-EVENTO
| MOVE 'M' TO W-TIPO-EVENTO
| MOVE 'A' TO W-ANTES-DESPUES
| PERFORM 910000-TRAZABILIDAD.
| *---------------------*
| 223500-MODIF-DESPUES-TRAZAB.
| *---------------------*
| PERFORM 222210-ACCESAR-XCDTY22
| MOVE TY22-XC-CTIPCAL TO TR54-CTIPCAL
| MOVE TY22-XC-DTIPCAL TO TR54-DTIPCAL
| MOVE TY22-XC-DFORMUL TO TR54-DFORMUL
| MOVE TY22-XC-CMONTAS TO TR54-CMONTAS
| MOVE TY22-XC-CFIJTAB TO TR54-CFIJTAS
| MOVE TY22-XC-YINTERE TO TR54-YINTERE
| MOVE TY22-XC-YVARIAB TO TR54-YVARIAB
| MOVE TY22-XC-YACTIVA TO TR54-YACTIVA
| MOVE 11111 TO W-ID-EVENTO
| MOVE 'M' TO W-TIPO-EVENTO
| MOVE 'D' TO W-ANTES-DESPUES
| PERFORM 910000-TRAZABILIDAD.
P53757
*
******************************************************************
* *
* 224000-ALTA *
* *
******************************************************************
224000-ALTA.
*
PERFORM 221000-CARGAR-WORKA-PANTALLA.
PERFORM 222100-VALIDA-CLAVE.
PERFORM 222300-VALIDA-DATOS.
PERFORM 224100-ALTA-XCDTY22.
*
*---------------------*
224100-ALTA-XCDTY22.
*---------------------*
MOVE 'ALT' TO W-ACCION.
INITIALIZE DCLXCDTY22
MOVE W-CURRENT-DATE TO TY22-XC-FTSTALT
MOVE '0001-01-01-01.01.01.000001' TO TY22-XC-FTSTUMO
MOVE '0001-01-01' TO TY22-XC-FLIBRE1
PERFORM 222211-CARGA-CLAVE-XCDTY22.
PERFORM 224120-CARGA-DATOS-XCDTY22.
PERFORM 224130-AUDITORIA-ALT-XCDTY22.
PERFORM 224140-AUDITORIA-UMO-XCDTY22.
P53757 PERFORM 224150-ALTA-TRAZAB
EXEC SQL
INSERT INTO XCDTY22
VALUES (:TY22-XC-CTIPCAL
,:TY22-XC-DTIPCAL
,:TY22-XC-DFORMUL
,:TY22-XC-CMONTAS
,:TY22-XC-CFIJTAB
,:TY22-XC-YINTERE
,:TY22-XC-YVARIAB
,:TY22-XC-YACTIVA
,:TY22-XC-CENTALT
,:TY22-XC-COFIALT
,:TY22-XC-CTERALT
,:TY22-XC-CUSUALT
,:TY22-XC-FTSTALT
,:TY22-XC-CENTUMO
,:TY22-XC-COFIUMO
,:TY22-XC-CTERUMO
,:TY22-XC-CUSUUMO
,:TY22-XC-FTSTUMO
, NULL
, NULL)
END-EXEC
EVALUATE SQLCODE
WHEN ZEROS
MOVE 'XCA0001' TO CAA-COD-AVISO1
MOVE 'ALTA ' TO CAA-VAR1-AVISO1
WHEN -803
MOVE 'XCE0014' TO CAA-COD-ERROR
MOVE 'COD TIPO DE CALCULO' TO CAA-VAR1-ERROR
WHEN OTHER
MOVE SQLCODE TO W-SQLCODE
MOVE SQLERRM TO W-SQLERRM
MOVE 'XCDTY22' TO W-TABLA
MOVE 'XC2CY240' TO W-PROGRAMA
MOVE 'ALTA-XCDTY22' TO W-REFERENCIA
MOVE -1 TO W-CTIPCALL
PERFORM 999999-ERROR-DB2
END-EVALUATE.
*--------------------------*
224120-CARGA-DATOS-XCDTY22.
*--------------------------*
MOVE W-DTIPCAL TO TY22-XC-DTIPCAL
MOVE W-DFORMUL TO TY22-XC-DFORMUL.
MOVE W-CMONTAS TO TY22-XC-CMONTAS.
MOVE W-CFIJTAS TO TY22-XC-CFIJTAB.
MOVE W-YINTERE TO TY22-XC-YINTERE.
MOVE W-YVARIAB TO TY22-XC-YVARIAB.
MOVE W-YACTIVA TO TY22-XC-YACTIVA.
*-----------------------------*
224130-AUDITORIA-ALT-XCDTY22.
*-----------------------------*
MOVE CAA-ENTIDAD TO TY22-XC-CENTALT.
MOVE CAA-CENTRO-CONT TO TY22-XC-COFIALT.
MOVE CAA-USERID TO TY22-XC-CUSUALT.
MOVE CAA-TERMINAL TO TY22-XC-CTERALT.
*-----------------------------*
224140-AUDITORIA-UMO-XCDTY22.
*-----------------------------*
MOVE CAA-ENTIDAD TO TY22-XC-CENTUMO.
MOVE CAA-CENTRO-CONT TO TY22-XC-COFIUMO.
MOVE CAA-USERID TO TY22-XC-CUSUUMO.
MOVE CAA-TERMINAL TO TY22-XC-CTERUMO.
P53757*-----------------------------*
| 224150-ALTA-TRAZAB.
| *-----------------------------*
| MOVE TY22-XC-CTIPCAL TO TR54-CTIPCAL
| MOVE TY22-XC-DTIPCAL TO TR54-DTIPCAL
| MOVE TY22-XC-DFORMUL TO TR54-DFORMUL
| MOVE TY22-XC-CMONTAS TO TR54-CMONTAS
| MOVE TY22-XC-CFIJTAB TO TR54-CFIJTAS
| MOVE TY22-XC-YINTERE TO TR54-YINTERE
| MOVE TY22-XC-YVARIAB TO TR54-YVARIAB
| MOVE TY22-XC-YACTIVA TO TR54-YACTIVA
| MOVE 11111 TO W-ID-EVENTO
| MOVE 'A' TO W-TIPO-EVENTO
| MOVE 'D' TO W-ANTES-DESPUES
| PERFORM 910000-TRAZABILIDAD.
| *-----------------------------*
| 224150-BAJA-TRAZAB.
| *-----------------------------*
| MOVE Y24-CTIPCAL TO TR54-CTIPCAL
| MOVE Y24-DTIPCAL TO TR54-DTIPCAL
| MOVE Y24-DFORMUL TO TR54-DFORMUL
| MOVE Y24-CMONTAS TO TR54-CMONTAS
| MOVE Y24-CFIJTAS TO TR54-CFIJTAS
| MOVE Y24-YINTERE TO TR54-YINTERE
| MOVE Y24-YVARIAB TO TR54-YVARIAB
| MOVE Y24-YACTIVA TO TR54-YACTIVA
| MOVE 11111 TO W-ID-EVENTO
| MOVE 'B' TO W-TIPO-EVENTO
| MOVE 'A' TO W-ANTES-DESPUES
| PERFORM 910000-TRAZABILIDAD.
P53757
******************************************************************
* *
* 225000-LIMPIAR *
* *
******************************************************************
225000-LIMPIAR.
*
INITIALIZE W-XCNCY24.
PERFORM 222100-VALIDA-CLAVE.
*
******************************************************************
* *
* 226000-DAR-DE-BAJA *
* *
******************************************************************
226000-DAR-DE-BAJA.
*
IF SW-CAMBIO-CLAVE EQUAL 'NO'
MOVE 'XCA0002' TO CAA-COD-AVISO1
MOVE 'PF7' TO CAA-VAR1-AVISO1
ELSE
JM0525 MOVE 'XCA0003' TO CAA-COD-AVISO1
MOVE ' INTRO ' TO CAA-VAR1-AVISO1
MOVE 'VALIDAR CLAVE' TO CAA-VAR2-AVISO1
END-IF.
*
******************************************************************
* *
* 229000-MOVER-AUDITORIA *
* *
******************************************************************
229000-MOVER-AUDITORIA.
*
IF SW-CAMBIO-CLAVE EQUAL 'NO'
PERFORM 229100-CONSULTAR-MOVER-AUDIT
MOVE 'N' TO XYCA-YALTA
PERFORM INFORMAR-RETORNO-QGECCAA
ELSE
EXEC CICS SEND TEXT FROM(SW-CAMBIO-CLAVE) END-EXEC
JM0525 MOVE 'XCE0002' TO CAA-COD-ERROR
MOVE ' INTRO ' TO CAA-VAR1-ERROR
MOVE 'VALIDAR CLAVE' TO CAA-VAR2-ERROR
END-IF.
*
*--------------------------------*
229100-CONSULTAR-MOVER-AUDIT.
*--------------------------------*
PERFORM 222210-ACCESAR-XCDTY22.
IF SW-EXISTE = 'SI'
IF TY22-XC-FTSTUMO(1:10) = '0001-01-01'
MOVE TY22-XC-CENTALT TO XYCA-CENTALT
MOVE TY22-XC-COFIALT TO XYCA-COFIALT
MOVE TY22-XC-CUSUALT TO XYCA-CUSUALT
MOVE TY22-XC-CTERALT TO XYCA-CTERALT
MOVE TY22-XC-FTSTALT TO XYCA-FTSTALT
MOVE SPACES TO XYCA-CENTUMO
XYCA-COFIUMO
XYCA-CUSUUMO
XYCA-CTERUMO
XYCA-FTSTUMO
ELSE
MOVE TY22-XC-CENTALT TO XYCA-CENTALT
MOVE TY22-XC-COFIALT TO XYCA-COFIALT
MOVE TY22-XC-CUSUALT TO XYCA-CUSUALT
MOVE TY22-XC-CTERALT TO XYCA-CTERALT
MOVE TY22-XC-FTSTALT TO XYCA-FTSTALT
MOVE TY22-XC-CENTUMO TO XYCA-CENTUMO
MOVE TY22-XC-COFIUMO TO XYCA-COFIUMO
MOVE TY22-XC-CUSUUMO TO XYCA-CUSUUMO
MOVE TY22-XC-CTERUMO TO XYCA-CTERUMO
MOVE TY22-XC-FTSTUMO TO XYCA-FTSTUMO
END-IF
ELSE
MOVE 'XCE0013' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO ' TO CAA-VAR1-ERROR
MOVE -1 TO W-CTIPCALL
PERFORM 300000-FIN-PROGRAMA
END-IF.
*------------------------*
INFORMAR-RETORNO-QGECCAA.
*------------------------*
MOVE 'R' TO CAA-CASO-CAD.
MOVE XYCA-CLAVE-Y24 TO CAA-DATOS-CAD.
******************************************************************
* *
* 230000-ESTADO-CONFIRMACION *
* *
* 1. CONFIRMAR SOLO SI SE UTILIZA UNA DAR-DE-BAJA *
* 2. VERIFICAR QUE TECLA DE FUNCION SEA VALIDAR *
* SI CORRECTA - VERIFICA QUE NO SE HAYA MODIFICADO INFORMA *
* CION DE LA PANTALLA *
* - REALIZA DELETE FISICO DE REGISTRO DE TRANS. *
* NO CORRECTO - ENVIA MENSAJE DE ERROR *
******************************************************************
230000-ESTADO-CONFIRMACION.
*
PERFORM 221000-CARGAR-WORKA-PANTALLA
MOVE CAA-TECLA TO SW-TECLA.
EVALUATE TRUE
WHEN PF7
IF CAA-88-MOD-TAG-NO
PERFORM 221100-DAR-DE-BAJA-XCDTY22
ELSE
MOVE 'XCE0017' TO CAA-COD-ERROR
END-IF
WHEN OTHER
MOVE 'XCA0004' TO CAA-COD-AVISO1
END-EVALUATE.
MOVE -1 TO W-CTIPCALL.
*
*------------------*
221100-DAR-DE-BAJA-XCDTY22.
*------------------*
MOVE 'BAJ' TO W-ACCION.
PERFORM 222211-CARGA-CLAVE-XCDTY22.
P53757 PERFORM 224150-BAJA-TRAZAB.
EXEC SQL
DELETE FROM XCDTY22
WHERE TY22_XC_CTIPCAL =: TY22-XC-CTIPCAL
END-EXEC.
EVALUATE SQLCODE
WHEN ZEROS
MOVE 'XCA0001 ' TO CAA-COD-AVISO1
MOVE ' BAJA' TO CAA-VAR1-AVISO1
WHEN -532
MOVE 'XCA0008' TO CAA-COD-AVISO1
WHEN +100
MOVE 'XCE0013' TO CAA-COD-ERROR
MOVE 'TIPO DE CALCULO' TO CAA-VAR1-ERROR
WHEN OTHER
MOVE SQLCODE TO W-SQLCODE
MOVE SQLERRM TO W-SQLERRM
MOVE 'XCDTY22' TO W-TABLA
MOVE 'XC2CY240' TO W-PROGRAMA
MOVE 'DAR-DE-BAJA-XCDTY22' TO W-REFERENCIA
MOVE -1 TO W-CTIPCALL
PERFORM 999999-ERROR-DB2
END-EVALUATE.
*
******************************************************************
* *
* 300000-FIN-PROGRAMA *
* *
* -DEVOLVER CONTROL A LA ARQUITECTURA *
* *
******************************************************************
300000-FIN-PROGRAMA.
*
PERFORM 310000-CARGA-PANTALLA.
*
EVALUATE TRUE
WHEN CAA-88-ESTADO-INICIO
PERFORM 320000-INFORMAR-CAA-INICIO
WHEN CAA-88-ESTADO-CONTIN
PERFORM 330000-INFORMAR-CAA-CONTIN
WHEN OTHER
PERFORM 340000-INFORMAR-CAA-CONFIR
END-EVALUATE.
*
EXEC CICS
RETURN
END-EXEC.
*
*-----------------------------*
310000-CARGA-PANTALLA.
*-----------------------------*
EVALUATE TRUE ALSO FALSE
WHEN CAA-88-ESTADO-INICIO ALSO CAA-88-COD-ERROR-VACIO
CONTINUE
WHEN OTHER
MOVE LOW-VALUES TO XCNCY24
MOVE W-CTIPCAL TO Y24-CTIPCAL
MOVE W-CTIPCALL TO Y24-CTIPCALL
MOVE W-DTIPCAL TO Y24-DTIPCAL
MOVE W-DTIPCALL TO Y24-DTIPCALL
MOVE W-DFORMUL TO Y24-DFORMUL
MOVE W-DFORMULL TO Y24-DFORMULL
MOVE W-CMONTAS TO Y24-CMONTAS
MOVE W-CMONTASL TO Y24-CMONTASL
MOVE W-CFIJTAS TO Y24-CFIJTAS
MOVE W-CFIJTASL TO Y24-CFIJTASL
MOVE W-YINTERE TO Y24-YINTERE
MOVE W-YINTEREL TO Y24-YINTEREL
MOVE W-YVARIAB TO Y24-YVARIAB
MOVE W-YVARIABL TO Y24-YVARIABL
MOVE W-YACTIVA TO Y24-YACTIVA
MOVE W-YACTIVAL TO Y24-YACTIVAL
PERFORM 211000-LOW-POR-RAYAS-BLANCOS
END-EVALUATE.
*
******************************************************************
* *
* 320000-INFORMAR-CAA-INICIO *
* *
* 1. SETEAR VARIABLES DE LA CAA, COMO QUEDAN EN ESTADO INICIO *
* *
******************************************************************
320000-INFORMAR-CAA-INICIO.
*
IF CAA-88-COD-ERROR-VACIO
MOVE CAA-CODTRAN TO CAA-CODTRAN-SIG
SET CAA-88-ACCION-TERMINAL TO TRUE
SET CAA-88-ESTADO-CONTIN TO TRUE
ELSE
SET CAA-88-CODTRAN-SIG-SAME TO TRUE
SET CAA-88-ACCION-TERMINAL TO TRUE
SET CAA-88-ESTADO-CONTIN TO TRUE
MOVE W-XCNCY24-INI TO XCNCY24
END-IF.
*
******************************************************************
* *
* 330000-INFORMAR-CAA-CONTIN *
* *
* 1. SETEAR VARIABLES DE CAA, COMO QUEDAN EN ESTADO CONTINUACION *
* *
******************************************************************
330000-INFORMAR-CAA-CONTIN.
*
IF CAA-88-COD-ERROR-VACIO
EVALUATE TRUE
WHEN PF6
SET CAA-88-CODTRAN-SIG-SAME TO TRUE
SET CAA-88-ACCION-TERMINAL TO TRUE
SET CAA-88-ESTADO-CONFIR TO TRUE
WHEN SPF10
MOVE 'XY1A' TO CAA-CODTRAN-SIG
SET CAA-88-ACCION-PROGRAMA TO TRUE
SET CAA-88-ESTADO-INICIO TO TRUE
SET CAA-88-CADENA-ANADIR TO TRUE
WHEN OTHER
SET CAA-88-CODTRAN-SIG-SAME TO TRUE
SET CAA-88-ACCION-TERMINAL TO TRUE
SET CAA-88-ESTADO-CONTIN TO TRUE
END-EVALUATE
ELSE
SET CAA-88-CODTRAN-SIG-SAME TO TRUE
SET CAA-88-ACCION-TERMINAL TO TRUE
SET CAA-88-ESTADO-CONTIN TO TRUE
END-IF.
*
******************************************************************
* *
* 340000-INFORMAR-CAA-CONFIR *
* *
* 1. SETEAR VARIABLES DE CAA, COMO QUEDAN EN ESTADO CONFIRMACION *
* *
******************************************************************
340000-INFORMAR-CAA-CONFIR.
*
SET CAA-88-CODTRAN-SIG-SAME TO TRUE.
SET CAA-88-ACCION-TERMINAL TO TRUE.
SET CAA-88-ESTADO-CONTIN TO TRUE.
*
P53757*--------------------*
| 910000-TRAZABILIDAD.
| *--------------------*
| INITIALIZE QRWCLOGT
| SET LOGT-MENSAJE TO ADDRESS OF XCWCTR54
| MOVE W-ID-EVENTO TO LOGT-ID-EVENTO
| MOVE W-TIPO-EVENTO TO LOGT-TIPO-EVENTO
| MOVE 'XC' TO LOGT-APLICATIVO
| MOVE 'XY24' TO LOGT-PROCESO
| MOVE W-ANTES-DESPUES TO LOGT-ANTES-DESPUES
| MOVE 'PAR' TO LOGT-MODALIDAD
| MOVE CAA-USERID TO LOGT-USUARIO
| MOVE CAA-TERMINAL TO LOGT-TERMINAL
| MOVE CAA-CANAL-OPERACION TO LOGT-CANAL
| MOVE CAA-CENTRO-CONT TO LOGT-SUCURSAL
|
| CALL W-QR5CLOG0 USING QRWCLOGT
|
| IF NOT LOGT-RETORNO-OK
| MOVE 'XCE0016' TO CAA-COD-ERROR
| MOVE LOGT-DESC-ERROR(1:20) TO CAA-VAR1-ERROR
| MOVE LOGT-DESC-ERROR(21:20) TO CAA-VAR2-ERROR
| PERFORM 300000-FIN-PROGRAMA
| END-IF.
P53757
*-----------------*
999999-ERROR-CICS.
*-----------------*
OJO PERFORM 9999999-GRABAR-LOG.
MOVE 'S' TO ABC-ABEND.
MOVE EIBFN TO ABC-EIBFN.
MOVE EIBRSRCE TO ABC-EIBRSRCE.
MOVE EIBRCODE TO ABC-EIBRCODE.
MOVE EIBRESP TO ABC-EIBRESP1.
MOVE EIBRESP2 TO ABC-EIBRESP2.
EXEC CICS LINK PROGRAM('QG1CABC')
COMMAREA(QGECABC)
END-EXEC.
*-----------------*
999999-ERROR-DB2.
*-----------------*
OJO PERFORM 9999999-GRABAR-LOG.
MOVE 'N' TO ABC-ABEND.
MOVE W-PROGRAMA TO ABC-PROGRAMA.
MOVE W-REFERENCIA TO ABC-REFERENCIA.
MOVE W-TABLA TO ABC-OBJETO-ERROR.
MOVE W-SQLCODE TO ABC-SQLCODE.
MOVE W-SQLERRM TO ABC-SQLERRM.
EXEC CICS
LINK
PROGRAM ('QG1CABC')
COMMAREA (QGECABC)
END-EXEC.
MOVE 'XCE0025' TO CAA-COD-ERROR.
MOVE W-TABLA TO CAA-VAR1-ERROR.
MOVE 'PGM' TO CAA-VAR1-ERROR(09:3).
MOVE W-PROGRAMA TO CAA-VAR1-ERROR(13:8).
MOVE W-SQLCODE TO CAA-VAR2-ERROR.
MOVE CAA-CODTRAN TO CAA-VAR2-ERROR(7:4).
PERFORM 300000-FIN-PROGRAMA.
*-----------------*
9999999-GRABAR-LOG.
*-----------------*
INITIALIZE WTLG-REGISTRO
MOVE W-SQLCODE TO W-SQLERR
MOVE W-SQLERR TO WTLG-CERROR
MOVE 'XY' TO WTLG-CMODULO
MOVE 'L' TO WTLG-CLINBAT
MOVE 'XC2CY240' TO WTLG-CPROGRA
MOVE CAA-CODTRAN TO WTLG-CTRANSA
MOVE CAA-USERID TO WTLG-CUSUARI
MOVE CAA-TERMINAL TO WTLG-CTERMIN
MOVE CAA-ENTIDAD TO WTLG-CENTOPE
MOVE SPACES TO WTLG-COFIOPE
MOVE SPACES TO WTLG-CCTAOPE
MOVE ZEROES TO WTLG-NSECOPE
MOVE ZEROES TO WTLG-NSECEMB
MOVE ZEROES TO WTLG-NSECLIQ
MOVE ZEROES TO WTLG-NSECMOV
MOVE SPACES TO WTLG-CPROACT
MOVE SPACES TO WTLG-CNIVACT
MOVE SPACES TO WTLG-CACCACT
MOVE W-ACCION TO WTLG-CTIPREG
MOVE W-REFERENCIA TO WTLG-DTXTREF
MOVE SPACE TO WTLG-CRUTREF
MOVE SPACE TO WTLG-CKEYREF
MOVE 'XCECYCA' TO WTLG-CCPYAP1
MOVE 'XCDTY22' TO WTLG-CCPYAP2
MOVE XCECYCA TO WTLG-DDATAP1
MOVE DCLXCDTY22 TO WTLG-DDATAP2
MOVE CAA-ENTIDAD TO WTLG-CENTPRO
MOVE CAA-CENTRO-CONT TO WTLG-COFIPRO
EXEC CICS
LINK PROGRAM (W-XC7CTLG0)
COMMAREA (W-XCWCTLG0)
END-EXEC.
MOVE SPACES TO W-ERROR
EVALUATE WTLG-CDRETO
WHEN '00'
CONTINUE
WHEN OTHER
MOVE 'XCE0020' TO CAA-COD-ERROR
MOVE 'EN DB2' TO CAA-VAR1-ERROR(5:6)
MOVE WTLG-CDRETO TO CAA-VAR1-ERROR(1:4)
MOVE 'ACCESO XC7CTLG0' TO W-REFERENCIA
MOVE 'XC7CTLG0' TO CAA-VAR2-ERROR
END-EVALUATE.