├── docker-compose.yml ├── cpy └── sqlca.cbl ├── README.md ├── src ├── FETCHTBL.cbl └── INSERTTBL.cbl └── LICENSE /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2019, Tokyo System House Co., Ltd. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | version: '2' 18 | services: 19 | oscobol: 20 | image: opensourcecobol/opensource-cobol 21 | tty: true 22 | environment: 23 | COBCPY: /oscobol/cpy 24 | volumes: 25 | - ./src:/oscobol/src 26 | - ./cpy:/oscobol/cpy 27 | 28 | db: 29 | image: postgres:9.6 30 | environment: 31 | POSTGRES_HOST_AUTH_METHOD: 'trust' 32 | # POSTGRES_PASSWORD: 'postgres' 33 | 34 | networks: 35 | default: 36 | 37 | 38 | -------------------------------------------------------------------------------- /cpy/sqlca.cbl: -------------------------------------------------------------------------------- 1 | ****************************************************************** 2 | * SQLCA: SQL Communications Area for Ocesql * 3 | ****************************************************************** 4 | 01 SQLCA GLOBAL. 5 | 05 SQLCAID PIC X(8). 6 | 05 SQLCABC PIC S9(9) COMP-5. 7 | 05 SQLCODE PIC S9(9) COMP-5. 8 | 05 SQLERRM. 9 | 49 SQLERRML PIC S9(4) COMP-5. 10 | 49 SQLERRMC PIC X(70). 11 | 05 SQLERRP PIC X(8). *> not used 12 | 05 SQLERRD OCCURS 6 TIMES *> used only ERRD(3) 13 | PIC S9(9) COMP-5. 14 | 05 SQLWARN. *> not used 15 | 10 SQLWARN0 PIC X(1). 16 | 10 SQLWARN1 PIC X(1). 17 | 10 SQLWARN2 PIC X(1). 18 | 10 SQLWARN3 PIC X(1). 19 | 10 SQLWARN4 PIC X(1). 20 | 10 SQLWARN5 PIC X(1). 21 | 10 SQLWARN6 PIC X(1). 22 | 10 SQLWARN7 PIC X(1). 23 | 05 SQLSTATE PIC X(5). 24 | ****************************************************************** 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OCCompose 2 | opensource COBOL SMAPLES with Open COBOL ESQL on docker-compose 3 | 4 | # overview 5 | If you have docker compose's environment, you can try this sample right away. 6 | In this sample, you can experience the collaboration between COBOL and PostgreSQL using opensource COBOL and Open COBOL ESQL. 7 | 8 | # Try this 9 | 10 | * Get project from github. 11 | ``` 12 | git clone https://github.com/opensourcecobol/opensource-cobol-devel.git 13 | cd opensource-cobol-devel/ 14 | ``` 15 | 16 | * Run container images. 17 | ``` 18 | docker-compose up -d 19 | ``` 20 | 21 | * Create DB on postgresql server. 22 | ``` 23 | docker-compose exec db createdb -U postgres testdb 24 | ``` 25 | 26 | * Enter the oscobol container, compile and run COBOL Application. 27 | ``` 28 | docker-compose exec oscobol /bin/bash 29 | ``` 30 | ``` 31 | ocesql src/INSERTTBL.cbl INSERTTBL.pre 32 | cobc -locesql INSERTTBL.pre 33 | ocesql src/FETCHTBL.cbl FETCHTBL.pre 34 | cobc -locesql FETCHTBL.pre 35 | ``` 36 | 37 | * Test data is Inserted and fetched. 38 | ``` 39 | [root@e8ccda101772 oscobol]# cobcrun INSERTTBL 40 | *** INSERTTBL STARTED *** 41 | NOTICE: table "emp" does not exist, skipping 42 | *** INSERTTBL FINISHED *** 43 | [root@e8ccda101772 oscobol]# cobcrun FETCHTBL 44 | *** FETCHTBL STARTED *** 45 | TOTAL RECORD: 0012 46 | ---- -------------------- ------ 47 | NO NAME SALARY 48 | ---- -------------------- ------ 49 | 0001 HOKKAI TARO 400 50 | 0002 AOMORI JIRO 350 51 | 0003 AKITA SABURO 300 52 | 0004 IWATE SHIRO -250 53 | 0005 MIYAGI GORO -200 54 | 0006 FUKUSHIMA RIKURO 150 55 | 0007 TOCHIGI SHICHIRO -100 56 | 0008 IBARAKI HACHIRO 50 57 | 0009 GUMMA KURO -200 58 | 0010 SAITAMA JURO 350 59 | 0046 KAGOSHIMA ROKURO -320 60 | 0047 OKINAWA SHICHIRO 480 61 | *** FETCHTBL FINISHED *** 62 | ``` 63 | 64 | Copyright 2019, Tokyo System House Co., Ltd. 65 | -------------------------------------------------------------------------------- /src/FETCHTBL.cbl: -------------------------------------------------------------------------------- 1 | ****************************************************************** 2 | * Open Cobol ESQL (Ocesql) Sample Program 3 | * 4 | * FETCHTBL --- demonstrates CONNECT, SELECT COUNT(*), 5 | * DECLARE cursor, FETCH cursor, COMMIT, 6 | * ROLLBACK, DISCONNECT 7 | * 8 | * Copyright 2013 Tokyo System House Co., Ltd. 9 | ****************************************************************** 10 | IDENTIFICATION DIVISION. 11 | ****************************************************************** 12 | PROGRAM-ID. FETCHTBL. 13 | AUTHOR. TSH. 14 | DATE-WRITTEN. 2013-06-28. 15 | 16 | ****************************************************************** 17 | DATA DIVISION. 18 | ****************************************************************** 19 | WORKING-STORAGE SECTION. 20 | 01 D-EMP-REC. 21 | 05 D-EMP-NO PIC 9(04). 22 | 05 FILLER PIC X. 23 | 05 D-EMP-NAME PIC X(20). 24 | 05 FILLER PIC X. 25 | 05 D-EMP-SALARY PIC --,--9. 26 | 27 | EXEC SQL BEGIN DECLARE SECTION END-EXEC. 28 | 01 DBNAME PIC X(30) VALUE SPACE. 29 | 01 USERNAME PIC X(30) VALUE SPACE. 30 | 01 PASSWD PIC X(10) VALUE SPACE. 31 | 01 EMP-REC-VARS. 32 | 05 EMP-NO PIC S9(04). 33 | 05 EMP-NAME PIC X(20) . 34 | 05 EMP-SALARY PIC S9(04). 35 | 01 EMP-CNT PIC 9(04). 36 | EXEC SQL END DECLARE SECTION END-EXEC. 37 | 38 | EXEC SQL INCLUDE SQLCA END-EXEC. 39 | ****************************************************************** 40 | PROCEDURE DIVISION. 41 | ****************************************************************** 42 | MAIN-RTN. 43 | DISPLAY "*** FETCHTBL STARTED ***". 44 | 45 | * WHENEVER IS NOT YET SUPPORTED :( 46 | * EXEC SQL WHENEVER SQLERROR PERFORM ERROR-RTN END-EXEC. 47 | 48 | * CONNECT 49 | MOVE "testdb@db" TO DBNAME. 50 | MOVE "postgres" TO USERNAME. 51 | MOVE SPACE TO PASSWD. 52 | EXEC SQL 53 | CONNECT :USERNAME IDENTIFIED BY :PASSWD USING :DBNAME 54 | END-EXEC. 55 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN STOP RUN. 56 | 57 | * SELECT COUNT(*) INTO HOST-VARIABLE 58 | EXEC SQL 59 | SELECT COUNT(*) INTO :EMP-CNT FROM EMP 60 | END-EXEC. 61 | DISPLAY "TOTAL RECORD: " EMP-CNT. 62 | 63 | * DECLARE CURSOR 64 | EXEC SQL 65 | DECLARE C1 CURSOR FOR 66 | SELECT EMP_NO, EMP_NAME, EMP_SALARY 67 | FROM EMP 68 | ORDER BY EMP_NO 69 | END-EXEC. 70 | EXEC SQL 71 | OPEN C1 72 | END-EXEC. 73 | 74 | * FETCH 75 | DISPLAY "---- -------------------- ------". 76 | DISPLAY "NO NAME SALARY". 77 | DISPLAY "---- -------------------- ------". 78 | EXEC SQL 79 | FETCH C1 INTO :EMP-NO, :EMP-NAME, :EMP-SALARY 80 | END-EXEC. 81 | PERFORM UNTIL SQLCODE NOT = ZERO 82 | MOVE EMP-NO TO D-EMP-NO 83 | MOVE EMP-NAME TO D-EMP-NAME 84 | MOVE EMP-SALARY TO D-EMP-SALARY 85 | DISPLAY D-EMP-REC 86 | EXEC SQL 87 | FETCH C1 INTO :EMP-NO, :EMP-NAME, :EMP-SALARY 88 | END-EXEC 89 | END-PERFORM. 90 | 91 | * CLOSE CURSOR 92 | EXEC SQL 93 | CLOSE C1 94 | END-EXEC. 95 | 96 | * COMMIT 97 | EXEC SQL 98 | COMMIT WORK 99 | END-EXEC. 100 | 101 | * DISCONNECT 102 | EXEC SQL 103 | DISCONNECT ALL 104 | END-EXEC. 105 | 106 | * END 107 | DISPLAY "*** FETCHTBL FINISHED ***". 108 | STOP RUN. 109 | 110 | ****************************************************************** 111 | ERROR-RTN. 112 | ****************************************************************** 113 | DISPLAY "*** SQL ERROR ***". 114 | DISPLAY "SQLCODE: " SQLCODE " " NO ADVANCING. 115 | EVALUATE SQLCODE 116 | WHEN +10 117 | DISPLAY "Record not found" 118 | WHEN -01 119 | DISPLAY "Connection falied" 120 | WHEN -20 121 | DISPLAY "Internal error" 122 | WHEN -30 123 | DISPLAY "PostgreSQL error" 124 | DISPLAY "ERRCODE: " SQLSTATE 125 | DISPLAY SQLERRMC 126 | *> TO RESTART TRANSACTION, DO ROLLBACK. 127 | EXEC SQL 128 | ROLLBACK 129 | END-EXEC 130 | WHEN OTHER 131 | DISPLAY "Undefined error" 132 | DISPLAY "ERRCODE: " SQLSTATE 133 | DISPLAY SQLERRMC 134 | END-EVALUATE. 135 | ****************************************************************** 136 | 137 | -------------------------------------------------------------------------------- /src/INSERTTBL.cbl: -------------------------------------------------------------------------------- 1 | ****************************************************************** 2 | * Open Cobol ESQL (Ocesql) Sample Program 3 | * 4 | * INSERTTBL -- demonstrates CONNECT, DROP TABLE, CREATE TABLE, 5 | * INSERT rows, COMMIT, ROLLBACK, DISCONNECT 6 | * 7 | * Copyright 2013 Tokyo System House Co., Ltd. 8 | ****************************************************************** 9 | IDENTIFICATION DIVISION. 10 | ****************************************************************** 11 | PROGRAM-ID. INSERTTBL. 12 | AUTHOR. TSH. 13 | DATE-WRITTEN. 2013-06-28. 14 | 15 | ****************************************************************** 16 | DATA DIVISION. 17 | ****************************************************************** 18 | WORKING-STORAGE SECTION. 19 | 01 TEST-DATA. 20 | *>"---+++++++++++++++++++++----" 21 | 03 FILLER PIC X(28) VALUE "0001HOKKAI TARO 0400". 22 | 03 FILLER PIC X(28) VALUE "0002AOMORI JIRO 0350". 23 | 03 FILLER PIC X(28) VALUE "0003AKITA SABURO 0300". 24 | 03 FILLER PIC X(28) VALUE "0004IWATE SHIRO 025p". 25 | 03 FILLER PIC X(28) VALUE "0005MIYAGI GORO 020p". 26 | 03 FILLER PIC X(28) VALUE "0006FUKUSHIMA RIKURO 0150". 27 | 03 FILLER PIC X(28) VALUE "0007TOCHIGI SHICHIRO 010p". 28 | 03 FILLER PIC X(28) VALUE "0008IBARAKI HACHIRO 0050". 29 | 03 FILLER PIC X(28) VALUE "0009GUMMA KURO 020p". 30 | 03 FILLER PIC X(28) VALUE "0010SAITAMA JURO 0350". 31 | 01 TEST-DATA-R REDEFINES TEST-DATA. 32 | 03 TEST-TBL OCCURS 10. 33 | 05 TEST-NO PIC S9(04). 34 | 05 TEST-NAME PIC X(20) . 35 | 05 TEST-SALARY PIC S9(04). 36 | 01 IDX PIC 9(02). 37 | 01 SYS-TIME PIC 9(08). 38 | 39 | EXEC SQL BEGIN DECLARE SECTION END-EXEC. 40 | 01 DBNAME PIC X(30) VALUE SPACE. 41 | 01 USERNAME PIC X(30) VALUE SPACE. 42 | 01 PASSWD PIC X(10) VALUE SPACE. 43 | 01 EMP-REC-VARS. 44 | 03 EMP-NO PIC S9(04) VALUE ZERO. 45 | 03 EMP-NAME PIC X(20) . 46 | 03 EMP-SALARY PIC S9(04) VALUE ZERO. 47 | EXEC SQL END DECLARE SECTION END-EXEC. 48 | 49 | EXEC SQL INCLUDE SQLCA END-EXEC. 50 | ****************************************************************** 51 | PROCEDURE DIVISION. 52 | ****************************************************************** 53 | MAIN-RTN. 54 | DISPLAY "*** INSERTTBL STARTED ***". 55 | 56 | * WHENEVER IS NOT YET SUPPORTED :( 57 | * EXEC SQL WHENEVER SQLERROR PERFORM ERROR-RTN END-EXEC. 58 | 59 | * CONNECT 60 | MOVE "testdb@db" TO DBNAME. 61 | MOVE "postgres" TO USERNAME. 62 | MOVE SPACE TO PASSWD. 63 | EXEC SQL 64 | CONNECT :USERNAME IDENTIFIED BY :PASSWD USING :DBNAME 65 | END-EXEC. 66 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN STOP RUN. 67 | 68 | * DROP TABLE 69 | EXEC SQL 70 | DROP TABLE IF EXISTS EMP 71 | END-EXEC. 72 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN. 73 | 74 | * CREATE TABLE 75 | EXEC SQL 76 | CREATE TABLE EMP 77 | ( 78 | EMP_NO NUMERIC(4,0) NOT NULL, 79 | EMP_NAME CHAR(20), 80 | EMP_SALARY NUMERIC(4,0), 81 | CONSTRAINT IEMP_0 PRIMARY KEY (EMP_NO) 82 | ) 83 | END-EXEC. 84 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN STOP RUN. 85 | 86 | * INSERT ROWS USING LITERAL 87 | EXEC SQL 88 | INSERT INTO EMP VALUES (46, 'KAGOSHIMA ROKURO', -320) 89 | END-EXEC. 90 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN. 91 | 92 | EXEC SQL 93 | INSERT INTO EMP VALUES (47, 'OKINAWA SHICHIRO', 480) 94 | END-EXEC. 95 | IF SQLCODE NOT = ZERO PERFORM ERROR-RTN. 96 | 97 | * INSERT ROWS USING HOST VARIABLE 98 | PERFORM VARYING IDX FROM 1 BY 1 UNTIL IDX > 10 99 | MOVE TEST-NO(IDX) TO EMP-NO 100 | MOVE TEST-NAME(IDX) TO EMP-NAME 101 | MOVE TEST-SALARY(IDX) TO EMP-SALARY 102 | EXEC SQL 103 | INSERT INTO EMP VALUES 104 | (:EMP-NO,:EMP-NAME,:EMP-SALARY) 105 | END-EXEC 106 | IF SQLCODE NOT = ZERO 107 | PERFORM ERROR-RTN 108 | EXIT PERFORM 109 | END-IF 110 | END-PERFORM. 111 | 112 | * COMMIT 113 | EXEC SQL COMMIT WORK END-EXEC. 114 | 115 | * DISCONNECT 116 | EXEC SQL 117 | DISCONNECT ALL 118 | END-EXEC. 119 | 120 | * END 121 | DISPLAY "*** INSERTTBL FINISHED ***". 122 | STOP RUN. 123 | 124 | ****************************************************************** 125 | ERROR-RTN. 126 | ****************************************************************** 127 | DISPLAY "*** SQL ERROR ***". 128 | DISPLAY "SQLCODE: " SQLCODE " " NO ADVANCING. 129 | EVALUATE SQLCODE 130 | WHEN +10 131 | DISPLAY "Record not found" 132 | WHEN -01 133 | DISPLAY "Connection falied" 134 | WHEN -20 135 | DISPLAY "Internal error" 136 | WHEN -30 137 | DISPLAY "PostgreSQL error" 138 | DISPLAY "ERRCODE: " SQLSTATE 139 | DISPLAY SQLERRMC 140 | *> TO RESTART TRANSACTION, DO ROLLBACK. 141 | EXEC SQL 142 | ROLLBACK 143 | END-EXEC 144 | WHEN OTHER 145 | DISPLAY "Undefined error" 146 | DISPLAY "ERRCODE: " SQLSTATE 147 | DISPLAY SQLERRMC 148 | END-EVALUATE. 149 | ****************************************************************** 150 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------