| 1 | 000100******************************************************************00010000 |
| 2 | 000200* CardDemo - Common Procedures for Db2 00020000 |
| 3 | 000300******************************************************************00030000 |
| 4 | 000400* Copyright Amazon.com, Inc. or its affiliates. 00040000 |
| 5 | 000500* All Rights Reserved. 00050000 |
| 6 | 000600* 00060000 |
| 7 | 000700* Licensed under the Apache License, Version 2.0 (the "License"). 00070000 |
| 8 | 000800* You may not use this file except in compliance with the License.00080000 |
| 9 | 000900* You may obtain a copy of the License at 00090000 |
| 10 | 001000* 00100000 |
| 11 | 001100* http://www.apache.org/licenses/LICENSE-2.0 00110000 |
| 12 | 001200* 00120000 |
| 13 | 001300* Unless required by applicable law or agreed to in writing, 00130000 |
| 14 | 001400* software distributed under the License is distributed on an 00140000 |
| 15 | 001500* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00150000 |
| 16 | 001600* either express or implied. See the License for the specific 00160000 |
| 17 | 001700* language governing permissions and limitations under the License00170000 |
| 18 | 176800***************************************************************** 17680000 |
| 19 | 176900* Dummy call to verify connectivity to Db2 * 17690000 |
| 20 | 177000***************************************************************** 17700000 |
| 21 | 177100 9998-PRIMING-QUERY. 17710000 |
| 22 | 177200 17720000 |
| 23 | 177300 EXEC SQL 17730000 |
| 24 | 177500 SELECT 1 17750000 |
| 25 | 177600 INTO :WS-DUMMY-DB2-INT 17760000 |
| 26 | 177700 FROM SYSIBM.SYSDUMMY1 17770000 |
| 27 | 177900 FETCH FIRST 1 ROW ONLY 17790000 |
| 28 | 178000 END-EXEC 17800000 |
| 29 | 178100 17810000 |
| 30 | 178200 17820000 |
| 31 | 178300 MOVE SQLCODE TO WS-DISP-SQLCODE 17830000 |
| 32 | 178400 17840000 |
| 33 | 178500 EVALUATE TRUE 17850000 |
| 34 | 178600 WHEN SQLCODE = ZERO 17860000 |
| 35 | 178700 CONTINUE 17870000 |
| 36 | 178800 WHEN OTHER 17880000 |
| 37 | 178900* This is some kind of error. Format message and exit 17890000 |
| 38 | 179000 SET WS-DB2-ERROR TO TRUE 17900000 |
| 39 | 179100 17910000 |
| 40 | 179200 MOVE 'Db2 access failure. ' 17920000 |
| 41 | 179300 TO WS-DB2-CURRENT-ACTION 17930000 |
| 42 | 179400 PERFORM 9999-FORMAT-DB2-MESSAGE 17940000 |
| 43 | 179500 THRU 9999-FORMAT-DB2-MESSAGE-EXIT 17950000 |
| 44 | 179600 END-EVALUATE 17960000 |
| 45 | 179700 . 17970000 |
| 46 | 179800 9998-PRIMING-QUERY-EXIT. 17980000 |
| 47 | 179900 EXIT 17990000 |
| 48 | 180000 . 18000000 |
| 49 | 205300***************************************************************** 20530000 |
| 50 | 205400* Construct formatted message using DSNTIAC utility * 20540000 |
| 51 | 205500* This is for Db2 * 20550000 |
| 52 | 205600***************************************************************** 20560000 |
| 53 | 205700 9999-FORMAT-DB2-MESSAGE. 20570000 |
| 54 | 205800 |
| 55 | MOVE +72 TO WS-DSNTIAC-LRECL 20580000 |
| 56 | 205900 |
| 57 | CALL LIT-DSNTIAC USING DFHEIBLK, 20590000 |
| 58 | 206000 DFHCOMMAREA, 20600000 |
| 59 | 206100 SQLCA, 20610000 |
| 60 | 206200 WS-DSNTIAC-FORMATTED, 20620000 |
| 61 | 206300 WS-DSNTIAC-LRECL |
| 62 | 06400 END-CALL 20640000 |
| 63 | 206401 20640100 |
| 64 | 206402 COMPUTE WS-DSNTIAC-ERR-CD = RETURN-CODE |
| 65 | |
| 66 | 206403 20640301 |
| 67 | 206410 IF WS-DSNTIAC-ERR-CD = ZEROES 20641000 |
| 68 | 206420 CONTINUE 20642002 |
| 69 | 206430 ELSE 20643000 |
| 70 | 206431 MOVE 'DSNTIAC CD: ' TO WS-DSNTIAC-ERR-MSG 20643102 |
| 71 | 206432 MOVE WS-DSNTIAC-ERROR TO WS-DSNTIAC-FMTD-TEXT 20643202 |
| 72 | 206450 END-IF 20645000 |
| 73 | 206500 20650000 |
| 74 | 206600 STRING 20660000 |
| 75 | 206700 FUNCTION TRIM(WS-DB2-CURRENT-ACTION) 20670000 |
| 76 | 206800 ' SQLCODE:' 20680000 |
| 77 | 206900 WS-DISP-SQLCODE 20690000 |
| 78 | 207000 ' ' 20700000 |
| 79 | 207100* SQLERRM OF SQLCA 20710000 |
| 80 | 207200 WS-DSNTIAC-FMTD-TEXT 20720002 |
| 81 | 207300 DELIMITED BY SIZE 20730000 |
| 82 | 207400 INTO WS-LONG-MSG 20740000 |
| 83 | 207500 END-STRING 20750000 |
| 84 | 207600 MOVE WS-LONG-MSG TO WS-RETURN-MSG 20760000 |
| 85 | 207700 . 20770000 |
| 86 | 207800 20780000 |
| 87 | 207900 9999-FORMAT-DB2-MESSAGE-EXIT. 20790000 |
| 88 | 208000 EXIT 20800000 |
| 89 | 208100 . 20810000 |