-
Notifications
You must be signed in to change notification settings - Fork 0
/
AZ08PGMD.txt
616 lines (522 loc) · 20.9 KB
/
AZ08PGMD.txt
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
*----------------------------------------------------------------*
IDENTIFICATION DIVISION.
*----------------------------------------------------------------*
PROGRAM-ID. AZ08PGMD.
*----------------------------------------------------------------*
ENVIRONMENT DIVISION.
*----------------------------------------------------------------*
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
*----------------------------------------------------------------*
DATA DIVISION.
*----------------------------------------------------------------*
WORKING-STORAGE SECTION.
*----------------------------------------------------------------*
*
* COPY DA AREA DFHBMSCA - MNEMONICO DOS ATRIBUTOS
*
COPY DFHBMSCA.
*
* COPY DA AREA DFHAID - MNEMONICO DAS TECLAS PRESSIONADAS
*
COPY DFHAID.
*
* COPY DO MAPA SIMBOLICO (MAPLIB) - AZ08CAD
*
COPY AZ08CAD.
*
* COPY BOOK VCADPRD
*
COPY VCADPRD REPLACING ==:XX-:== BY ==WS-==.
77 WS-MSG-ERRO PIC X(80).
77 WS-LENGTH PIC S9(04) COMP.
01 WS-DFHCOMMAREA.
05 WS-FASE PIC X(01).
05 WS-BKP-VCADPRD PIC X(69).
01 WS-VAR-TEMPO.
05 WS-DATA PIC X(10).
05 WS-HORARIO PIC X(08).
*----------------------------------------------------------------*
LINKAGE SECTION.
*----------------------------------------------------------------*
01 DFHCOMMAREA.
05 OCCURS 0 TO 24576 TIMES DEPENDING ON EIBCALEN
PIC X(01).
*----------------------------------------------------------------*
PROCEDURE DIVISION.
*----------------------------------------------------------------*
EXEC CICS HANDLE CONDITION
MAPFAIL(999-MAPFAIL)
NOTFND(250-NOTFND)
ERROR(999-ERROR)
END-EXEC
******************************************************************
*
* SELETOR DE FASE - A ALTERACAO POSSUI CINCO FASES
*
* FASE 1 - ENVIA O MAPA PARA O TERMINAL
* FASE 2 - TRATA O CAMPO T2COD
* FASE 3 - TRATA OS DEMAIS CAMPOS DE DADOS
* FASE 4 - TRATA O CAMPO T2CONF 'CONFIRMA ALTERACAO'
* FASE 5 - TRATA O CAMPO T2CONF 'ALTERAR OUTRO (S/N)'
*
******************************************************************
MOVE DFHCOMMAREA TO WS-DFHCOMMAREA
IF EIBCALEN = 0
MOVE 'ACESSO INVALIDO - USE A OPCAO D DO TRANSACAO Z08M'
TO WS-MSG-ERRO
PERFORM 999-ENCERRA-TRANSACAO
END-IF
EVALUATE WS-FASE
WHEN '1' PERFORM 100-FASE1
WHEN '2' PERFORM 200-FASE2
WHEN '3' PERFORM 300-FASE3
WHEN '4' PERFORM 400-FASE4
WHEN '5' PERFORM 500-FASE5
WHEN OTHER
MOVE 'ERRO NO NUMERO DA FASE - CONSULTA-VSAM'
TO WS-MSG-ERRO
PERFORM 999-ENCERRA-TRANSACAO
END-EVALUATE
.
100-FASE1.
* 1 - LIMPAR AS VARIAVEIS DO MAPA
MOVE LOW-VALUES TO MAPACADO
* 2 - POSICIONAR O CURSOR NO CAMPO T2COD
MOVE -1 TO T2CODL
* 3 - MOVER UMA MENSAGEM PARA O USUARIO T2MSG
MOVE 'ENTRE O CODIGO DO PRODUTO PARA ALTERAR'
TO T2MSGO
* 4 - DESPROTEGER O CAMPO T2COD E PROTEGER OS DEMAIS
PERFORM 999-PROTECAO-FASE2
* 5 - CARREGAR AS DEMAIS VARIAVEIS DO MAPA E ENVIA-LA AO TERMINAL
PERFORM 999-MANDA-TELA
* 6 - ENCERRAR A TRANSACAO E CHAMAR A FASE 2
PERFORM 999-CHAMA-FASE2
.
200-FASE2.
EXEC CICS HANDLE AID
ENTER (210-ENTER)
PF3 (220-PF3)
PF5 (230-PF5)
CLEAR (230-PF5)
ANYKEY(240-ANYKEY)
END-EXEC
EXEC CICS RECEIVE
MAP('MAPACAD')
MAPSET('AZ08CAD')
INTO(MAPACADI)
END-EXEC
.
210-ENTER.
IF T2CODL = 0 OR T2CODI = SPACE
MOVE 'POR FAVOR INFORME UM CODIGO PARA ALTERAR'
TO T2MSGO
PERFORM 999-TRATA-FASE2
END-IF
EXEC CICS READ
FILE('VCADPRD')
RIDFLD(T2CODI)
INTO(WS-REG-VCADPRD)
END-EXEC
* SALVAR UMA IMAGEM DO REGISTRO DO VCADPRD
MOVE WS-REG-VCADPRD TO WS-BKP-VCADPRD
* MOVE DAS VARIAVEIS ESPELHO PARA AS VARIAVEIS DA TELA
MOVE WS-CODPROD TO T2CODO
MOVE WS-DESCPROD TO T2DESCO
MOVE WS-UNIDPROD TO T2UNIDO
MOVE WS-LOCALPROD TO T2LOCALO
MOVE WS-QTDEST TO T2ESTO
MOVE WS-QTDMAX TO T2MAXO
MOVE WS-QTDMIN TO T2MINO
MOVE WS-PRECOCOMPRA TO T2COMPO
MOVE WS-PRECOVENDA TO T2VENDO
MOVE WS-PERCOMIS TO T2COMISO
MOVE 'ALTERE OS DADOS DO PRODUTO'
TO T2MSGO
PERFORM 999-TRATA-FASE3
.
220-PF3.
MOVE '1' TO WS-FASE
EXEC CICS XCTL
PROGRAM('AZ08PGMM')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
230-PF5.
PERFORM 999-CHAMA-FASE1
.
240-ANYKEY.
MOVE 'TECLA INVALIDA - VERIFIQUE AS TECLAS VALIDAS'
TO T2MSGO
PERFORM 999-TRATA-FASE2
.
250-NOTFND.
STRING 'O PRODUTO ' T2CODI ' NAO LOCALIZADO'
DELIMITED BY SIZE INTO T2MSGO
MOVE LOW-VALUES TO T2CODO
PERFORM 999-TRATA-FASE2
.
300-FASE3.
EXEC CICS HANDLE AID
ENTER (310-ENTER)
PF3 (220-PF3)
PF5 (230-PF5)
CLEAR (230-PF5)
ANYKEY(340-ANYKEY)
END-EXEC
EXEC CICS RECEIVE
MAP('MAPACAD')
MAPSET('AZ08CAD')
INTO(MAPACADI)
END-EXEC
.
310-ENTER.
IF T2DESCL = 0 OR
T2UNIDL = 0 OR
T2LOCALL = 0 OR
T2ESTL = 0 OR
T2MAXL = 0 OR
T2MINL = 0 OR
T2COMPL = 0 OR
T2VENDL = 0 OR
T2COMISL = 0 OR
T2DESCI = SPACES OR
T2UNIDI = SPACES OR
T2LOCALI = SPACES
MOVE 'FAVOR PREENCHER TODOS OS CAMPOS'
TO T2MSGO
PERFORM 999-TRATA-FASE3
END-IF
EXEC CICS BIF DEEDIT FIELD(T2ESTI) END-EXEC
EXEC CICS BIF DEEDIT FIELD(T2MAXI) END-EXEC
EXEC CICS BIF DEEDIT FIELD(T2MINI) END-EXEC
EXEC CICS BIF DEEDIT FIELD(T2COMPI) END-EXEC
EXEC CICS BIF DEEDIT FIELD(T2VENDI) END-EXEC
EXEC CICS BIF DEEDIT FIELD(T2COMISI)END-EXEC
IF T2ESTI IS NOT NUMERIC OR
T2MAXI IS NOT NUMERIC OR
T2MINI IS NOT NUMERIC OR
T2COMPI IS NOT NUMERIC OR
T2VENDI IS NOT NUMERIC OR
T2COMISI IS NOT NUMERIC
MOVE 'VERIFIQUE OS CAMPOS NUMERICOS'
TO T2MSGO
PERFORM 999-TRATA-FASE3
END-IF
IF T2MAXI < T2MINI
MOVE 'A QTDE. MAXIMA DEVE SER >= A QTDE. MINIMA'
TO T2MSGO
PERFORM 999-TRATA-FASE3
END-IF
MOVE 'DIGITE S PARA SIM OU N PARA NAO'
TO T2MSGO
MOVE 'CONFIRMA ALTERACAO(S/N)' TO T2ACAOO
PERFORM 999-TRATA-FASE4
.
340-ANYKEY.
MOVE 'TECLA INVALIDA - VERIFIQUE AS TECLAS VALIDAS'
TO T2MSGO
PERFORM 999-TRATA-FASE3
.
400-FASE4.
EXEC CICS HANDLE AID
ENTER (410-ENTER)
PF3 (220-PF3)
PF5 (230-PF5)
CLEAR (230-PF5)
ANYKEY(440-ANYKEY)
END-EXEC
EXEC CICS RECEIVE
MAP('MAPACAD')
MAPSET('AZ08CAD')
INTO(MAPACADI)
END-EXEC
.
410-ENTER.
IF T2CONFL = 0 OR
T2CONFI = SPACES OR
T2CONFI NOT = 'S' AND
T2CONFI NOT = 'N'
MOVE 'DIGITE S=SIM OU N=NAO' TO T2MSGO
PERFORM 999-TRATA-FASE4
END-IF
IF T2CONFI = 'S'
EXEC CICS READ
FILE('VCADPRD')
RIDFLD(T2CODI)
INTO(WS-REG-VCADPRD)
UPDATE
END-EXEC
* VERIFICANDO A IMAGEM DO REGISTRO LIDO COM O DO BKP
IF WS-REG-VCADPRD NOT EQUAL WS-BKP-VCADPRD
STRING 'O PRODUTO ' T2CODI
' FOI ALTERADO POR OUTRO USUARIO'
DELIMITED BY SIZE INTO T2MSGO
MOVE 'ALTERAR OUTRO (S/N)'
TO T2ACAOO
PERFORM 999-TRATA-FASE5
END-IF
* MOVER AS VARIAVEIS DA TELA PARA A VARIAVEL ESPELHO
MOVE T2CODI TO WS-CODPROD
MOVE T2DESCI TO WS-DESCPROD
MOVE T2UNIDI TO WS-UNIDPROD
MOVE T2LOCALI TO WS-LOCALPROD
MOVE T2ESTI TO WS-QTDEST
MOVE T2MAXI TO WS-QTDMAX
MOVE T2MINI TO WS-QTDMIN
MOVE T2COMPI TO WS-PRECOCOMPRA
MOVE T2VENDI TO WS-PRECOVENDA
MOVE T2COMISI TO WS-PERCOMIS
EXEC CICS REWRITE
FILE('VCADPRD')
FROM(WS-REG-VCADPRD)
END-EXEC
STRING 'O PRODUTO ' T2CODI
' FOI ALTERADO COM SUCESSO'
DELIMITED BY SIZE INTO T2MSGO
MOVE 'ALTERAR OUTRO (S/N)' TO T2ACAOO
PERFORM 999-TRATA-FASE5
END-IF
PERFORM 220-PF3
.
440-ANYKEY.
MOVE 'TECLA INVALIDA - VERIFIQUE AS TECLAS VALIDAS'
TO T2MSGO
PERFORM 999-TRATA-FASE4
.
500-FASE5.
EXEC CICS HANDLE AID
ENTER (510-ENTER)
PF3 (220-PF3)
PF5 (230-PF5)
CLEAR (230-PF5)
ANYKEY(540-ANYKEY)
END-EXEC
EXEC CICS RECEIVE
MAP('MAPACAD')
MAPSET('AZ08CAD')
INTO(MAPACADI)
END-EXEC
.
510-ENTER.
IF T2CONFL = 0 OR
T2CONFI = SPACES OR
T2CONFI NOT = 'S' AND
T2CONFI NOT = 'N'
MOVE 'DIGITE S=SIM OU N=NAO' TO T2MSGO
PERFORM 999-TRATA-FASE4
END-IF
IF T2CONFI = 'S'
PERFORM 999-CHAMA-FASE1
END-IF
PERFORM 220-PF3
.
540-ANYKEY.
MOVE 'TECLA INVALIDA - VERIFIQUE AS TECLAS VALIDAS'
TO T2MSGO
PERFORM 999-TRATA-FASE5
.
999-CHAMA-FASE1.
MOVE '1' TO WS-FASE
EXEC CICS XCTL
PROGRAM('AZ08PGMD')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
999-CHAMA-FASE2.
MOVE '2' TO WS-FASE
EXEC CICS RETURN
TRANSID('Z08D')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
999-CHAMA-FASE3.
MOVE '3' TO WS-FASE
EXEC CICS RETURN
TRANSID('Z08D')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
999-CHAMA-FASE4.
MOVE '4' TO WS-FASE
EXEC CICS RETURN
TRANSID('Z08D')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
999-CHAMA-FASE5.
MOVE '5' TO WS-FASE
EXEC CICS RETURN
TRANSID('Z08D')
COMMAREA(WS-DFHCOMMAREA)
LENGTH(LENGTH OF WS-DFHCOMMAREA)
END-EXEC
.
999-TRATA-FASE2.
MOVE -1 TO T2CODL
PERFORM 999-PROTECAO-FASE2
PERFORM 999-MANDA-TELA
PERFORM 999-CHAMA-FASE2
.
999-TRATA-FASE3.
MOVE -1 TO T2DESCL
PERFORM 999-PROTECAO-FASE3
PERFORM 999-MANDA-TELA
PERFORM 999-CHAMA-FASE3
.
999-TRATA-FASE4.
MOVE -1 TO T2CONFL
MOVE LOW-VALUES TO T2CONFO
PERFORM 999-PROTECAO-FASE4
PERFORM 999-MANDA-TELA
PERFORM 999-CHAMA-FASE4
.
999-TRATA-FASE5.
MOVE -1 TO T2CONFL
MOVE LOW-VALUES TO T2CONFO
PERFORM 999-PROTECAO-FASE4
PERFORM 999-MANDA-TELA
PERFORM 999-CHAMA-FASE5
.
999-MANDA-TELA.
MOVE EIBTRMID TO T2TERMO
MOVE EIBTRNID TO T2TRANO
MOVE EIBTASKN TO T2TASKO
MOVE WS-FASE TO T2FASEO
MOVE 'ALTERACAO VSAM-KSDS' TO T2TELAO
EXEC CICS ASSIGN
USERID(T2USRO)
END-EXEC
MOVE +18 TO WS-LENGTH
EXEC CICS LINK
PROGRAM('AUXCICS1')
COMMAREA(WS-VAR-TEMPO)
LENGTH(WS-LENGTH)
END-EXEC
MOVE WS-DATA TO T2DATAO
MOVE WS-HORARIO TO T2HORAO
EXEC CICS SEND
MAP('MAPACAD')
MAPSET('AZ08CAD')
FROM(MAPACADO)
ERASE FREEKB ALARM CURSOR
END-EXEC
.
999-ENCERRA-TRANSACAO.
MOVE +80 TO WS-LENGTH
EXEC CICS SEND TEXT
FROM (WS-MSG-ERRO)
LENGTH(WS-LENGTH)
ERASE FREEKB ALARM
END-EXEC
EXEC CICS RETURN
END-EXEC
.
999-MAPFAIL.
MOVE 'ERRO NO MAPA AZ08CAD' TO WS-MSG-ERRO
PERFORM 999-ENCERRA-TRANSACAO
.
999-ERROR.
MOVE 'ERRO NAO PREVISTO' TO WS-MSG-ERRO
PERFORM 999-ENCERRA-TRANSACAO
.
999-PROTECAO-FASE2.
* USAR OS SEGUINTES MNEMONICOS DA DFHBMSCA:
*
* DFHBMPRF - (PROT , ALFA, NORM, ON) - PARA PROTEGER
* DFHUNIMD - (UMPROT, ALFA, BRT , ON) - PARA DESPROTEGER ALFA
* DFHUNINT - (UMPROT, NUM , BRT , ON) - PARA DESPROTEGER NUM
MOVE DFHUNINT TO T2CODA
MOVE DFHBMPRF TO T2DESCA
MOVE DFHBMPRF TO T2UNIDA
MOVE DFHBMPRF TO T2LOCALA
MOVE DFHBMPRF TO T2ESTA
MOVE DFHBMPRF TO T2MAXA
MOVE DFHBMPRF TO T2MINA
MOVE DFHBMPRF TO T2COMPA
MOVE DFHBMPRF TO T2VENDA
MOVE DFHBMPRF TO T2COMISA
MOVE DFHBMPRF TO T2ACAOA
MOVE DFHBMPRF TO T2CONFA
* SUBLINHADO
MOVE DFHUNDLN TO T2CODH
MOVE DFHALL TO T2DESCH
MOVE DFHALL TO T2UNIDH
MOVE DFHALL TO T2LOCALH
MOVE DFHALL TO T2ESTH
MOVE DFHALL TO T2MAXH
MOVE DFHALL TO T2MINH
MOVE DFHALL TO T2COMPH
MOVE DFHALL TO T2VENDH
MOVE DFHALL TO T2COMISH
MOVE DFHALL TO T2ACAOH
.
999-PROTECAO-FASE3.
* USAR OS SEGUINTES MNEMONICOS DA DFHBMSCA:
*
* DFHBMPRF - (PROT , ALFA, NORM, ON) - PARA PROTEGER
* DFHUNIMD - (UMPROT, ALFA, BRT , ON) - PARA DESPROTEGER ALFA
* DFHUNINT - (UMPROT, NUM , BRT , ON) - PARA DESPROTEGER NUM
MOVE DFHBMPRF TO T2CODA
MOVE DFHUNIMD TO T2DESCA
MOVE DFHUNIMD TO T2UNIDA
MOVE DFHUNIMD TO T2LOCALA
MOVE DFHUNINT TO T2ESTA
MOVE DFHUNINT TO T2MAXA
MOVE DFHUNINT TO T2MINA
MOVE DFHUNINT TO T2COMPA
MOVE DFHUNINT TO T2VENDA
MOVE DFHUNINT TO T2COMISA
MOVE DFHBMPRF TO T2ACAOA
MOVE DFHBMPRF TO T2CONFA
* SUBLINHADO
MOVE DFHALL TO T2CODH
MOVE DFHUNDLN TO T2DESCH
MOVE DFHUNDLN TO T2UNIDH
MOVE DFHUNDLN TO T2LOCALH
MOVE DFHUNDLN TO T2ESTH
MOVE DFHUNDLN TO T2MAXH
MOVE DFHUNDLN TO T2MINH
MOVE DFHUNDLN TO T2COMPH
MOVE DFHUNDLN TO T2VENDH
MOVE DFHUNDLN TO T2COMISH
MOVE DFHALL TO T2CONFH
.
999-PROTECAO-FASE4.
* USAR OS SEGUINTES MNEMONICOS DA DFHBMSCA:
*
* DFHBMPRF - (PROT , ALFA, NORM, ON) - PARA PROTEGER
* DFHUNIMD - (UMPROT, ALFA, BRT , ON) - PARA DESPROTEGER ALFA
* DFHUNINT - (UMPROT, NUM , BRT , ON) - PARA DESPROTEGER NUM
MOVE DFHBMPRF TO T2CODA
MOVE DFHBMPRF TO T2DESCA
MOVE DFHBMPRF TO T2UNIDA
MOVE DFHBMPRF TO T2LOCALA
MOVE DFHBMPRF TO T2ESTA
MOVE DFHBMPRF TO T2MAXA
MOVE DFHBMPRF TO T2MINA
MOVE DFHBMPRF TO T2COMPA
MOVE DFHBMPRF TO T2VENDA
MOVE DFHBMPRF TO T2COMISA
MOVE DFHBMPRF TO T2ACAOA
MOVE DFHUNIMD TO T2CONFA
* SUBLINHADO
MOVE DFHALL TO T2CODH
MOVE DFHALL TO T2DESCH
MOVE DFHALL TO T2UNIDH
MOVE DFHALL TO T2LOCALH
MOVE DFHALL TO T2ESTH
MOVE DFHALL TO T2MAXH
MOVE DFHALL TO T2MINH
MOVE DFHALL TO T2COMPH
MOVE DFHALL TO T2VENDH
MOVE DFHALL TO T2COMISH
MOVE DFHUNDLN TO T2CONFH
.