-
Notifications
You must be signed in to change notification settings - Fork 0
/
db2-tp40.cbl
688 lines (553 loc) · 49.7 KB
/
db2-tp40.cbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
IDENTIFICATION DIVISION.
PROGRAM-ID PGMDB215.
***********************************************
* *
* CHECK-POINT 32 BATCH *
* TP 40 - 14-11-2022 *
* *
***********************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ENTRADA ASSIGN DDENTRA
FILE STATUS IS FS-ENT.
SELECT LISTADO ASSIGN DDLISTA
FILE STATUS IS FS-LIS.
DATA DIVISION.
FILE SECTION.
FD ENTRADA
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS F.
01 REG-ENTRADA PIC X(80).
FD LISTADO
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS F.
01 REG-LISTADO PIC X(132).
WORKING-STORAGE SECTION.
**************************************
77 FS-ENT PIC XX VALUE SPACES.
77 FS-LIS PIC XX VALUE SPACES.
77 WS-SQLCODE PIC +++999 USAGE DISPLAY VALUE ZEROS.
01 WS-STATUS-FIN PIC X.
88 WS-FIN-LECTURA VALUE 'Y'.
88 WS-NO-FIN-LECTURA VALUE 'N'.
01 WS-VALIDADOR PIC X.
88 WS-ERROR VALUE 'Y'.
88 WS-NO-ERROR VALUE 'N'.
01 WS-FECHA-ACTUAL.
03 WS-ANIO PIC 9(4) VALUE ZEROS.
03 FILLER PIC X(1) VALUE '-'.
03 WS-MES PIC 9(2) VALUE ZEROS.
03 FILLER PIC X(1) VALUE '-'.
03 WS-DIA PIC 9(2) VALUE ZEROS.
01 WS-STATUS-FECHA PIC X.
88 WS-FECHA-VALIDA VALUE 'Y'.
88 WS-FECHA-NOT-VALIDA VALUE 'N'.
77 WS-RESULTADO PIC 9(04) VALUE ZEROS.
77 WS-RESTO-4 PIC 9(04)V99 VALUE ZEROS.
77 WS-RESTO-100 PIC 9(02)V99 VALUE ZEROS.
77 WS-RESTO-400 PIC 9(02)V99 VALUE ZEROS.
COPY NOVECLIE.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE TB99CLIE
END-EXEC.
77 WS-TOT-LEI PIC 99 VALUE ZEROS.
77 WS-TOT-ERR PIC 99 VALUE ZEROS.
77 WS-TOT-ALTAS PIC 99 VALUE ZEROS.
77 WS-TOT-MOD PIC 99 VALUE ZEROS.
77 WS-PRINT PIC ZZ9 VALUE ZEROS.
01 WS-REG-LISTADO.
03 FILLER PIC X(17) VALUE 'TIPO DE NOVEDAD: '.
03 WS-LIS-NOV PIC XX VALUE ZEROS.
03 FILLER PIC X(9) VALUE SPACES.
03 FILLER PIC X(19) VALUE 'TIPO DE DOCUMENTO: '.
03 WS-LIS-TIP-DOC PIC XX VALUE SPACES.
03 FILLER PIC X(5) VALUE SPACES.
03 FILLER PIC X(18) VALUE 'NRO DE DOCUMENTO: '.
03 WS-LIS-NRO-DOC PIC 9(11) VALUE ZEROS.
03 FILLER PIC X VALUE SPACES.
01 WS-REG-ERROR.
03 FILLER PIC X(3) VALUE SPACES.
03 FILLER PIC X(26)
VALUE 'ERROR ENCONTRADO EN CAMPO '.
03 WS-ERROR-TIPO PIC X(30) VALUE ZEROS.
03 FILLER PIC X(2) VALUE ': '.
03 WS-ERROR-CAMPO PIC X(30) VALUE SPACES.
03 FILLER PIC X VALUE SPACES.
01 WS-REG-TITULO.
03 FILLER PIC X VALUE '*'.
03 FILLER PIC X(45) VALUE SPACES.
03 FILLER PIC X(32)
VALUE ' NOVEDADES CON ERROR - FECHA: '.
03 WS-DD PIC Z9 VALUE ZEROS.
03 FILLER PIC X VALUE '-'.
03 WS-MM PIC Z9 VALUE ZEROS.
03 FILLER PIC X VALUE '-'.
03 FILLER PIC 99 VALUE 20.
03 WS-AA PIC 99 VALUE ZEROS.
03 FILLER PIC X(32) VALUE SPACES.
03 FILLER PIC X(08) VALUE 'PAGINA: '.
03 WS-PAGINA PIC Z9 VALUE ZEROS.
03 FILLER PIC X VALUE SPACES.
03 FILLER PIC X VALUE '*'.
01 WS-SEPARADOR PIC X(132) VALUE ALL '*'.
01 WS-SEPARADOR-REG PIC X(132) VALUE ALL '='.
01 WS-FECHA.
03 WS-FECHA-AA PIC 99 VALUE ZEROS.
03 WS-FECHA-MM PIC 99 VALUE ZEROS.
03 WS-FECHA-DD PIC 99 VALUE ZEROS.
77 WS-CUENTA-LINEA PIC 9(02) VALUE ZEROS.
77 WS-CUENTA-PAGINA PIC 9(02) VALUE 01.
PROCEDURE DIVISION.
*****************************************************
**************************************
* *
* CUERPO PRINCIPAL DEL PROGRAMA *
* *
**************************************
MAIN-PROGRAM-INICIO.
PERFORM 1000-I-INICIO THRU 1000-F-INICIO.
PERFORM 2000-I-PROCESO THRU 2000-F-PROCESO
UNTIL WS-FIN-LECTURA.
PERFORM 9999-I-FINAL THRU 9999-I-FINAL.
MAIN-PROGRAM-FINAL. GOBACK.
**************************************
1000-I-INICIO.
**************************************
ACCEPT WS-FECHA FROM DATE.
MOVE WS-FECHA-AA TO WS-AA.
MOVE WS-FECHA-MM TO WS-MM.
MOVE WS-FECHA-DD TO WS-DD.
MOVE 62 TO WS-CUENTA-LINEA.
SET WS-NO-FIN-LECTURA TO TRUE.
OPEN INPUT ENTRADA.
IF FS-ENT IS NOT EQUAL '00'
DISPLAY '* ERROR EN OPEN ENTRADA INICIO = ' FS-ENT
SET WS-FIN-LECTURA TO TRUE
END-IF.
OPEN OUTPUT LISTADO.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN OPEN IMPRESION INICIO = ' FS-LIS
SET WS-FIN-LECTURA TO TRUE
END-IF.
PERFORM 2100-LECTURA THRU 2100-F-LECTURA.
1000-F-INICIO. EXIT.
**************************************
2000-I-PROCESO.
**************************************
EVALUATE NOV-TIP-NOV
WHEN 'AL'
PERFORM 3000-VALIDACION-AL THRU 3000-F-VALIDACION-AL
IF WS-ERROR THEN
ADD 1 TO WS-TOT-ERR
ELSE
PERFORM 4000-INSERT-AL THRU 4000-F-INSERT-AL
END-IF
WHEN 'CN'
PERFORM 3010-VALIDACION-CN THRU 3010-F-VALIDACION-CN
IF WS-ERROR THEN
ADD 1 TO WS-TOT-ERR
ELSE
PERFORM 4010-UPDATE-CN THRU 4010-F-UPDATE-CN
END-IF
WHEN 'CL'
PERFORM 3020-VALIDACION-CL THRU 3020-F-VALIDACION-CL
IF WS-ERROR THEN
ADD 1 TO WS-TOT-ERR
ELSE
PERFORM 4020-UPDATE-CL THRU 4020-F-UPDATE-CL
END-IF
WHEN 'CX'
PERFORM 3030-VALIDACION-CX THRU 3030-F-VALIDACION-CX
IF WS-ERROR THEN
ADD 1 TO WS-TOT-ERR
ELSE
PERFORM 4030-UPDATE-CX THRU 4030-F-UPDATE-CX
END-IF
WHEN OTHER
ADD 1 TO WS-TOT-ERR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
INITIALIZE WS-REG-ERROR
MOVE 'NOVEDAD' TO WS-ERROR-TIPO
MOVE NOV-TIP-NOV TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-EVALUATE.
PERFORM 2100-LECTURA THRU 2100-F-LECTURA.
2000-F-PROCESO. EXIT.
***** LECTURA ARCHIVO NOVEDADES ******
2100-LECTURA.
**************************************
READ ENTRADA INTO WS-REG-NOVECLI.
EVALUATE FS-ENT
WHEN '00'
ADD 1 TO WS-TOT-LEI
SET WS-NO-ERROR TO TRUE
WHEN '10'
SET WS-FIN-LECTURA TO TRUE
WHEN OTHER
DISPLAY '*ERROR EN LECTURA ENTRADA : ' FS-ENT
SET WS-FIN-LECTURA TO TRUE
END-EVALUATE.
2100-F-LECTURA. EXIT.
***** VALIDACION DE CAMPOS ***********
3000-VALIDACION-AL.
**************************************
SET WS-NO-ERROR TO TRUE.
IF NOV-TIP-DOC IS EQUAL TO
'DU' OR 'PA' OR 'LE' OR 'LC'
CONTINUE
ELSE
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'TIPO DE DOCUMENTO' TO WS-ERROR-TIPO
MOVE NOV-TIP-DOC TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
IF NOV-NRO-DOC IS NOT NUMERIC OR
NOV-NRO-DOC < 1
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'NRO DE DOCUMENTO' TO WS-ERROR-TIPO
MOVE NOV-NRO-DOC TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
IF NOV-CLI-NRO IS NOT NUMERIC OR
NOV-CLI-NRO < 1
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'NUMERO DE CLIENTE' TO WS-ERROR-TIPO
MOVE NOV-CLI-NRO TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
IF NOV-CLI-NOMBRE IS EQUAL TO SPACES
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'NOMBRE' TO WS-ERROR-TIPO
MOVE NOV-CLI-NOMBRE TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
IF NOV-CLI-SEXO IS EQUAL TO 'F' OR 'M' OR 'O'
CONTINUE
ELSE
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'SEXO' TO WS-ERROR-TIPO
MOVE NOV-CLI-SEXO TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
MOVE NOV-CLI-FENAC(1:4) TO WS-ANIO.
MOVE NOV-CLI-FENAC(5:2) TO WS-MES.
MOVE NOV-CLI-FENAC(7:2) TO WS-DIA.
PERFORM 3100-VALIDAR-FECHA
THRU 3100-F-VALIDAR-FECHA.
IF WS-FECHA-NOT-VALIDA THEN
IF WS-NO-ERROR
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
END-IF
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE 'FECHA DE NACIMIENTO' TO WS-ERROR-TIPO
MOVE NOV-CLI-FENAC TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
3000-F-VALIDACION-AL. EXIT.
3010-VALIDACION-CN.
IF NOV-CLI-NOMBRE IS EQUAL TO SPACES
SET WS-ERROR TO TRUE
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
INITIALIZE WS-REG-ERROR
MOVE 'NOMBRE' TO WS-ERROR-TIPO
MOVE NOV-CLI-NOMBRE TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
3010-F-VALIDACION-CN. EXIT.
3020-VALIDACION-CL.
IF NOV-CLI-NRO IS NOT NUMERIC OR
NOV-CLI-NRO < 1
SET WS-ERROR TO TRUE
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
INITIALIZE WS-REG-ERROR
MOVE 'NUMERO DE CLIENTE' TO WS-ERROR-TIPO
MOVE NOV-CLI-NRO TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
3020-F-VALIDACION-CL. EXIT.
3030-VALIDACION-CX.
IF NOV-CLI-SEXO IS EQUAL TO 'F' OR 'M' OR 'O'
CONTINUE
ELSE
SET WS-ERROR TO TRUE
PERFORM 5000-IMPRIMIR-REGISTRO
THRU 5000-F-IMPRIMIR-REGISTRO
INITIALIZE WS-REG-ERROR
MOVE 'SEXO' TO WS-ERROR-TIPO
MOVE NOV-CLI-SEXO TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
END-IF.
3030-F-VALIDACION-CX. EXIT.
***** VALIDACION DE FECHA ************
3100-VALIDAR-FECHA.
**************************************
SET WS-FECHA-VALIDA TO TRUE.
IF WS-ANIO IS NOT NUMERIC OR
WS-MES IS NOT NUMERIC OR
WS-DIA IS NOT NUMERIC
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF.
IF WS-FECHA-VALIDA
IF WS-ANIO < 1922 OR WS-ANIO > 2003
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF
IF WS-MES < 00 OR WS-MES > 13
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF
IF WS-MES = 02
IF WS-DIA > 28
IF WS-DIA > 29
SET WS-FECHA-NOT-VALIDA TO TRUE
ELSE
DIVIDE WS-ANIO BY 004 GIVING WS-RESULTADO
REMAINDER WS-RESTO-4
DIVIDE WS-ANIO BY 100 GIVING WS-RESULTADO
REMAINDER WS-RESTO-100
DIVIDE WS-ANIO BY 400 GIVING WS-RESULTADO
REMAINDER WS-RESTO-400
IF NOT ((WS-RESTO-4 EQUAL 0 AND
WS-RESTO-100 NOT EQUAL 0) OR
WS-RESTO-400 EQUAL 0)
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF
END-IF
END-IF
IF WS-MES IS EQUAL TO (4 OR 6 OR 9 OR 11) AND
WS-DIA > 30
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF
IF WS-MES IS EQUAL TO
(1 OR 3 OR 5 OR 7 OR 8 OR 10 OR 12) AND
WS-DIA > 31
SET WS-FECHA-NOT-VALIDA TO TRUE
END-IF
END-IF.
3100-F-VALIDAR-FECHA. EXIT.
4000-INSERT-AL.
MOVE NOV-TIP-DOC TO DB-CL-TIPDOC
MOVE NOV-NRO-DOC TO DB-CL-NRODOC
MOVE NOV-CLI-NRO TO DB-CL-NROCLI
MOVE NOV-CLI-NOMBRE TO DB-CL-NOMAPE
MOVE WS-FECHA-ACTUAL TO DB-CL-FECNAC
MOVE NOV-CLI-SEXO TO DB-CL-SEXO
EXEC SQL
INSERT INTO ITPLZRY.TB99CLIE (TIPDOC,
NRODOC,
NROCLI,
NOMAPE,
FECNAC,
SEXO)
VALUES (:DB-CL-TIPDOC,
:DB-CL-NRODOC,
:DB-CL-NROCLI,
:DB-CL-NOMAPE,
:DB-CL-FECNAC,
:DB-CL-SEXO)
END-EXEC.
EVALUATE SQLCODE
WHEN ZEROS
ADD 1 TO WS-TOT-ALTAS
WHEN -803
ADD 1 TO WS-TOT-ERR
SET WS-ERROR TO TRUE
INITIALIZE WS-REG-ERROR
MOVE '***CLIENTE DUPLICADO' TO WS-ERROR-TIPO
MOVE NOV-CLI-NRO TO WS-ERROR-CAMPO
PERFORM 5100-IMPRIMIR-ERROR THRU 5100-F-IMPRIMIR-ERROR
WHEN OTHER
MOVE SQLCODE TO WS-SQLCODE
DISPLAY 'ERROR INSERT SQL : ' WS-SQLCODE
SET WS-FIN-LECTURA TO TRUE
END-EVALUATE.
4000-F-INSERT-AL. EXIT.
4010-UPDATE-CN.
MOVE NOV-CLI-NOMBRE TO DB-CL-NOMAPE
MOVE NOV-TIP-DOC TO DB-CL-TIPDOC
MOVE NOV-NRO-DOC TO DB-CL-NRODOC
EXEC SQL
UPDATE ITPLZRY.TB99CLIE
SET NOMAPE = :DB-CL-NOMAPE
WHERE TIPDOC = :DB-CL-TIPDOC
AND NRODOC = :DB-CL-NRODOC
END-EXEC.
IF SQLCODE NOT EQUAL ZEROS
MOVE SQLCODE TO WS-SQLCODE
DISPLAY '* ERROR UPDATE NOMBRE = ' WS-SQLCODE
SET WS-FIN-LECTURA TO TRUE
ELSE
ADD 1 TO WS-TOT-MOD
END-IF.
4010-F-UPDATE-CN. EXIT.
4020-UPDATE-CL.
MOVE NOV-CLI-NRO TO DB-CL-NROCLI
MOVE NOV-TIP-DOC TO DB-CL-TIPDOC
MOVE NOV-NRO-DOC TO DB-CL-NRODOC
EXEC SQL
UPDATE ITPLZRY.TB99CLIE
SET NROCLI = :DB-CL-NROCLI
WHERE TIPDOC = :DB-CL-TIPDOC
AND NRODOC = :DB-CL-NRODOC
END-EXEC.
IF SQLCODE NOT EQUAL ZEROS
MOVE SQLCODE TO WS-SQLCODE
DISPLAY '* ERROR UPDATE NRO CLIENTE = ' WS-SQLCODE
SET WS-FIN-LECTURA TO TRUE
ELSE
ADD 1 TO WS-TOT-MOD
END-IF.
4020-F-UPDATE-CL. EXIT.
4030-UPDATE-CX.
MOVE NOV-CLI-SEXO TO DB-CL-SEXO
MOVE NOV-TIP-DOC TO DB-CL-TIPDOC
MOVE NOV-NRO-DOC TO DB-CL-NRODOC
EXEC SQL
UPDATE ITPLZRY.TB99CLIE
SET SEXO = :DB-CL-SEXO
WHERE TIPDOC = :DB-CL-TIPDOC
AND NRODOC = :DB-CL-NRODOC
END-EXEC.
IF SQLCODE NOT EQUAL ZEROS
MOVE SQLCODE TO WS-SQLCODE
DISPLAY '* ERROR UPDATE SEXO = ' WS-SQLCODE
SET WS-FIN-LECTURA TO TRUE
ELSE
ADD 1 TO WS-TOT-MOD
END-IF.
4030-F-UPDATE-CX. EXIT.
5000-IMPRIMIR-REGISTRO.
IF WS-CUENTA-LINEA GREATER 59
PERFORM 5500-IMPRIMIR-TITULOS THRU
5500-F-IMPRIMIR-TITULOS
END-IF.
INITIALIZE WS-REG-LISTADO.
MOVE NOV-TIP-NOV TO WS-LIS-NOV.
MOVE NOV-TIP-DOC TO WS-LIS-TIP-DOC.
MOVE NOV-NRO-DOC TO WS-LIS-NRO-DOC.
WRITE REG-LISTADO FROM WS-REG-LISTADO AFTER 1.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = ' FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
ADD 1 TO WS-CUENTA-LINEA.
5000-F-IMPRIMIR-REGISTRO. EXIT.
5100-IMPRIMIR-ERROR.
IF WS-CUENTA-LINEA GREATER 59
PERFORM 5500-IMPRIMIR-TITULOS THRU
5500-F-IMPRIMIR-TITULOS
PERFORM 5000-IMPRIMIR-REGISTRO THRU
5000-F-IMPRIMIR-REGISTRO
END-IF.
WRITE REG-LISTADO FROM WS-REG-ERROR AFTER 1.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = ' FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
ADD 1 TO WS-CUENTA-LINEA.
5100-F-IMPRIMIR-ERROR. EXIT.
5300-IMPRIMIR-SEPARADOR.
IF WS-CUENTA-LINEA GREATER 59
PERFORM 5500-IMPRIMIR-TITULOS THRU
5500-F-IMPRIMIR-TITULOS
ELSE
WRITE REG-LISTADO FROM WS-SEPARADOR-REG AFTER 1
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = ' FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF
ADD 1 TO WS-CUENTA-LINEA
END-IF.
5300-F-IMPRIMIR-SEPARADOR. EXIT.
5500-IMPRIMIR-TITULOS.
MOVE WS-CUENTA-PAGINA TO WS-PAGINA.
MOVE 3 TO WS-CUENTA-LINEA.
ADD 1 TO WS-CUENTA-PAGINA.
WRITE REG-LISTADO FROM WS-SEPARADOR AFTER PAGE.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = '
FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
WRITE REG-LISTADO FROM WS-REG-TITULO AFTER 1.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = '
FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
WRITE REG-LISTADO FROM WS-SEPARADOR AFTER 1.
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN WRITE LISTADO = '
FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
5500-F-IMPRIMIR-TITULOS. EXIT.
9999-I-FINAL.
MOVE WS-TOT-LEI TO WS-PRINT
DISPLAY "TOTAL NOVEDADES LEIDAS = " WS-PRINT
MOVE WS-TOT-ERR TO WS-PRINT
DISPLAY "TOTAL NOVEDADES CON ERROR = " WS-PRINT
MOVE WS-TOT-ALTAS TO WS-PRINT
DISPLAY "TOTAL ALTA NOVEDADES = " WS-PRINT
MOVE WS-TOT-MOD TO WS-PRINT
DISPLAY "TOTAL MODIFICACION NOVEDADES = " WS-PRINT
CLOSE ENTRADA
IF FS-ENT IS NOT EQUAL '00'
DISPLAY '* ERROR EN CLOSE ENTRADA = '
FS-ENT
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
CLOSE LISTADO
IF FS-LIS IS NOT EQUAL '00'
DISPLAY '* ERROR EN CLOSE LISTADO = '
FS-LIS
MOVE 9999 TO RETURN-CODE
SET WS-FIN-LECTURA TO TRUE
END-IF.
* EXEC SQL
* ROLLBACK
* END-EXEC.
9999-F-FINAL. EXIT.
*