forked from cicsdev/cics-banking-sample-application-cbsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBNK1TFN.cbl
1226 lines (1024 loc) · 39.1 KB
/
BNK1TFN.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 Transfer Funds between accounts program (in the
* same bank) in the BANKING application BMS suite.
*
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. BNK1TFN.
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 'BNK1TFN '.
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 BNK1TFM.
COPY DFHAID.
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-NUM-COUNT-MINUS 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 COMM-DOB-SPLIT.
03 COMM-DOB-SPLIT-DD PIC 99.
03 COMM-DOB-SPLIT-MM PIC 99.
03 COMM-DOB-SPLIT-YYYY PIC 9999.
01 COMM-ADDR-SPLIT.
03 COMM-ADDR-SPLIT1 PIC X(60).
03 COMM-ADDR-SPLIT2 PIC X(60).
03 COMM-ADDR-SPLIT3 PIC X(40).
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-FACCNO PIC 9(8).
03 SUBPGM-FSCODE PIC 9(6).
03 SUBPGM-TACCNO PIC 9(8).
03 SUBPGM-TSCODE PIC 9(6).
03 SUBPGM-AMT PIC S9(10)V99.
03 SUBPGM-FAVBAL PIC S9(10)V99.
03 SUBPGM-FACTBAL PIC S9(10)V99.
03 SUBPGM-TAVBAL PIC S9(10)V99.
03 SUBPGM-TACTBAL PIC S9(10)V99.
03 SUBPGM-FAIL-CODE PIC X.
03 SUBPGM-SUCCESS PIC X.
01 WS-COMMAREA.
03 WS-COMMAREA-FACCNO PIC 9(8).
03 WS-COMMAREA-TACCNO PIC 9(8).
03 WS-COMMAREA-AMT PIC 9(12).
01 COMPANY-NAME-FULL PIC X(32).
01 FROM-AVAILABLE-BALANCE-DISPLAY
PIC +9(10).99.
01 FROM-ACTUAL-BALANCE-DISPLAY PIC +9(10).99.
01 TO-AVAILABLE-BALANCE-DISPLAY PIC +9(10).99.
01 TO-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 COMMAREA-FACCNO PIC 9(8).
03 COMMAREA-TACCNO PIC 9(8).
03 COMMAREA-AMT PIC 9(12).
PROCEDURE DIVISION.
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 BNK1TFO
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 BNK1TFO
MOVE 'Invalid key pressed.' TO MESSAGEO
* MOVE 10 TO CUSTNOL
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP
END-EVALUATE.
*
* Now RETURN
*
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
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(OCCS) 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 'BNK1TFN - A010 - RETURN TRANSID(OCCS) 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
* get an account
*
IF VALID-DATA
PERFORM GET-ACC-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('BNK1TF')
MAPSET('BNK1TFM')
INTO(BNK1TFI)
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 'BNK1TFN - 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(FACCNOI)
END-EXEC.
IF FACCNOI NOT NUMERIC
MOVE 'Please enter a FROM account no ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
EXEC CICS BIF DEEDIT
FIELD(TACCNOI)
END-EXEC.
IF TACCNOI NOT NUMERIC
MOVE 'Please enter a TO account no ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
IF FACCNOI = TACCNOI
MOVE 'The FROM & TO account should be different ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
IF FACCNOI = '00000000' OR TACCNOI = '00000000'
MOVE 'Account no 00000000 is not valid ' TO
MESSAGEO
MOVE 'N' TO VALID-DATA-SW
GO TO ED999
END-IF.
*
* Validate the Amount entered
*
PERFORM VALIDATE-AMOUNT.
ED999.
EXIT.
GET-ACC-DATA SECTION.
GCD010.
*
* Set up the fields required by XFRFUN then link to it to
* get account information and perform the transfer, then
* check what gets returned.
*
INITIALIZE SUBPGM-PARMS.
MOVE FACCNOI TO SUBPGM-FACCNO.
MOVE TACCNOI TO SUBPGM-TACCNO.
MOVE 'N' TO SUBPGM-SUCCESS.
*
* Provide the correct Amount
*
MOVE WS-AMOUNT-AS-FLOAT TO SUBPGM-AMT.
EXEC CICS LINK
PROGRAM('XFRFUN')
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 'GCD010 - LINK XFRFUN 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 'BNK1TFN - GCD010 - LINK XFRFUN 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.
*
* Map the returned data to the screen output fields
*
MOVE SUBPGM-FACCNO TO FACCNO2O
MOVE SUBPGM-FSCODE TO FSORTCO
MOVE SUBPGM-TACCNO TO TACCNO2O
MOVE SUBPGM-TSCODE TO TSORTCO
MOVE ZERO TO FROM-ACTUAL-BALANCE-DISPLAY
MOVE ZERO TO FROM-AVAILABLE-BALANCE-DISPLAY
MOVE ZERO TO TO-ACTUAL-BALANCE-DISPLAY
MOVE ZERO TO TO-AVAILABLE-BALANCE-DISPLAY
MOVE FROM-ACTUAL-BALANCE-DISPLAY TO FACTBALO
MOVE FROM-AVAILABLE-BALANCE-DISPLAY TO FAVBALO
MOVE TO-ACTUAL-BALANCE-DISPLAY TO TACTBALO
MOVE TO-AVAILABLE-BALANCE-DISPLAY TO TAVBALO
*
* If an error was flagged by XFRFUN then set up an appropriate
* error message.
IF SUBPGM-SUCCESS = 'N'
MOVE 'N' TO VALID-DATA-SW
EVALUATE SUBPGM-FAIL-CODE
WHEN '1'
MOVE SPACES TO MESSAGEO
STRING 'Sorry the FROM ACCOUNT no was not found'
'. Transfer not applied. '
DELIMITED BY SIZE
INTO MESSAGEO
GO TO GCD999
WHEN '2'
MOVE SPACES TO MESSAGEO
STRING 'Sorry the TO ACCOUNT no was not found'
'. Transfer not applied. '
DELIMITED BY SIZE
INTO MESSAGEO
GO TO GCD999
WHEN '3'
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the transfer could not be applied'
' due to an unexpected error.'
DELIMITED BY SIZE
INTO MESSAGEO
WHEN '4'
MOVE SPACES TO MESSAGEO
STRING 'Please supply an amount greater than zero.'
DELIMITED BY SIZE
INTO MESSAGEO
GO TO GCD999
WHEN OTHER
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the transfer could not be applied'
' due to an error.'
DELIMITED BY SIZE
INTO MESSAGEO
GO TO GCD999
END-EVALUATE
END-IF.
IF SUBPGM-SUCCESS NOT = 'Y'
MOVE SPACES TO MESSAGEO
STRING 'Sorry but the transfer could not be applied'
' unable to determine success.'
DELIMITED BY SIZE
INTO MESSAGEO
GO TO GCD999
ELSE
MOVE SPACES TO MESSAGEO
MOVE 'Transfer successfully applied. ' TO
MESSAGEO
END-IF.
*
* Map the remaining fields
*
MOVE SUBPGM-FACCNO TO FACCNO2O.
MOVE SUBPGM-FSCODE TO FSORTCO.
MOVE SUBPGM-TACCNO TO TACCNO2O.
MOVE SUBPGM-TSCODE TO TSORTCO.
MOVE SUBPGM-FACTBAL TO FROM-ACTUAL-BALANCE-DISPLAY.
MOVE SUBPGM-FAVBAL TO FROM-AVAILABLE-BALANCE-DISPLAY.
MOVE SUBPGM-TACTBAL TO TO-ACTUAL-BALANCE-DISPLAY.
MOVE SUBPGM-TAVBAL TO TO-AVAILABLE-BALANCE-DISPLAY.
MOVE FROM-ACTUAL-BALANCE-DISPLAY TO FACTBALO.
MOVE FROM-AVAILABLE-BALANCE-DISPLAY TO FAVBALO.
MOVE TO-ACTUAL-BALANCE-DISPLAY TO TACTBALO.
MOVE TO-AVAILABLE-BALANCE-DISPLAY TO TAVBALO.
GCD999.
EXIT.
SEND-MAP SECTION.
SM010.
*
* Send/show the MAP
*
*
* If the map needs to have its data erased
*
IF SEND-ERASE
EXEC CICS SEND MAP('BNK1TF')
MAPSET('BNK1TFM')
FROM(BNK1TFO)
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 'BNK1TFN - 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('BNK1TF')
MAPSET('BNK1TFM')
FROM(BNK1TFO)
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 'BNK1TFN - 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('BNK1TF')
MAPSET('BNK1TFM')
FROM(BNK1TFO)
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 'BNK1TFN - 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 'BNK1TFN - 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.
*
* Issue an abend
*
DISPLAY WS-FAIL-INFO.
EXEC CICS ABEND
ABCODE('HBNK')
NODUMP
END-EXEC.
ATT999.
EXIT.
VALIDATE-AMOUNT SECTION.
VA010.
*
* Validate the amount entered.
* Is it greater than 0?
*
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
*