MFmainframe-rea
WS carddemo · 26f629ef

copybook · 89 lines · sha256 6f7d0bd7de7d860e · guides at columns 7 and 72app/app-transaction-type-db2/cpy/CSDB2RPY.cpy

1000100******************************************************************00010000
2000200* CardDemo - Common Procedures for Db2 00020000
3000300******************************************************************00030000
4000400* Copyright Amazon.com, Inc. or its affiliates. 00040000
5000500* All Rights Reserved. 00050000
6000600* 00060000
7000700* Licensed under the Apache License, Version 2.0 (the "License"). 00070000
8000800* You may not use this file except in compliance with the License.00080000
9000900* You may obtain a copy of the License at 00090000
10001000* 00100000
11001100* http://www.apache.org/licenses/LICENSE-2.0 00110000
12001200* 00120000
13001300* Unless required by applicable law or agreed to in writing, 00130000
14001400* software distributed under the License is distributed on an 00140000
15001500* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00150000
16001600* either express or implied. See the License for the specific 00160000
17001700* language governing permissions and limitations under the License00170000
18176800***************************************************************** 17680000
19176900* Dummy call to verify connectivity to Db2 * 17690000
20177000***************************************************************** 17700000
21177100 9998-PRIMING-QUERY. 17710000
22177200 17720000
23177300 EXEC SQL 17730000
24177500 SELECT 1 17750000
25177600 INTO :WS-DUMMY-DB2-INT 17760000
26177700 FROM SYSIBM.SYSDUMMY1 17770000
27177900 FETCH FIRST 1 ROW ONLY 17790000
28178000 END-EXEC 17800000
29178100 17810000
30178200 17820000
31178300 MOVE SQLCODE TO WS-DISP-SQLCODE 17830000
32178400 17840000
33178500 EVALUATE TRUE 17850000
34178600 WHEN SQLCODE = ZERO 17860000
35178700 CONTINUE 17870000
36178800 WHEN OTHER 17880000
37178900* This is some kind of error. Format message and exit 17890000
38179000 SET WS-DB2-ERROR TO TRUE 17900000
39179100 17910000
40179200 MOVE 'Db2 access failure. ' 17920000
41179300 TO WS-DB2-CURRENT-ACTION 17930000
42179400 PERFORM 9999-FORMAT-DB2-MESSAGE 17940000
43179500 THRU 9999-FORMAT-DB2-MESSAGE-EXIT 17950000
44179600 END-EVALUATE 17960000
45179700 . 17970000
46179800 9998-PRIMING-QUERY-EXIT. 17980000
47179900 EXIT 17990000
48180000 . 18000000
49205300***************************************************************** 20530000
50205400* Construct formatted message using DSNTIAC utility * 20540000
51205500* This is for Db2 * 20550000
52205600***************************************************************** 20560000
53205700 9999-FORMAT-DB2-MESSAGE. 20570000
54205800
55 MOVE +72 TO WS-DSNTIAC-LRECL 20580000
56205900
57 CALL LIT-DSNTIAC USING DFHEIBLK, 20590000
58206000 DFHCOMMAREA, 20600000
59206100 SQLCA, 20610000
60206200 WS-DSNTIAC-FORMATTED, 20620000
61206300 WS-DSNTIAC-LRECL
62 06400 END-CALL 20640000
63206401 20640100
64206402 COMPUTE WS-DSNTIAC-ERR-CD = RETURN-CODE
65
66206403 20640301
67206410 IF WS-DSNTIAC-ERR-CD = ZEROES 20641000
68206420 CONTINUE 20642002
69206430 ELSE 20643000
70206431 MOVE 'DSNTIAC CD: ' TO WS-DSNTIAC-ERR-MSG 20643102
71206432 MOVE WS-DSNTIAC-ERROR TO WS-DSNTIAC-FMTD-TEXT 20643202
72206450 END-IF 20645000
73206500 20650000
74206600 STRING 20660000
75206700 FUNCTION TRIM(WS-DB2-CURRENT-ACTION) 20670000
76206800 ' SQLCODE:' 20680000
77206900 WS-DISP-SQLCODE 20690000
78207000 ' ' 20700000
79207100* SQLERRM OF SQLCA 20710000
80207200 WS-DSNTIAC-FMTD-TEXT 20720002
81207300 DELIMITED BY SIZE 20730000
82207400 INTO WS-LONG-MSG 20740000
83207500 END-STRING 20750000
84207600 MOVE WS-LONG-MSG TO WS-RETURN-MSG 20760000
85207700 . 20770000
86207800 20780000
87207900 9999-FORMAT-DB2-MESSAGE-EXIT. 20790000
88208000 EXIT 20800000
89208100 . 20810000