VSI COBOL DBMS Database Programming Manual
Total Page:16
File Type:pdf, Size:1020Kb
VSI OpenVMS VSI COBOL DBMS Database Programming Manual Document Number: XX-XXXXXX-XXX Publication Date: month 2018 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 Version X.X Software Version: VSI COBOL Version X.X VMS Software, Inc., (VSI) Bolton, Massachusetts, USA VSI OpenVMS VSI COBOL DBMS Database Programming Manual: Copyright © 2018 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. UNIX is a registered trademark of The Open Group. Oracle is a registered trademark of Oracle and/or its affiliates. The VSI OpenVMS documentation set is available on DVD. ii VSI COBOL DBMS Database Programming Manual Preface .................................................................................................................................. vii 1. About VSI ..................................................................................................................... vii 2. Intended Audience ........................................................................................................... vii 3. Document Structure ......................................................................................................... vii 4. Related Documents ......................................................................................................... viii 5. VSI Encourages Your Comments ........................................................................................ ix 6. Conventions .................................................................................................................... ix 7. References ....................................................................................................................... x 8. Acknowledgment ............................................................................................................... x 9. Field Test Sites ................................................................................................................ xi Chapter 1. Program Organization and Structure .............................................................. 1 1.1. Program Structure ........................................................................................................... 1 1.2. VSI COBOL Data Manipulation Language (DML) ............................................................... 2 1.3. Creating a VSI COBOL DML Program .............................................................................. 4 1.4. Compiling a VSI COBOL DML Program ........................................................................... 4 1.4.1. Copying Database Records in a VSI COBOL Program ................................................ 4 1.4.2. Using the /MAP Compiler Qualifier ......................................................................... 5 1.5. Linking a VSI COBOL DML Program ............................................................................... 5 1.6. Running a VSI COBOL DML Program .............................................................................. 5 Chapter 2. Database Programming Elements of VSI COBOL ......................................... 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 ............................................................................................................ 21 4.4. Database Key Identifiers ................................................................................................. 22 4.5. Database Conditions ...................................................................................................... 23 4.5.1. Tenancy Conditions ............................................................................................. 24 4.5.2. Empty Condition ................................................................................................ 24 4.5.3. Database Key Condition ...................................................................................... 25 4.5.4. Condition Evaluation Rules .................................................................................. 26 4.6. Record Selection Expressions (RSE) ................................................................................. 26 4.7. Set Membership Options and DML Verbs .......................................................................... 31 4.8. Programming for Database Exceptions and Error Handling ................................................... 31 4.8.1. Database On Error Condition ................................................................................ 31 4.8.2. At End Condition ............................................................................................... 33 4.8.3. Exception Conditions and the USE Statement .......................................................... 33 4.8.4. Translating DB-CONDITION Values to Exception Messages ...................................... 35 4.9. Database Programming Statements in the COBOL Procedure Division .................................... 35 4.10. RETAINING Clause .................................................................................................... 70 Chapter 5. Database Programming with VSI COBOL ................................................... 71 5.1. The Self-Paced Demonstration Package ............................................................................. 71 5.2. Concepts and Definitions ................................................................................................ 72 5.2.1. Database ........................................................................................................... 72 iii VSI COBOL DBMS Database Programming Manual 5.2.2. Schema ............................................................................................................. 72 5.2.3. Storage Schema .................................................................................................. 73 5.2.4. Subschema ........................................................................................................ 73 5.2.5. Stream .............................................................................................................. 73 5.3. Using Oracle CDD/Repository ......................................................................................... 74 5.4. Database Records .......................................................................................................... 74 5.5. Database Data Item ....................................................................................................... 75 5.6. Database Key ............................................................................................................... 75 5.7. Record Types ............................................................................................................... 75 5.8. Set Types ..................................................................................................................... 75 5.9. Sets ...........................................................................................................................