VAX Rdb/VMS Guide to Using RDO, RDBPRE, and RDML

*HyperReader

  CONTENTS

  Title Page

  Copyright Page

  Preface

  Technical Changes and New Features

  1      Introduction to VAX Rdb/VMS Data Manipulation

  1.1     What Is a Relational Database?
    1.1.1      Single-File and Multifile Databases
    1.1.2      Using Normalization to Eliminate Data Redundancy

  1.2     Using RDO
    1.2.1      Beginning an RDO Session
    1.2.2      Getting Online Help in RDO
    1.2.3      Using Record Selection Expressions
    1.2.4      Using Multiline Statements in RDO
    1.2.5      Exiting from RDO

  1.3     Using the Sample Database
    1.3.1      Creating the Sample Database

  1.4     Using Rdb/VMS Statements in Programs

  1.5     Internationalization Support
    1.5.1      Controlling Input and Display Format
    1.5.2      Specifying Collating Sequence

  2      Accessing a Database and Using Transactions

  2.1     Invoking a Database
    2.1.1      Accessing the Database by File Name
    2.1.2      Accessing the Database by Dictionary Path Name
    2.1.3      Accessing the Database from a Remote Node
    2.1.4      Accessing Data

  2.2     Using Transactions

  2.3     Specifying the Transaction Mode
    2.3.1      Read-Only Transactions
    2.3.2      Read/Write Transactions
    2.3.3      Batch-Update Transactions
    2.3.4      Reserving Options
      2.3.4.1      Auto-Locking
      2.3.4.2      Shared Read Reserving Option
      2.3.4.3      Shared Write Reserving Option
      2.3.4.4      Protected Read Reserving Option
      2.3.4.5      Protected Write Reserving Option
      2.3.4.6      Exclusive Read Reserving Option
      2.3.4.7      Exclusive Write Reserving Option
    2.3.5      Locking and Lock Conflict Resolution
    2.3.6      Other START_TRANSACTION Options
      2.3.6.1      Evaluating Constraints at Verb Time
      2.3.6.2      Evaluating Constraints at Commit Time
      2.3.6.3      Wait and Nowait Options
      2.3.6.4      Consistency and Concurrency Options
    2.3.7      Indexes
    2.3.8      Transaction Scope
    2.3.9      Ending a Transaction

  2.4     The Query Optimizer

  2.5     Sample Interactive Session Using the START_TRANSACTION Statement

  3      Using Record Selection Expressions

  3.1     Forming Streams of Records

  3.2     Retrieving All the Records in a Relation

  3.3     Displaying Records in Sorted Order
    3.3.1      Indicating Ascending or Descending Sort Order
    3.3.2      Using Value Expressions as Sort Keys

  3.4     Restricting the Number of Records:  The FIRST Clause

  3.5     Specifying Conditions to Retrieve Records:  Relational and Logical Operators
    3.5.1      Retrieving Records That Satisfy a Single Condition
    3.5.2      Specifying Compound Conditions for Records
      3.5.2.1      Retrieving Records That Satisfy Two or More Conditions:  AND Operator
      3.5.2.2      Retrieving Records That Satisfy One of Several Conditions:  OR Operator
      3.5.2.3      Retrieving Records That Do Not Satisfy a Condition:  NOT Operator
      3.5.2.4      Using the ANY and NOT ANY Operators
    3.5.3      Retrieving Records That Match a Substring or Pattern
    3.5.4      Using Limited Matching: STARTING WITH and CONTAINING Operators

  3.6     Eliminating Duplicate Values: REDUCED TO Clause

  3.7     Testing for a Single Record Occurrence:  UNIQUE Operator

  3.8     Retrieving Segmented Strings

  4      Retrieving Records and Joining Relations

  4.1     Joining Relations Using the CROSS Clause
    4.1.1      Joining Records from Two Relations
      4.1.1.1      One-to-One and One-to-Many Joins
      4.1.1.2      Many-to-Many Joins
    4.1.2      Joining Records from More Than Two Relations
    4.1.3      Joining One Relation on Itself

  4.2     Using Nested FOR Loops

  5      Defining and Using Views

  5.1     Creating the View Definition

  5.2     Joining Relations in a View Definition

  6      Storing, Modifying, and Erasing Data

  6.1     Storing Data in an Rdb/VMS Database
    6.1.1      Storing Values in One Relation
    6.1.2      Storing Values in Multiple Relations

  6.2     Modifying Data
    6.2.1      Changing Data in a Single Relation
    6.2.2      Changing Data in Multiple Relations

  6.3     Erasing Data Records in a Relation

  6.4     Updating by Selecting Data from the Record Stream

  6.5     Using Missing Values
    6.5.1      Retrieving Records with a Missing Field Value
      6.5.1.1      Using Nested FOR Loops, Outer Joins, and the MISSING Clause
    6.5.2      Storing Missing Values
    6.5.3      Missing Value Contrasted with SQL Default Value

  6.6     Referential Integrity and Triggers
    6.6.1      Using Constraints to Enforce Referential Integrity
    6.6.2      Using Triggers

  6.7     Summary

  7      Introduction to Rdb/VMS Programming

  7.1     The Programming Interfaces

  7.2     Designing a Prototype Using RDO

  7.3     Developing Your Queries with an Interactive Interface
    7.3.1      Using the RDO SHOW Statements
    7.3.2      Determining Which Relations and Views to Use
    7.3.3      Determining Data Types of Database Fields
      7.3.3.1      Determining Data Validation Checks Defined for the Database
      7.3.3.2      Using the RDO SET OUTPUT Statement
      7.3.3.3      Statement Testing in RDO

  8      Data Type Compatibility

  8.1     Rdb/VMS Data Types

  8.2     The Segmented String Data Type

  8.3     Data Type Conversions
    8.3.1      Preprocessed Program Data Type Conversions
    8.3.2      Callable RDO Program Data Type Conversions
    8.3.3      Statistical Expression Data Type Conversions

  8.4     Host Language Equivalent Data Types

  9      Program Structure and Design

  9.1     Embedding DML Statements in the Program Environment

  9.2     Declaring Host Language Variables
    9.2.1      Declaring Databases
    9.2.2      Forming Record Streams
    9.2.3      Retrieving Records
      9.2.3.1      Using the FOR Statement to Retrieve Records
      9.2.3.2      Using Streams to Retrieve Records
      9.2.3.3      Using Undeclared Streams to Retrieve Records
      9.2.3.4      Using Declared Streams to Retrieve Records
    9.2.4      Retrieving Segmented Strings
      9.2.4.1      Using the FOR Statement to Retrieve Segmented Strings
      9.2.4.2      Using the START_SEGMENTED_STRING Statement to Retrieve Segmented Strings
    9.2.5      Retrieving Field and Statistical Values
      9.2.5.1      Using the GET Statement to Retrieve Field and Record Values
      9.2.5.2      Using the GET Statement to Retrieve Statistical Values
    9.2.6      Updating Records Using the STORE, MODIFY, and ERASE Statements
      9.2.6.1      Storing Records
        9.2.6.1.1       Using the CREATE_SEGMENTED_STRING Statement to Store Segmented Strings
        9.2.6.1.2       Using the STORE Statement with Segmented Strings to Store Segment Streams
      9.2.6.2      Modifying Records
        9.2.6.2.1       Modifying Segmented Strings in RDBPRE
        9.2.6.2.2       Modifying Segmented Strings in RDML
      9.2.6.3      Erasing Records
    9.2.7      Controlling the Scope of Database Keys
    9.2.8      Using Transactions

  9.3     Using Structured Programming in Preprocessed Programs
    9.3.1      Using Context Variables in Program Blocks
    9.3.2      Using Transactions in Separately Preprocessed Modules
    9.3.3      Using Handles in Structured Programming
      9.3.3.1      Using Database Handles
      9.3.3.2      Using Transaction Handles
      9.3.3.3      Using Request Handles
        9.3.3.3.1       Determining When to Use User-Supplied Request Handles
        9.3.3.3.2       Declaring and Initializing a Request Handle
        9.3.3.3.3       Changing the Value Associated with a Request Handle
        9.3.3.3.4       Determining the Scope of a Request Handle
    9.3.4      Using Distributed Transaction Identifiers

  9.4     Using Callable RDO in Preprocessed Programs
    9.4.1      Using the DATABASE Statement with Embedded Callable RDO
    9.4.2      Using Transactions with Embedded Callable RDO

  10     Handling Rdb/VMS Run-Time Errors in Preprocessed Programs

  10.1    Program Design and Error Handling

  10.2    Error Handling for Preprocessed Programs
    10.2.1     Detecting and Displaying Errors-Default Condition Handling
    10.2.2     Detecting and Handling Errors Using the ON ERROR Clause
    10.2.3     Displaying Error Messages in Preprocessed Programs
    10.2.4     Displaying User-Supplied Error Messages in Preprocessed Programs
    10.2.5     Recovering from Errors in Preprocessed Programs
      10.2.5.1     Handling Multi-User Conflicts in Preprocessed Programs
      10.2.5.2     Handling Integrity Failures in Preprocessed Programs
      10.2.5.3     Handling Fatal Errors in Preprocessed Programs

  11     Processing Rdb/VMS Application Programs

  11.1    Using the RDBPRE Preprocessor
    11.1.1     Defining Symbols to Invoke RDBPRE
    11.1.2     Using Host Language Compile Qualifiers with RDBPRE
    11.1.3     Creating RDBPRE Output Files
    11.1.4     Displaying RDBPRE Preprocessor and Compiler Error Messages

  11.2    Using the RDML Preprocessor
    11.2.1     Defining a Symbol to Invoke RDML
    11.2.2     Using RDML Qualifiers
      11.2.2.1     Using Host Language Compiler Qualifiers with RDML Programs
    11.2.3     RDML Command Example
    11.2.4     RDML Run-Time Support and Error Handling

  11.3    Using the Callable RDO Interface

  11.4    Creating an Executable Image: LINKING
    11.4.1     Linking Callable RDO and RDBPRE Programs
    11.4.2     Linking RDML Programs
    11.4.3     Linking RDML Modules with RDBPRE and SQL$PRE Modules

  11.5    Creating a Shareable Image with RDBPRE and RDML
    11.5.1     Accessing a Database from a Shareable Image Only
    11.5.2     Accessing a Database from a Shareable Image and an Application Program

  11.6    Running the Program

  11.7    Debugging with the VMS Debugger

  12     Using the RDBPRE Program Environment

  12.1    RDBPRE Program Development
    12.1.1     Differences in RDO and RDBPRE Data Manipulation Language Syntax
    12.1.2     Using the &RDB& Statement Flag
    12.1.3     Copying Data Dictionary Definitions to Declare Host Language Variables
      12.1.3.1     The INCLUDE Directive in BASIC
      12.1.3.2     The COPY FROM DICTIONARY Statement in COBOL
      12.1.3.3     The DICTIONARY Statement in FORTRAN

  13     Using the BASIC Program Environment

  13.1    The RDBPRE BASIC Preprocessor Interface

  13.2    Embedding DML Statements in the RDBPRE BASIC Program Environment
    13.2.1     Converting an RDO Prototype to the RDBPRE BASIC Environment
      13.2.1.1     Using Host Language Variables
      13.2.1.2     Using Host Language Variables in Conditional Expressions
      13.2.1.3     Converting DATE Data Type to TEXT
      13.2.1.4     Converting ASCII DATE Strings to Binary Format
    13.2.2     Using Literals
    13.2.3     Forming Record Streams
    13.2.4     Retrieving Records
      13.2.4.1     Using the FOR Statement to Retrieve Records
      13.2.4.2     Using Declared Streams to Retrieve Records
    13.2.5     Retrieving Segmented Strings
      13.2.5.1     Using the FOR Statement to Retrieve Segmented Strings
      13.2.5.2     Using the START_SEGMENTED_STRING Statement to Retrieve Segmented Strings
    13.2.6     Retrieving Field Values
      13.2.6.1     Using the GET Statement to Retrieve Field Values
      13.2.6.2     Using the GET * Statement to Retrieve Field Values
      13.2.6.3     Using the GET Statement to Retrieve Statistical Values
    13.2.7     Updating Records Using the STORE, MODIFY, and ERASE Statements
      13.2.7.1     Storing Records
        13.2.7.1.1      Using the STORE * Statement to Store Records
        13.2.7.1.2      Using the CREATE_SEGMENTED_STRING Statement to Store Segmented Strings
      13.2.7.2     Modifying Records
        13.2.7.2.1      Using the MODIFY * Statement to Modify Records
        13.2.7.2.2      Modifying Segmented Strings
      13.2.7.3     Erasing Records

  13.3    Controlling the Scope of Database Keys

  13.4    Using Structured Programming
    13.4.1     Using Handles in Structured Programming
    13.4.2     Declaring and Initializing Handles
    13.4.3     Using Distributed Transaction Identifiers
    13.4.4     Declaring and Initializing Distributed Transaction Identifiers

  13.5    Using Callable RDO
    13.5.1     Using the DATABASE Statement with Embedded Callable RDO
    13.5.2     Embedding Data Definition Statements Using Callable RDO

  13.6    Handling Rdb/VMS Run-Time Errors
    13.6.1     Error Handling
    13.6.2     Detecting Errors Using the ON ERROR Clause
    13.6.3     Determining Which Errors Have Occurred
      13.6.3.1     Using Symbolic Error Codes
      13.6.3.2     Declaring Symbolic Error Codes
      13.6.3.3     Calling LIB$MATCH_COND
    13.6.4     Displaying Error Messages
      13.6.4.1     Calling LIB$SIGNAL
      13.6.4.2     Methods of Calling LIB$SIGNAL
      13.6.4.3     The Format of the LIB$SIGNAL Calling Sequence with RDB$MESSAGE_VECTOR and RDB$STATUS
      13.6.4.4     Calling SYS$PUTMSG
      13.6.4.5     Calling SYS$GETMSG
    13.6.5     Handling Fatal Errors

  14     Using the COBOL Program Environment

  14.1    The RDBPRE COBOL Preprocessor Interface

  14.2    Embedding DML Statements in the RDBPRE COBOL Program Environment
    14.2.1     Converting an RDO Prototype to the RDBPRE COBOL Program Environment
      14.2.1.1     Using Host Language Variables
      14.2.1.2     Using Host Language Variables in Conditional Expressions
      14.2.1.3     Converting DATE Data Types to TEXT
      14.2.1.4     Converting ASCII DATE Strings to Binary Format
    14.2.2     Using Literals
    14.2.3     Forming Record Streams
    14.2.4     Retrieving Records
      14.2.4.1     Using the FOR Statement to Retrieve Records
      14.2.4.2     Using Declared Streams to Retrieve Records
    14.2.5     Retrieving Segmented Strings
      14.2.5.1     Using the FOR Statement to Retrieve Segmented Strings
      14.2.5.2     Using the START_SEGMENTED_STRING Statement to Retrieve Segmented Strings
    14.2.6     Retrieving Field Values
      14.2.6.1     Using the GET Statement to Retrieve Field Values
      14.2.6.2     Using the GET * Statement to Retrieve Field Values
      14.2.6.3     Using the GET Statement to Retrieve Statistical Values
    14.2.7     Updating Records Using the STORE, MODIFY, and ERASE Statements
      14.2.7.1     Storing Records
        14.2.7.1.1      Using the STORE * Statement to Store Records
        14.2.7.1.2      Using the CREATE_SEGMENTED_STRING Statement to Store Segmented Strings
      14.2.7.2     Modifying Records
        14.2.7.2.1      Using the MODIFY * Statement to Modify Records
        14.2.7.2.2      Modifying Segmented Strings
      14.2.7.3     Erasing Records

  14.3    Controlling the Scope of Database Keys

  14.4    Using Structured Programming
    14.4.1     Using Handles in Structured Programming
    14.4.2     Declaring and Initializing Handles
    14.4.3     Using Distributed Transaction Identifiers
    14.4.4     Declaring and Initializing Distributed Transaction Identifiers

  14.5    Using Callable RDO
    14.5.1     Using the DATABASE Statement with Embedded Callable RDO
    14.5.2     Embedding Data Definition Statements Using Callable RDO

  14.6    Handling Rdb/VMS Run-Time Errors
    14.6.1     Error Handling
    14.6.2     Detecting Errors Using the ON ERROR Clause
    14.6.3     Determining Which Errors Have Occurred
      14.6.3.1     Using Symbolic Error Codes
      14.6.3.2     Declaring Symbolic Error Codes
      14.6.3.3     Calling LIB$MATCH_COND
    14.6.4     Displaying Error Messages
      14.6.4.1     Calling LIB$SIGNAL
      14.6.4.2     Methods of Calling LIB$SIGNAL
      14.6.4.3     The Format of the LIB$SIGNAL Calling Sequence with RDB$MESSAGE_VECTOR and RDB$STATUS
      14.6.4.4     Calling SYS$PUTMSG
      14.6.4.5     Calling SYS$GETMSG
    14.6.5     Handling Fatal Errors

  15     Using the FORTRAN Program Environment

  15.1    The RDBPRE FORTRAN Preprocessor Interface

  15.2    Embedding DML Statements in the RDBPRE FORTRAN Program Environment
    15.2.1     Converting an RDO Prototype to the RDBPRE FORTRAN Program Environment
      15.2.1.1     Using Host Language Variables
      15.2.1.2     Using Host Language Variables in Conditional Expressions
      15.2.1.3     Converting DATE Data Types to TEXT
      15.2.1.4     Converting ASCII DATE Strings to Binary Format
    15.2.2     Using Literals
    15.2.3     Forming Record Streams
    15.2.4     Retrieving Records
      15.2.4.1     Using the FOR Statement to Retrieve Records
      15.2.4.2     Using Declared Streams to Retrieve Records
    15.2.5     Retrieving Segmented Strings
      15.2.5.1     Using the FOR Statement to Retrieve Segmented Strings
      15.2.5.2     Using the START_SEGMENTED_STRING Statement to Retrieve Segmented Strings
    15.2.6     Retrieving Field Values
      15.2.6.1     Using the GET Statement to Retrieve Field Values
      15.2.6.2     Using the GET * Statement to Retrieve Field Values
      15.2.6.3     Using the GET Statement to Retrieve Statistical Values
    15.2.7     Updating Records Using the STORE, MODIFY, and ERASE Statements
      15.2.7.1     Storing Records
        15.2.7.1.1      Using the STORE * Statement to Store Records
        15.2.7.1.2      Using the CREATE_SEGMENTED_STRING Statement to Store Segmented Strings
      15.2.7.2     Modifying Records
        15.2.7.2.1      Using the MODIFY * Statement to Modify Records
        15.2.7.2.2      Modifying Segmented Strings
      15.2.7.3     Erasing Records

  15.3    Controlling the Scope of Database Keys

  15.4    Using Structured Programming
    15.4.1     Using Handles in Structured Programming
    15.4.2     Declaring and Initializing Handles
    15.4.3     Using Distributed Transaction Identifiers
    15.4.4     Declaring and Initializing Distributed Transaction Identifiers

  15.5    Using Callable RDO
    15.5.1     Using the DATABASE Statement with Embedded Callable RDO
    15.5.2     Embedding Data Definition Statements Using Callable RDO

  15.6    Handling Rdb/VMS Run-Time Errors
    15.6.1     Error Handling
    15.6.2     Detecting Errors Using the ON ERROR Clause
    15.6.3     Determining Which Errors Have Occurred
      15.6.3.1     Using Symbolic Error Codes
      15.6.3.2     Declaring Symbolic Error Codes
      15.6.3.3     Calling LIB$MATCH_COND
    15.6.4     Displaying Error Messages
      15.6.4.1     Calling LIB$SIGNAL
      15.6.4.2     Methods of Calling LIB$SIGNAL
      15.6.4.3     The Format of the LIB$SIGNAL Calling Sequence with RDB$MESSAGE_VECTOR and RDB$STATUS
      15.6.4.4     Calling SYS$PUTMSG
      15.6.4.5     Calling SYS$GETMSG
    15.6.5     Handling Fatal Errors

  16     Using the RDML Program Environment

  16.1    RDML Program Development
    16.1.1     Differences in RDO and RDML Syntax
    16.1.2     Declaring Host Language Variables
    16.1.3     The C #dictionary Control Line
    16.1.4     The Pascal %DICTIONARY Statement

  17     Using the RDML/C Program Environment

  17.1    The RDML/C Preprocessor Interface

  17.2    Embedding RDML Statements in RDML/C Programs
    17.2.1     Converting an RDO Prototype to the RDML/C Program Environment
      17.2.1.1     Using Host Language Variables
      17.2.1.2     Converting DATE Data Type to TEXT
      17.2.1.3     Converting ASCII DATE Strings to Binary Format
    17.2.2     Using Literals
    17.2.3     Forming Record Streams
    17.2.4     Retrieving Records
      17.2.4.1     Using the FOR Statement to Retrieve Records
      17.2.4.2     Using Declared Streams to Retrieve Records
    17.2.5     Retrieving Segmented Strings
    17.2.6     Retrieving Field Values
      17.2.6.1     Using an Assignment Statement to Retrieve Field Values
      17.2.6.2     Using the GET * Statement to Retrieve Field Values
      17.2.6.3     Using the GET Statement to Retrieve Statistical Values
      17.2.6.4     Retrieving Field Values of the VARYING STRING Data Type
    17.2.7     Updating Records Using the STORE, MODIFY, and ERASE Statements
      17.2.7.1     Storing Records
        17.2.7.1.1      Using the STORE * Statement to Store Records
        17.2.7.1.2      Storing VARYING STRING Data Types in the Database
        17.2.7.1.3      Using the STORE Statement with Segmented Strings to Store Segmented Strings
      17.2.7.2     Modifying Records
        17.2.7.2.1      Using the MODIFY * Statement to Modify Records
        17.2.7.2.2      Modifying Segmented Strings
      17.2.7.3     Erasing Records

  17.3    Controlling the Scope of Database Keys

  17.4    Using Structured Programming
    17.4.1     Using Handles
    17.4.2     Declaring and Initializing Handles
    17.4.3     Using Distributed Transaction Identifiers
    17.4.4     Declaring and Initializing Distributed Transaction Identifiers

  17.5    Using Callable RDO
    17.5.1     Using the DATABASE Statement with Embedded Callable RDO
    17.5.2     Embedding Data Definition Statements Using Callable RDO

  17.6    Handling Rdb/VMS Run-Time Errors
    17.6.1     Error Handling
    17.6.2     Detecting Errors Using the ON ERROR Clause
    17.6.3     Using the RDML General Purpose Error Handler: RDML$SIGNAL_ERROR
    17.6.4     Determining Which Errors Have Occurred
      17.6.4.1     Using Symbolic Error Codes
      17.6.4.2     Declaring Symbolic Error Codes
      17.6.4.3     Calling LIB$MATCH_COND
    17.6.5     Displaying Error Messages
      17.6.5.1     Calling LIB$SIGNAL
      17.6.5.2     Methods of Calling LIB$SIGNAL
      17.6.5.3     The Format of the LIB$SIGNAL Calling Sequence with RDB$MESSAGE_VECTOR and RDB$STATUS
      17.6.5.4     Calling SYS$PUTMSG
      17.6.5.5     Calling SYS$GETMSG
    17.6.6     Handling Fatal Errors

  18     Using the RDML/Pascal Program Environment

  18.1    The RDML/Pascal Preprocessor Interface

  18.2    Embedding RDML Statements in RDML/Pascal Programs
    18.2.1     Converting an RDO Prototype to the RDML/Pascal Program Environment
      18.2.1.1     Using Host Language Variables
      18.2.1.2     Converting DATE Data Type to TEXT
      18.2.1.3     Converting ASCII DATE Strings to Binary Format
    18.2.2     Using Literals
    18.2.3     Forming Record Streams
    18.2.4     Retrieving Records
      18.2.4.1     Using the FOR Statement to Retrieve Records
      18.2.4.2     Using Declared Streams to Retrieve Records
    18.2.5     Retrieving Segmented Strings
    18.2.6     Retrieving Field Values
      18.2.6.1     Using an Assignment Statement to Retrieve Field Values
      18.2.6.2     Using the GET * Statement to Retrieve Records in RDML/Pascal
      18.2.6.3     Using the GET Statement to Retrieve Statistical Values
    18.2.7     Updating Records Using the STORE, MODIFY, and ERASE Statements
      18.2.7.1     Storing Records
      18.2.7.2     Using the STORE * Statement to Store Records
      18.2.7.3     Using the STORE Statement with Segmented Strings to Store Segmented Strings
      18.2.7.4     Modifying Records
        18.2.7.4.1      Using the MODIFY * Statement to Modify Records
        18.2.7.4.2      Modifying Segmented Strings
      18.2.7.5     Erasing Records

  18.3    Controlling the Scope of Database Keys

  18.4    Using Structured Programming
    18.4.1     Using Handles
    18.4.2     Declaring and Initializing Handles
    18.4.3     Using Distributed Transaction Identifiers
    18.4.4     Declaring and Initializing Distributed Transaction Identifiers

  18.5    Using Callable RDO
    18.5.1     Using the DATABASE Statement with Embedded Callable RDO
    18.5.2     Embedding Data Definition Statements Using Callable RDO

  18.6    Handling Rdb/VMS Run-Time Errors
    18.6.1     Error Handling
    18.6.2     Detecting Errors Using the ON ERROR Clause
    18.6.3     Using the RDML General Purpose Error Handler: RDML$SIGNAL_ERROR
    18.6.4     Determining Which Errors Have Occurred
      18.6.4.1     Using Symbolic Error Codes
      18.6.4.2     Declaring Symbolic Error Codes
      18.6.4.3     Calling LIB$MATCH_COND
    18.6.5     Displaying Error Messages
      18.6.5.1     Calling LIB$SIGNAL
      18.6.5.2     Methods of Calling LIB$SIGNAL
      18.6.5.3     The Format of the LIB$SIGNAL Calling Sequence with RDB$MESSAGE_VECTOR and RDB$STATUS
      18.6.5.4     Calling SYS$PUTMSG
      18.6.5.5     Calling SYS$GETMSG
    18.6.6     Handling Fatal Errors

  19     Using the Callable RDO Program Environment

  19.1    The Callable RDO Program Interface
    19.1.1     Using Rdb/VMS Data Manipulation Statements
    19.1.2     Using Rdb/VMS Data Definition Statements

  19.2    Converting Queries to the Program Environment

  19.3    Using RDB$INTERPRET

  19.4    Using Rdb/VMS Data Manipulation Statements
    19.4.1     Declaring Host Language Variables
    19.4.2     Using Host Language Variables
    19.4.3     Using Literals
    19.4.4     Retrieving Records
    19.4.5     Retrieving Segmented Strings
    19.4.6     Retrieving Field and Statistical Values
      19.4.6.1     Using the GET Statement to Retrieve Field Values
      19.4.6.2     Using the GET Statement to Retrieve Statistical Values
    19.4.7     Updating Records
      19.4.7.1     Storing Records
      19.4.7.2     Modifying Records
      19.4.7.3     Modifying Segmented Strings
      19.4.7.4     Erasing Records

  19.5    Using Rdb/VMS Data Definition Statements

  19.6    Mixing Preprocessed and Callable RDO Statements in a Single Transaction

  19.7    Handling Rdb/VMS Errors
    19.7.1     Detecting Errors in Callable RDO Programs
    19.7.2     Determining Which Errors Have Occurred
      19.7.2.1     Using Symbolic Error Codes
      19.7.2.2     Declaring Symbolic Error Codes
      19.7.2.3     Calling LIB$MATCH_COND
    19.7.3     Displaying Error Messages in Callable RDO Programs
      19.7.3.1     Calling RDB$SIGNAL
      19.7.3.2     Calling SYS$GETMSG
    19.7.4     Error Recovery
    19.7.5     Handling Fatal Errors

  A   Programming Reference Tables

  EXAMPLES

  1-1        COBOL Program Performing Store Operation

  1-2        COBOL Program Retrieving Database Values

  2-1        Auto-Locking Versus No Auto-Locking

  11-1       Transfer Vector Coded for a Procedure Call

  13-1       Converting an RDO Prototype to RDBPRE BASIC

  13-2       Using Host Language Variables to Store a Record in RDBPRE BASIC

  13-3       Using SYS$ASCTIM System Service Routine in RDBPRE BASIC

  13-4       Using SYS$BINTIM System Service Routine in RDBPRE BASIC

  13-5       Using the FOR Statement in RDBPRE BASIC

  13-6       Using the Declared START_STREAM and FETCH Statements in RDBPRE BASIC

  13-7       Using the FOR Statement with Segmented Strings in RDBPRE BASIC

  13-8       Using the START_STREAM and START_SEGMENTED_STRING Statements in RDBPRE BASIC

  13-9       Using the FOR and GET Statements in RDBPRE BASIC

  13-10      Using the GET Statement to Retrieve a Statistical Value in RDBPRE BASIC

  13-11      Storing Records in RDBPRE BASIC

  13-12      Using the STORE * Statement in RDBPRE BASIC

  13-13      Using the CREATE_SEGMENTED_STRING Statement in RDBPRE BASIC

  13-14      Modifying Records in RDBPRE BASIC

  13-15      Using the MODIFY * Statement in RDBPRE BASIC

  13-16      Erasing Records in RDBPRE BASIC

  13-17      Using Data Manipulation Statements in Structured Programming in RDBPRE BASIC

  13-18      Embedding Data Definition Statements in RDBPRE BASIC

  13-19      Using LIB$MATCH_COND in RDBPRE BASIC

  14-1       Converting an RDO Prototype to RDBPRE COBOL

  14-2       Using Host Language Variables to Store a Record in RDBPRE COBOL

  14-3       Using a Flag to Delimit the End of a String in RDBPRE COBOL

  14-4       Using SYS$ASCTIM System Service Routine in RDBPRE COBOL

  14-5       Using SYS$BINTIM System Service Routine in RDBPRE COBOL

  14-6       Using the FOR Statement in RDBPRE COBOL

  14-7       Using the Declared START_STREAM and FETCH Statements in RDBPRE COBOL

  14-8       Using the FOR Statement with Segmented Strings in RDBPRE COBOL

  14-9       Using the START_STREAM and START_SEGMENTED_STRING Statements in RDBPRE COBOL

  14-10      Using the FOR and GET Statements in RDBPRE COBOL

  14-11      Using the GET Statement to Retrieve a Statistical Value in RDBPRE COBOL

  14-12      Storing Records in RDBPRE COBOL

  14-13      Using the STORE * Statement in RDBPRE COBOL

  14-14      Using the CREATE_SEGMENTED_STRING Statement in RDBPRE COBOL

  14-15      Modifying Records in RDBPRE COBOL

  14-16      Using the MODIFY * Statement in RDBPRE COBOL

  14-17      Erasing Records in RDBPRE COBOL

  14-18      Using Data Manipulation Statements in Structured Programming in RDBPRE COBOL

  14-19      Embedding Data Definition Statements in RDBPRE COBOL

  14-20      Using LIB$MATCH_COND in RDBPRE COBOL

  15-1       Converting an RDO Prototype to RDBPRE FORTRAN

  15-2       Using Host Language Variables to Store a Record in RDBPRE FORTRAN

  15-3       Using SYS$ASCTIM System Service Routine in RDBPRE FORTRAN

  15-4       Using SYS$BINTIM System Service Routine in RDBPRE FORTRAN

  15-5       Using the FOR Statement in RDBPRE FORTRAN

  15-6       Using the Declared START_STREAM and FETCH Statements in RDBPRE FORTRAN

  15-7       Using the FOR Statement with Segmented Strings in RDBPRE FORTRAN

  15-8       Using the START_STREAM and START_SEGMENTED_STRING Statements in RDBPRE FORTRAN

  15-9       Using the FOR and GET Statements in RDBPRE FORTRAN

  15-10      Using the GET Statement to Retrieve Statistical Values in RDBPRE FORTRAN

  15-11      Storing Records in RDBPRE FORTRAN

  15-12      Using the STORE * Statement in RDBPRE FORTRAN

  15-13      Using the CREATE_SEGMENTED_STRING Statement in RDBPRE FORTRAN

  15-14      Modifying Records in RDBPRE FORTRAN

  15-15      Using the MODIFY * Statement in RDBPRE FORTRAN

  15-16      Erasing Records in RDBPRE FORTRAN

  15-17      Using Data Manipulation Statements in Structured Programming in RDBPRE FORTRAN

  15-18      Embedding Data Definition Statements in RDBPRE FORTRAN

  15-19      Using LIB$MATCH_COND in RDBPRE FORTRAN

  17-1       Converting an RDO Prototype to RDML/C

  17-2       Using DECLARE_VARIABLE to Declare a Host Language Variable in RDML/C

  17-3       Using the BASED ON Clause in RDML/C

  17-4       Using SYS$ASCTIM System Service Routine in RDML/C

  17-5       Using the SYS$BINTIM System Service Routine in RDML/C

  17-6       Using the FOR Statement in RDML/C

  17-7       Using the Declared START_STREAM and FETCH Statements in RDML/C

  17-8       Using the FOR Statement with Segmented Strings in RDML/C

  17-9       Using an Assignment Statement to Retrieve Field Values in RDML/C

  17-10      Using the GET Statement to Retrieve Statistical Values in RDML/C

  17-11      Retrieving Field Values of the VARYING STRING Data Type in RDML/C

  17-12      Storing Records in RDML/C

  17-13      Using the STORE * Statement in RDML/C

  17-14      Storing VARYING STRING Data in RDML/C

  17-15      Storing a Segmented String in RDML/C

  17-16      Modifying Records in RDML/C

  17-17      Using the MODIFY * Statement in RDML/C

  17-18      Modifying Segmented String Fields in RDML/C

  17-19      Erasing Records in RDML/C

  17-20      Using Structured Programming in RDML/C

  17-21      Embedding Data Definition Statements in RDML/C

  17-22      Using LIB$MATCH_COND in RDML/C

  18-1       Converting an RDO Prototype to RDML/Pascal

  18-2       Using DECLARE_VARIABLE to Declare a Host Language Variable in RDML/Pascal

  18-3       Using the BASED ON Clause in RDML/Pascal

  18-4       Using ASCTIM System Service Routine in RDML/Pascal

  18-5       Using BINTIM System Service Routine in RDML/Pascal

  18-6       Using the FOR Statement in RDML/Pascal

  18-7       Using the Declared START_STREAM and FETCH Statements in RDML/Pascal

  18-8       Using the FOR Statement with Segmented Strings in RDML/Pascal

  18-9       Using an Assignment Statement to Retrieve Field Values in RDML/Pascal

  18-10      Using the GET Statement to Retrieve Statistical Values in RDML/Pascal

  18-11      Storing Records in RDML/Pascal

  18-12      Using the STORE * Statement in RDML/Pascal

  18-13      Storing a Segmented String in RDML/Pascal

  18-14      Modifying Records in RDML/Pascal

  18-15      Using the MODIFY * Statement in RDML/Pascal

  18-16      Modifying Segmented String Fields in RDML/Pascal

  18-17      Erasing Records in RDML/Pascal

  18-18      Using Structured Programming in RDML/Pascal

  18-19      Embedding Data Definition Statements in RDML/Pascal

  18-20      Using LIB$MATCH_COND in RDML/Pascal

  19-1       Using RDB$INTERPRET in PL/I

  19-2       Using Host Language Variables to Retrieve a Record in Callable RDO

  19-3       Using a Literal Value Within a Record Selection Expression in Callable RDO

  19-4       Using the START_STREAM and FETCH Statements in Callable RDO

  19-5       Retrieving a Segmented String with the START_STREAM and START_SEGMENTED_STRING Statements in Callable RDO

  19-6       Using the GET Statement to Retrieve a Statistical Value in Callable RDO

  19-7       Storing Records in Callable RDO

  19-8       Using the CREATE_SEGMENTED_STRING Statement in Callable RDO

  19-9       Modifying Records in Callable RDO

  19-10      Erasing Records in Callable RDO

  19-11      Using Data Definition Statements in Callable RDO

  19-12      Using Preprocessed and Callable RDO Statements in a Single Transaction

  19-13      Error Handling in Callable RDO

  19-14      Handling a Record Stream End Condition in Callable RDO

  19-15      Handling Fatal Errors in Callable RDO

  19-16      Continuing Program Execution After a Fatal Error in Callable RDO

  FIGURES

  1-1        A Typical Rdb/VMS Relation in Table Form

  2-1        Database Access Conflicts

  2-2        Recovery-Unit Journal File During an Update Transaction

  2-3        Recovery-Unit Journal File with COMMIT

  2-4        Recovery-Unit Journal File with ROLLBACK

  4-1        One-to-Many Joins of Relations

  4-2        Joining a Relation on Itself (Reflexive Join)

  8-1        The Segmented String Data Type

  10-1       The Format of the Rdb/VMS Message Vector

  11-1       Creation of an RDBPRE Object File

  TABLES

  1-1        Files to Create Sample Database

  3-1        RDO Relational Operators

  3-2        AND Logical Operator

  3-3        OR Logical Operator

  3-4        NOT Logical Operator

  3-5        Testing for the Existence of Records with ANY and UNIQUE Operators

  6-1        Effects of COMMIT and ROLLBACK on Databases and Transactions

  8-1        Rdb/VMS Data Types

  8-2        RDBPRE and RDO Statistical Expression Data Type Conversions

  8-3        RDML Statistical Expression Data Type Conversions

  8-4        Rdb/VMS Data Type Conversions for BASIC

  8-5        RDML Data Type Conversions for C

  8-6        Rdb/VMS Data Type Conversions for COBOL

  8-7        Rdb/VMS Data Type Conversions for FORTRAN

  8-8        RDML Data Type Conversions for Pascal

  9-1        Summary of Database Handle Usage in RDML and RDBPRE Preprocessed Programs

  9-2        Summary of Database Handle Usage in Callable RDO Programs

  11-1       RDBPRE Preprocessor Default File Types

  11-2       RDML Preprocessor Default File Types

  11-3       PSECT Attributes Generated in RDBPRE and RDML Macro Code

  19-1       Severity Levels of the Return Status Value

  A-1        Commonly Used Rdb/VMS Symbolic Error Codes for Data Manipulation

  A-2        Commonly Used Rdb/VMS Symbolic Error Codes for Data Definition