forked from cicsdev/cics-banking-sample-application-cbsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBNK1CRA.cbl
1168 lines (966 loc) · 36.8 KB
/
BNK1CRA.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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
PROCESS CICS,NODYNAM,NSYMBOL(NATIONAL),TRUNC(STD)
CBL CICS('SP,EDF')
******************************************************************
* *
* Copyright IBM Corp. 2023 *
* *
******************************************************************
******************************************************************
* This is the Credit/Debit program in the BANKING application
* BMS suite.
*
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. BNK1CRA.
AUTHOR. Jon Collett.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
*SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
INPUT-OUTPUT SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-CICS-WORK-AREA.
03 WS-CICS-RESP PIC S9(8) COMP
VALUE 0.
03 WS-CICS-RESP2 PIC S9(8) COMP
VALUE 0.
01 WS-FAIL-INFO.
03 FILLER PIC X(9) VALUE 'BNK1CRA '.
03 WS-CICS-FAIL-MSG PIC X(70) VALUE ' '.
03 FILLER PIC X(6) VALUE ' RESP='.
03 WS-CICS-RESP-DISP PIC 9(10) VALUE 0.
03 FILLER PIC X(7) VALUE ' RESP2='.
03 WS-CICS-RESP2-DISP PIC 9(10) VALUE 0.
03 FILLER PIC X(15) VALUE
' ABENDING TASK.'.
01 SWITCHES.
03 VALID-DATA-SW PIC X VALUE 'Y'.
88 VALID-DATA VALUE 'Y'.
01 FLAGS.
03 SEND-FLAG PIC X.
88 SEND-ERASE VALUE '1'.
88 SEND-DATAONLY VALUE '2'.
88 SEND-DATAONLY-ALARM VALUE '3'.
01 ACTION-ALPHA.
03 ACTION-NUM PIC 9.
*
* The end of session message
*
01 END-OF-SESSION-MESSAGE PIC X(13) VALUE
'Session Ended'.
01 RESPONSE-CODE PIC S9(8) COMP.
01 COMMUNICATION-AREA PIC X.
COPY BNK1CDM.
COPY DFHAID.
01 AMTI9 PIC 9(12).
01 WS-AMOUNT-AS-FLOAT COMP-2.
01 WS-NUM-COUNT-TOTAL PIC S9(8) BINARY.
01 WS-NUM-COUNT-POINT PIC S9(8) BINARY.
01 WS-NUM-COUNT-SPACE PIC S9(8) BINARY.
01 WS-AMOUNT-UNSTR PIC X(13).
01 WS-AMOUNT-UNSTR-L PIC S9(8) BINARY.
01 WS-AMOUNT-UNSTR-REVERSE PIC X(13).
01 WS-STUFF1.
03 WS-COMM-ACT-BAL-UNSIGN PIC 9(12).
01 WS-STUFF2 REDEFINES WS-STUFF1.
03 WS-COMM-ACT-BAL-X PIC X(12).
01 WS-STUFF3.
03 WS-COMM-AMT-UNSIGN PIC 9(12).
01 WS-STUFF4 REDEFINES WS-STUFF3.
03 WS-COMM-AMT-X PIC X(12).
01 WS-STUFF5.
03 WS-COMM-AV-BAL-UNSIGN PIC 9(12).
01 WS-STUFF6 REDEFINES WS-STUFF5.
03 WS-COMM-AV-BAL-X PIC X(12).
01 WS-COMM-AREA.
03 WS-COMM-ACCNO PIC X(8).
03 WS-COMM-SIGN PIC X.
03 WS-COMM-AMT PIC 9(12).
01 WS-CONVERSIONA.
03 WS-CONVERT-PIC1 PIC X(13).
03 WS-CONVERT-PIC1SP REDEFINES WS-CONVERT-PIC1.
05 WS-CONVERT-PIC1-1ST PIC X(10).
05 WS-CONVERT-PIC1-POINT PIC X.
05 WS-CONVERT-PIC1-2ND PIC XX.
01 WS-CONVERSIONB.
03 WS-CONVERT-PICX PIC X(13).
03 WS-CONVERT-SPLIT REDEFINES WS-CONVERT-PICX.
05 WS-CONVERT-DEC PIC 9(10).
05 WS-CONVERT-POINT PIC X.
05 WS-CONVERT-REMAIN PIC 99.
01 WS-CONVERTED-VAL1 PIC S9(10)V99 VALUE 0.
01 WS-CONVERTED-VAL2 PIC S9(10)V99 VALUE 0.
01 WS-CONVERTED-VAL3 PIC S9(10)V99 VALUE 0.
01 WS-CONVERTED-VAL4 PIC S9(10)V99 VALUE 0.
01 SUBPGM-PARMS.
03 SUBPGM-ACCNO PIC X(8).
03 SUBPGM-AMT PIC S9(10)V99.
03 SUBPGM-SORTC PIC 9(6).
03 SUBPGM-AV-BAL PIC S9(10)V99.
03 SUBPGM-ACT-BAL PIC S9(10)V99.
03 SUBPGM-ORIGIN.
05 SUBPGM-APPLID PIC X(8).
05 SUBPGM-USERID PIC X(8).
05 SUBPGM-FACILITY-NAME PIC X(8).
05 SUBPGM-NETWRK-ID PIC X(8).
05 SUBPGM-FACILTYPE PIC S9(8) COMP.
05 FILLER PIC X(4) VALUE SPACES.
03 SUBPGM-SUCCESS PIC X.
03 SUBPGM-FAIL-CODE PIC X.
01 COMPANY-NAME-FULL PIC X(32).
01 AVAILABLE-BALANCE-DISPLAY PIC +9(10).99.
01 ACTUAL-BALANCE-DISPLAY PIC +9(10).99.
01 WS-U-TIME PIC S9(15) COMP-3.
01 WS-ORIG-DATE PIC X(10).
01 WS-ORIG-DATE-GRP REDEFINES WS-ORIG-DATE.
03 WS-ORIG-DATE-DD PIC 99.
03 FILLER PIC X.
03 WS-ORIG-DATE-MM PIC 99.
03 FILLER PIC X.
03 WS-ORIG-DATE-YYYY PIC 9999.
01 WS-ORIG-DATE-GRP-X.
03 WS-ORIG-DATE-DD-X PIC XX.
03 FILLER PIC X VALUE '.'.
03 WS-ORIG-DATE-MM-X PIC XX.
03 FILLER PIC X VALUE '.'.
03 WS-ORIG-DATE-YYYY-X PIC X(4).
01 WS-TIME-DATA.
03 WS-TIME-NOW PIC 9(6).
03 WS-TIME-NOW-GRP REDEFINES WS-TIME-NOW.
05 WS-TIME-NOW-GRP-HH PIC 99.
05 WS-TIME-NOW-GRP-MM PIC 99.
05 WS-TIME-NOW-GRP-SS PIC 99.
01 WS-ABEND-PGM PIC X(8) VALUE 'ABNDPROC'.
01 ABNDINFO-REC.
COPY ABNDINFO.
LINKAGE SECTION.
01 DFHCOMMAREA.
03 COMM-ACCNO PIC X(8).
03 COMM-SIGN PIC X.
03 COMM-AMT PIC 9(12).
PROCEDURE DIVISION USING DFHCOMMAREA.
PREMIERE SECTION.
A010.
EVALUATE TRUE
*
* Is it the first time through? If so, send the map
* with erased (empty) data fields.
*
WHEN EIBCALEN = ZERO
MOVE LOW-VALUE TO BNK1CDO
MOVE -1 TO ACCNOL
SET SEND-ERASE TO TRUE
PERFORM SEND-MAP
*
* If a PA key is pressed, just carry on
*
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
*
* When Pf3 is pressed, return to the main menu
*
WHEN EIBAID = DFHPF3
EXEC CICS RETURN
TRANSID('OMEN')
IMMEDIATE
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
*
* If the aid or Pf12 is pressed, then send a termination
* message.
*
WHEN EIBAID = DFHAID OR DFHPF12
PERFORM SEND-TERMINATION-MSG
EXEC CICS
RETURN
END-EXEC
*
* When CLEAR is pressed
*
WHEN EIBAID = DFHCLEAR
EXEC CICS SEND CONTROL
ERASE
FREEKB
END-EXEC
EXEC CICS RETURN
END-EXEC
*
* When enter is pressed then process the content
*
WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP
*
* When anything else happens, send the invalid key message
*
WHEN OTHER
MOVE LOW-VALUES TO BNK1CDO
MOVE 'Invalid key pressed.' TO MESSAGEO
MOVE 8 TO ACCNOL
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP
END-EVALUATE.
*
* Provided that we have been around this way before
* (i.e. it is NOT the first time through, put the data
* returned from the sub program into the area that we use
* as the COMMAREA on the RETURN.
*
IF EIBCALEN NOT = ZERO
MOVE COMM-ACCNO TO WS-COMM-ACCNO
MOVE COMM-SIGN TO WS-COMM-SIGN
MOVE COMM-AMT TO WS-COMM-AMT
END-IF.
EXEC CICS
RETURN TRANSID('OCRA')
COMMAREA(WS-COMM-AREA)
LENGTH(21)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'A010 - RETURN TRANSID(OCRA) FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - A010 - RETURN TRANSID(OCRA) FAIL' TO
WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF.
A999.
EXIT.
PROCESS-MAP SECTION.
PM010.
*
* Retrieve the data from the map
*
PERFORM RECEIVE-MAP.
*
* Validate the received data
*
PERFORM EDIT-DATA.
*
* If the data passes validation go on to apply the debit or
* credit.
*
IF VALID-DATA
PERFORM UPD-CRED-DATA
END-IF.
SET SEND-DATAONLY-ALARM TO TRUE.
*
* Output the data to the screen
*
PERFORM SEND-MAP.
PM999.
EXIT.
RECEIVE-MAP SECTION.
RM010.
*
* Retrieve the data
*
EXEC CICS
RECEIVE MAP('BNK1CD')
MAPSET('BNK1CDM')
INTO(BNK1CDI)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'RM010 - RECEIVE MAP FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNKMENU - RM010 - RECEIVE MAP FAIL ' TO
WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF.
RM999.
EXIT.
EDIT-DATA SECTION.
ED010.
*
* Perform validation on the incoming fields
*
EXEC CICS BIF
DEEDIT FIELD(ACCNOI)
END-EXEC.
IF ACCNOI NOT NUMERIC
MOVE 'Please enter an account number. ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
IF ACCNOI = ZERO
MOVE 'Please enter a non zero account number. ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
IF SIGNI NOT = '+' AND SIGNI NOT = '-' AND SIGNL = 1
MOVE 'Please enter + or - preceding the amount ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
*
* Validate the Amount entered
*
PERFORM VALIDATE-AMOUNT.
ED999.
EXIT.
UPD-CRED-DATA SECTION.
UCD010.
*
* Set up the COMMAREA fields required by DBCRFUN and then
* link to it.
*
INITIALIZE SUBPGM-PARMS.
MOVE ACCNOI TO SUBPGM-ACCNO.
MOVE 0 TO SUBPGM-AMT.
*
* Provide the correct Amount
*
IF SIGNI = '-'
COMPUTE WS-AMOUNT-AS-FLOAT = WS-AMOUNT-AS-FLOAT * -1
END-IF.
MOVE WS-AMOUNT-AS-FLOAT TO SUBPGM-AMT.
*
* Get the ORIGIN data
*
EXEC CICS INQUIRE ASSOCIATION(EIBTASKN)
ODAPPLID(SUBPGM-APPLID)
ODUSERID(SUBPGM-USERID)
ODFACILNAME(SUBPGM-FACILITY-NAME)
ODNETWORKID(SUBPGM-NETWRK-ID)
ODFACILTYPE(SUBPGM-FACILTYPE)
END-EXEC.
EXEC CICS LINK
PROGRAM('DBCRFUN')
COMMAREA(SUBPGM-PARMS)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
SYNCONRETURN
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'UCD010 - LINK DBCRFUN FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - UCD010 - LINK DBCRFUN FAIL '
TO WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF.
*
* Check to see if the debit or credit was successful
*
IF SUBPGM-SUCCESS = 'N'
MOVE 'N' TO VALID-DATA-SW
EVALUATE SUBPGM-FAIL-CODE
WHEN '1'
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the ACCOUNT no was not found'
' for SORTCODE '
SUBPGM-SORTC
' . Amount not applied. '
DELIMITED BY SIZE
INTO MESSAGEO
GO TO UCD999
WHEN '2'
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the AMOUNT could not be applied'
' due to an unexpected error.'
DELIMITED BY SIZE
INTO MESSAGEO
GO TO UCD999
WHEN '3'
MOVE SPACES TO MESSAGEO
STRING 'Sorry insufficient funds available to pro'
'cess the request. '
DELIMITED BY SIZE
INTO MESSAGEO
GO TO UCD999
WHEN OTHER
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the AMOUNT could not be applied'
' due to an unexpected error. '
SUBPGM-FAIL-CODE
DELIMITED BY SIZE
INTO MESSAGEO
GO TO UCD999
END-EVALUATE
ELSE
MOVE SPACES TO MESSAGEO
MOVE 'Amount successfully applied to the account.' TO
MESSAGEO
END-IF.
*
* Set up the values on the map
*
MOVE SUBPGM-ACCNO TO ACCNOO.
MOVE SUBPGM-SORTC TO SORTCO.
MOVE SUBPGM-ACT-BAL TO ACTUAL-BALANCE-DISPLAY.
MOVE SUBPGM-AV-BAL TO AVAILABLE-BALANCE-DISPLAY.
MOVE ACTUAL-BALANCE-DISPLAY TO ACTBALO.
MOVE AVAILABLE-BALANCE-DISPLAY TO AVBALO.
UCD999.
EXIT.
SEND-MAP SECTION.
SM010.
*
* If the map needs to have its data erased
*
IF SEND-ERASE
EXEC CICS SEND MAP('BNK1CD')
MAPSET('BNK1CDM')
FROM(BNK1CDO)
ERASE
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'SM010 - SEND MAP ERASE FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - SM010 - SEND MAP ERASE FAIL '
TO WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF
GO TO SM999
END-IF.
*
* If the map just needs a resend of only the data
*
IF SEND-DATAONLY
EXEC CICS SEND MAP('BNK1CD')
MAPSET('BNK1CDM')
FROM(BNK1CDO)
DATAONLY
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'SM010 - SEND MAP DATAONLY FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - SM010 - SEND MAP DATAONLY FAIL '
TO WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF
GO TO SM999
END-IF.
*
* If we have elected to send the map and a beep
*
IF SEND-DATAONLY-ALARM
EXEC CICS SEND MAP('BNK1CD')
MAPSET('BNK1CDM')
FROM(BNK1CDO)
DATAONLY
ALARM
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'SM010 - SEND MAP DATAONLY ALARM FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - SM010 - SEND MAP DATAONLY ALARM FAIL '
TO WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF
END-IF.
SM999.
EXIT.
SEND-TERMINATION-MSG SECTION.
STM010.
*
* Send the termination message
*
EXEC CICS SEND TEXT
FROM(END-OF-SESSION-MESSAGE)
ERASE
FREEKB
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
*
* Get supplemental information
*
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
PERFORM POPULATE-TIME-DATE
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
END-STRING
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'STM010 - SEND TEXT FAIL.'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CRA - STM010 - SEND TEXT FAIL'
TO WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
PERFORM ABEND-THIS-TASK
END-IF.
STM999.
EXIT.
ABEND-THIS-TASK SECTION.
ATT010.
DISPLAY WS-FAIL-INFO.
EXEC CICS ABEND
ABCODE('HBNK')
NODUMP
END-EXEC.
ATT999.
EXIT.
VALIDATE-AMOUNT SECTION.
VA010.
MOVE 0 TO WS-AMOUNT-AS-FLOAT.
IF AMTL = ZERO
MOVE 'The Amount entered must be numeric.' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
MOVE -1 TO AMTL
GO TO VA999
END-IF.
IF AMTI(1:AMTL) IS NUMERIC
COMPUTE WS-AMOUNT-AS-FLOAT =
FUNCTION NUMVAL(AMTI(1:AMTL))
MOVE 'Y' TO VALID-DATA-SW
GO TO VA999
END-IF.
MOVE ZERO TO WS-NUM-COUNT-TOTAL.
INSPECT AMTI(1:AMTL) TALLYING WS-NUM-COUNT-TOTAL
FOR LEADING SPACES.
*
* It is entirely spaces
*
IF WS-NUM-COUNT-TOTAL = AMTL
MOVE 'The Amount entered must be numeric.' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
MOVE -1 TO AMTL
GO TO VA999
END-IF.
COMPUTE WS-AMOUNT-UNSTR-L = AMTL - WS-NUM-COUNT-TOTAL.
IF WS-NUM-COUNT-TOTAL = ZERO
MOVE SPACES TO WS-AMOUNT-UNSTR
UNSTRING AMTI(1:AMTL)