VSI COBOL for Openvms DBMS Database Programming Manual
Total Page:16
File Type:pdf, Size:1020Kb
VSI OpenVMS VSI COBOL for OpenVMS DBMS Database Programming Manual Document Number: DO-DCOBPG-01A Publication Date: May 2020 This manual explains how to develop Oracle DBMS database programs with VSI COBOL on the OpenVMS Alpha, OpenVMS I64, and the OpenVMS VAX operating systems. Revision Update Information: This is a new manual. Operating System and Version: VSI OpenVMS I64 Version 8.4-1H1 VSI OpenVMS Alpha Version 8.4-2L1 Software Version: VSI COBOL Version 3.1-7 for OpenVMS VMS Software, Inc., (VSI) Bolton, Massachusetts, USA VSI COBOL for OpenVMS DBMS Database Programming Manual Copyright © 2020 VMS Software, Inc. (VSI), Bolton, Massachusetts, USA Legal Notice Confidential computer software. Valid license from VSI required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice. The only warranties for VSI products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. VSI shall not be liable for technical or editorial errors or omissions contained herein. HPE, HPE Integrity, HPE Alpha, and HPE Proliant are trademarks or registered trademarks of Hewlett Packard Enterprise. Intel, Itanium and IA64 are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Oracle is a registered trademark of Oracle and/or its affiliates. UNIX is a registered trademark of The Open Group. The VSI OpenVMS documentation set is available on CD. ii VSI COBOL for OpenVMS DBMS Database Programming Manual Preface ................................................................................................................................... vii 1. About VSI .................................................................................................................... vii 2. Intended Audience ........................................................................................................ vii 3. Document Structure ..................................................................................................... viii 4. Related Documents ...................................................................................................... viii 5. How to Order Additional Documentation ........................................................................ ix 6. VSI Encourages Your Comments ..................................................................................... x 7. Conventions .................................................................................................................... x 8. Acknowledgment ............................................................................................................ x Chapter 1. Program Organization and Structure .............................................................. 1 1.1. Program Structure ........................................................................................................ 1 1.2. VSI COBOL for OpenVMS Data Manipulation Language (DML) .................................. 2 1.3. Creating a VSI COBOL for OpenVMS DML Program ................................................... 4 1.4. Compiling a VSI COBOL for OpenVMS DML Program ................................................ 4 1.4.1. Copying Database Records in a VSI COBOL for OpenVMS Program ................... 5 1.4.2. Using the /MAP Compiler Qualifier ................................................................... 5 1.5. Linking a VSI COBOL for OpenVMS DML Program .................................................... 5 1.6. Running a VSI COBOL for OpenVMS DML Program ................................................... 6 Chapter 2. Database Programming Elements of VSI COBOL for OpenVMS ................ 7 2.1. Database-Related User-Defined Words .......................................................................... 7 2.2. Database-Related Reserved Words ................................................................................ 8 2.2.1. DB-CONDITION .............................................................................................. 8 2.2.2. DB-CURRENT-RECORD-NAME ..................................................................... 8 2.2.3. DB-CURRENT-RECORD-ID ............................................................................ 8 2.2.4. DB-KEY ........................................................................................................... 8 2.2.5. DB-UWA .......................................................................................................... 9 Chapter 3. Data Division .................................................................................................... 11 3.1. DATA DIVISION General Format and Rules ............................................................... 11 Chapter 4. Procedure Division ........................................................................................... 19 4.1. COBOL Statements for the Database Programmer ....................................................... 19 4.1.1. Compiler-Directing Statements and Sentences ................................................... 20 4.1.2. Imperative and Conditional Statements and Sentences ....................................... 21 4.2. Explicit and Implicit Scope Terminators ...................................................................... 21 4.3. Scope of Names ......................................................................................................... 22 4.4. Database Key Identifiers ............................................................................................. 22 4.5. Database Conditions ................................................................................................... 24 4.5.1. Tenancy Conditions ......................................................................................... 24 4.5.2. Empty Condition ............................................................................................. 25 4.5.3. Database Key Condition .................................................................................. 25 4.5.4. Condition Evaluation Rules .............................................................................. 26 4.6. Record Selection Expressions (RSE) ........................................................................... 27 4.7. Set Membership Options and DML Verbs ................................................................... 32 4.8. Programming for Database Exceptions and Error Handling ........................................... 33 4.8.1. Database On Error Condition ........................................................................... 33 4.8.2. At End Condition ............................................................................................ 34 4.8.3. Exception Conditions and the USE Statement ................................................... 35 4.8.4. Translating DB-CONDITION Values to Exception Messages ............................. 37 4.9. Database Programming Statements in the COBOL Procedure Division .......................... 37 4.10. RETAINING Clause ................................................................................................. 76 Chapter 5. Database Programming with VSI COBOL for OpenVMS .......................... 77 iii VSI COBOL for OpenVMS DBMS Database Programming Manual 5.1. The Self-Paced Demonstration Package ....................................................................... 77 5.2. Concepts and Definitions ............................................................................................ 78 5.2.1. Database ......................................................................................................... 78 5.2.2. Schema ........................................................................................................... 79 5.2.3. Storage Schema ............................................................................................... 79 5.2.4. Subschema ...................................................................................................... 79 5.2.5. Stream ............................................................................................................ 79 5.3. Using Oracle CDD/Repository .................................................................................... 80 5.4. Database Records ....................................................................................................... 80 5.5. Database Data Item .................................................................................................... 81 5.6. Database Key ............................................................................................................. 81 5.7. Record Types ............................................................................................................. 81 5.8. Set Types ................................................................................................................... 81 5.9. Sets ........................................................................................................................... 84 5.9.1. Simple Set Relationships .................................................................................. 85 5.9.1.1. System-Owned Sets .............................................................................