CONTENTS Title Page Copyright Page Preface Technical Changes and New Features Part I Getting Started with DATATRIEVE 1 Getting Started with VAX DATATRIEVE 1.1 What Is DATATRIEVE? 1.2 Create and Use a VMS Directory 1.3 Run NEWUSER.COM to Obtain a CDD/Plus Directory 1.4 Preparing Your DATATRIEVE Environment 1.5 Invoking DATATRIEVE 1.6 Look at Some Sample Definitions and Data 1.7 End Data Access and Exit DATATRIEVE 1.8 Create a Dictionary Directory 1.9 Create a Simple Application 1.9.1 Use ADT to Create Data Definitions and a File 1.9.2 Store Records 1.9.3 Display Data 1.9.4 Change Field Values 1.9.5 Change Domain Structure 1.9.6 Create a Table 1.9.7 Write a Procedure 1.10 What Do I Read Next? 1.11 What DATATRIEVE Can Do for the Programmer 2 VMS Concepts 2.1 Using the DIGITAL Command Language 2.2 Logging In 2.2.1 Getting the Terminal Ready 2.2.2 Gaining Access to the System 2.3 Getting Online Help 2.4 Entering Commands 2.4.1 Command Prompting 2.4.2 Defaults 2.4.3 Abbreviating Commands 2.4.4 Recovering from Errors 2.4.5 Summary of Entering Commands 2.5 Interpreting System Responses 2.5.1 Information Messages 2.5.2 Error Messages 2.6 Logging Out 2.7 File Management 2.7.1 Creating Files 2.7.2 Identifying Files 2.7.2.1 Nodes 2.7.2.2 Devices 2.7.2.3 Directories and Subdirectories 2.7.2.4 File Names, Types, and Versions 2.7.2.5 Wildcard Character 2.7.3 Deleting Files 2.7.4 Purging Files 2.7.5 Displaying Files at Your Terminal 2.7.6 Printing Files 2.7.7 Listing Files in a Directory 2.7.8 Copying Files 2.7.9 Renaming Files 2.7.10 Appending Files 2.7.11 Finding Differences Between Files 2.7.12 Searching Files for a Selected String 2.8 Creating and Managing VMS Directories 2.8.1 Directory Structure 2.8.2 Accessing Other Directories 2.8.3 Creating Subdirectories 2.8.4 Changing Your Default Directory 2.8.5 Protecting Your Directories and Files 2.8.6 Deleting a Directory 2.9 Logical Names 2.10 System Default Logical Names 2.11 Symbols 2.12 Command Procedures 2.12.1 A LOGIN.COM File 3 Using Editors Within DATATRIEVE 3.1 General Editing Information 3.1.1 Assigning a DATATRIEVE Editor 3.1.2 Using Line Recall Within DATATRIEVE 3.1.3 Using the DATATRIEVE EDIT Command 3.1.3.1 Editing the Previous DATATRIEVE Command or Statement 3.1.3.2 Privileges Needed to Edit Dictionary Objects 3.1.3.3 Editing a Dictionary Object Specified by Path Name 3.1.3.4 Editing by Types of Objects Within DATATRIEVE 3.1.3.5 Using EDIT to Recover from a System Failure 3.2 Using EDT Within DATATRIEVE 3.3 Using VAXTPU Within DATATRIEVE 3.4 Using LSE Within DATATRIEVE 3.5 Ending Your Editing Session 3.5.1 Ending an EDT Session 3.5.2 Ending a VAXTPU Session 3.5.3 Ending an LSE Session 3.6 Editing in DATATRIEVE in a DECwindows Environment 4 Using Syntax Diagrams 4.1 Uppercase Words in Syntax Diagrams 4.2 Lowercase Words in Syntax Diagrams 4.3 Brackets and Braces in Syntax Diagrams 4.4 Separators in Syntax Diagrams 5 Input Options During a DATATRIEVE Session 5.1 Invoking DATATRIEVE 5.1.1 Invoking DATATRIEVE with the Symbol DTR32 5.1.2 Using the DCL DATATRIEVE Command 5.2 Creating a Startup Command File (DTR$STARTUP) 5.3 Custom Tailoring DATATRIEVE Keywords 5.4 Exiting DATATRIEVE 5.5 Processing More than One Line as a Unit 5.5.1 Turning Off the ``Looking for...'' Messages 5.5.2 Using Standard Programming Conventions to Format Input 6 Getting Online Assistance 6.1 Using Help 6.2 Getting Help on Errors 6.3 Guide Mode 6.4 Using DATATRIEVE Help in a DECwindows Environment Part II Using DATATRIEVE with CDD/Plus 7 Using DATATRIEVE with the CDD/Plus Dictionary System 7.1 What is the CDD/Plus Dictionary System? 7.2 The CDD/Plus Dictionary System Structure 7.3 CDD/Plus Dictionary Formats 7.3.1 CDO Format Dictionaries 7.3.2 DMU Format Dictionaries 7.3.3 Distinguishing CDO Objects from DMU Objects in SHOW Command 7.4 The Compatibility Dictionary 7.5 DATATRIEVE and CDD/Plus 7.6 Integrating CDO and DMU Definitions in Applications 7.7 How DATATRIEVE Determines Dictionary Destination 7.8 Converting DMU Definitions to CDO Format Definitions 7.8.1 Using the DATATRIEVE EDIT Command to Convert Definitions 7.8.2 Using the DATATRIEVE EXTRACT Command to Convert Definitions 7.8.3 Using the CDO Utility's CONVERT Command 7.9 Choosing a Dictionary Format 8 Using DATATRIEVE with a CDO Format Dictionary 8.1 Organization of a CDO Format Dictionary 8.2 Creating and Using CDO Format Path Names 8.2.1 Rules for Naming CDO Format Objects and Directories 8.2.2 Abbreviating CDO Path Names 8.2.3 Using Logical Names 8.2.3.1 Logical Names in Dictionary Path Names 8.2.3.2 Using Logicals for Search Lists 8.3 Setting Dictionary Location 8.4 Displaying Information About Directories, Objects, and Session Defaults 8.5 Deleting and Purging CDO Format Definitions 8.6 Editing and Extracting Definitions 8.7 Creating Dictionaries and Dictionary Directories 8.8 Deleting CDO Dictionaries and Dictionary Directories 8.9 Readying CDO Format Domains 8.10 Defining DATATRIEVE Objects for CDO Format Dictionaries 8.10.1 Defining DATATRIEVE Domains in CDO Format 8.10.2 Defining DATATRIEVE Records in CDO Format 8.10.3 Defining Data Files for CDO Format Domains 8.11 The DATATRIEVE CDO Command 9 Using DATATRIEVE with a DMU Format Dictionary 9.1 Organization of the DMU Format Dictionary 9.2 Creating and Using DMU Format Path Names 9.2.1 Using Full Path Names 9.2.2 Version Numbers 9.2.3 Abbreviating Path Names 9.2.4 Logical Names in Dictionary Path Names 9.3 Setting Dictionary Location 9.4 Displaying Information About Directories, Objects, and Session Defaults 9.5 Deleting, Purging, and Extracting Definitions 9.6 Creating DMU Format Dictionary Directories 9.7 Deleting Dictionary Directories 9.8 Using CDD/Plus to Design Department-Wide or System-Wide Applications 10 DATATRIEVE and CDD/Plus Protection 10.1 Access Control Lists 10.1.1 ACLs for CDD/Plus Definitions 10.1.1.1 ACLs for DMU Format Dictionaries 10.1.1.2 Access Privileges for CDO Format Dictionaries 10.1.1.3 DMU and CDO Access Privilege Equivalents 10.1.2 Displaying Your Privileges 10.1.3 Access Privilege Requirements 10.1.4 Displaying and Changing an ACL 10.2 Using CDD/Plus to Design Department-Wide or System-Wide Applications Part III Setting Up an Application 11 Application Case Study: A Personnel System 11.1 Reviewing the Requirements 11.2 Analyzing the Data 11.3 Grouping Fields into Domains and Tables 12 Defining Records 12.1 Setting Up Hierarchies Among Fields (Level Numbers) 12.2 Selecting Names 12.2.1 Differences Between Record Name and Top-Level Field 12.2.2 Using Query Names 12.2.3 Using Column Headers 12.2.4 Using FILLER Fields 12.3 Specifying Type and Size of Data 12.3.1 Specifying a PIC Clause 12.3.1.1 Defining Alphanumeric (X) and Alphabetic (A) Fields 12.3.1.2 Defining Numeric Fields 12.3.2 Using the USAGE Clause 12.3.3 Date Fields 12.3.4 Virtual (Computed) Fields 12.3.5 Using the REDEFINES Clause 12.3.6 Specifying Repeating Fields Using the OCCURS Clause 12.4 Formatting the Display of Field Values 12.5 Including Validation Requirements 12.6 Initializing Field Values 12.7 Specifying Values to Be Ignored in Statistical Computations 12.8 Including CDO-Defined Field-Level Definitions 12.9 Ending Field and Record Definitions 12.10 Editing Record Definitions 13 Defining Domains 13.1 Naming the Domain 13.2 Specifying the Record Name 13.3 Specifying the Data File 13.3.1 Determining Which Parts of the File Specification to Include 13.3.2 Avoiding Problems When Naming Files 13.4 Using the WITH RELATIONSHIPS Clause 14 Defining Data Files 14.1 Defining Indexed Files 14.1.1 Selecting the Primary Key 14.1.2 Selecting Alternate Keys 14.1.3 Selecting Group Field Keys 14.2 Defining Sequential Files 14.3 Planning for File Maintenance 14.3.1 Using the DEFINE FILE Command to Allocate Storage Space 14.3.2 Using RMS Utilities to Load and Maintain Files 14.4 Defining Data Files for CDO Format Domains 14.5 Restructuring a Domain 14.5.1 Changing Only File Organization, Storage Options, and Keys 14.5.2 Changing Fields Defined in the Record Definition 14.5.3 Restructuring a Domain to Add Its Records to Another Domain 15 Defining Tables 15.1 Creating Dictionary Tables 15.2 Creating Domain Tables 15.3 Using DATATRIEVE Tables 15.3.1 Access Privileges Needed to Use Tables 15.3.2 Accessing Values in Tables 15.3.3 Editing Table Definitions 15.3.4 Validating Values with Tables 15.4 Choosing Between Dictionary and Domain Tables Part IV Data Retrieval and Maintenance 16 Starting and Ending Access to Data 16.1 Readying Domains 16.1.1 Readying Domains Defined with Relationships 16.1.2 Defining Your Own Default Access 16.2 Finishing Domains 17 Retrieving Data the Easy Way: with Collections 17.1 Working with Collections 17.2 Specifying Records in a Collection 17.3 Forming and Naming Collections 17.4 Choosing a Target Record for an Operation 17.5 Restricting Record Fields in a Collection 17.6 Sorting Records in a Collection 17.7 Forming a Collection from Two or More Record Sources 17.8 Removing Records from a Collection 17.9 Removing Collections from Your Workspace 17.10 Disadvantages of Using Collections 18 Accessing Data the Expert Way: Without Collections 18.1 Processing Records from Domains Rather than Collections 18.1.1 Ensuring Fast Access 18.1.2 Processing Records in Compound Statements 18.2 Creating RSEs 18.3 Working with Multiple Records 18.3.1 FOR Statement Looping Errors 18.3.2 CROSS Clause Looping Errors 18.3.3 Lists: Using the ``Record'' Within the Record 18.4 Creating Views 18.4.1 View Domains That Subset Fields from One Domain 18.4.2 View Domains That Combine Fields from Two or More Domains 18.5 Access Privileges Needed for Using Views 18.6 Advantages and Disadvantages of Data Access Options 19 Maintaining Data 19.1 Storing Records 19.2 Erasing Records Part V Programming with DATATRIEVE 20 Using Procedures and Compound Statements 20.1 Creating and Executing Procedures 20.2 Correcting and Changing Procedures 20.3 Using Compound Statements 20.3.1 Combining Statements with the REPEAT Statement 20.3.2 Combining Statements with the FOR Statement 20.3.3 Combining Statements with the Keyword THEN 20.3.4 Combining Statements in a BEGIN-END Block 20.3.5 Combining Statements with the WHILE Statement 20.3.6 Combining Statements with IF-THEN and IF-THEN-ELSE Statements 20.3.7 Combining Statements with the CHOICE Statement 20.4 Guidelines for Writing Procedures and Compound Statements 20.4.1 Using FIND, SELECT, SORT, REDUCE, and DROP Statements 20.4.2 Avoiding Looping Mistakes 20.4.3 Invoking DATATRIEVE Procedures from VMS Command Files 20.4.4 Controlling Execution on Error Conditions 20.5 Getting a Procedure to Work the Way You Want 20.5.1 Displaying Command File and Procedure Input During Execution 20.5.2 Writing a Session Log to a File 20.5.3 Checking the Last Word or Character of Input Lines 21 Defining and Calculating Values with DATATRIEVE 21.1 Using DATATRIEVE Expressions 21.1.1 Value Expressions 21.1.1.1 Literals 21.1.1.2 Record Field Names 21.1.1.3 Variable Field Names 21.1.1.4 Prompting Value Expressions 21.1.1.5 Arithmetic Expressions 21.1.1.6 Conditional Value Expressions 21.1.1.7 FORMAT Value Expressions 21.1.2 Boolean Expressions 21.1.2.1 Relational Operators 21.1.2.2 Boolean Operators 21.2 Computing Sums and Other Statistics 21.2.1 Statistical Value Expressions 21.2.2 Using the SUM Statement and Statistical Value Expressions with the CURRENT Collection 21.3 Storing and Displaying Date and Time 21.3.1 Storing and Displaying Values in Date Fields 21.3.2 Comparing and Searching for Date Values 21.3.3 Subtracting Values from a Date Field Part VI Formatting Displays and Writing Reports 22 Improving Screen Displays and Controlling Output 22.1 Optimizing Space in Display Lines 22.1.1 Adjusting Screen Width and the Columns-Page Setting 22.1.2 Using the LIST Statement 22.1.3 Writing a Simple Procedure to Segment Record Display 22.1.4 Overriding Column Header Defaults with the PRINT Statement 22.1.5 Using Edit Strings to Optimize Display Space 22.1.6 Using Concatenation Characters to Conserve Line Space 22.2 PRINT Statement Options 22.2.1 PRINT Statement Format and Print List Elements 22.2.2 Using Print List Modifiers 22.2.3 Sending Output to a File or Printer 23 Writing Reports 23.1 Entering the REPORT Statement 23.2 Controlling Headers and Other Report Settings 23.3 Specifying Detail Lines 23.3.1 Specifying and Formatting Values in a Detail Line 23.3.2 Spacing Values in a Detail Line Across the Page 23.4 Handling Control Groups 23.4.1 Sorting Records According to Control Group Key Values 23.4.2 Printing Control Group Headers 23.4.3 Printing Control Group and Report Summaries 23.5 Including a Title Page for the Report 23.6 Exiting the Report Writer and Correcting Mistakes A VAX DATATRIEVE Keywords A.1 DATATRIEVE Keywords A.2 DATATRIEVE Functions B Sample Record, Table, and View Definitions C DATATRIEVE Sort Order D Edit String Characters EXAMPLES 1-1 Displaying Records 1-2 Using ADT 1-3 Restructuring a Domain 12-1 Sample DATATRIEVE Record Definition 12-2 Logical Model of EMPLOYEES_REC 13-1 Defining a Sample Domain 14-1 Defining a Data File 14-2 Restructuring a Domain to Change File Organization 14-3 Restructuring a Domain to Change the Record Definition 15-1 Defining a Dictionary Table 15-2 Defining a Domain Table 15-3 Using Keywords to Access Values in Tables 16-1 Starting and Ending Access to Data 17-1 Creating and Using a Collection 17-2 Restricting Record Fields 17-3 Using the SORT Statement 18-1 Including RSEs in Statements 18-2 Using RSEs in Compound Statements 18-3 Accessing Values in List Fields 18-4 Defining and Using a View 19-1 Storing Records Interactively 19-2 Storing Records in a Procedure 19-3 Erasing Records by First Creating a Collection 19-4 Erasing Records Using a FOR Statement RSE 19-5 Modifying Records by First Creating a Collection 19-6 Modifying Records in a FOR Statement RSE 20-1 Creating a DATATRIEVE Procedure 21-1 Using Statistical Value Expressions 21-2 Using the SUM Statement and Statistical Value Expressions with the CURRENT Collection 21-3 Storing and Displaying Values in Fields Defined as USAGE DATE 21-4 Comparing and Searching for Date Values 23-1 Sample Report 23-2 Using SET Statements to Vary Report Format 23-3 Varying the Format of Detail Lines 23-4 Including Control Groups in a Report 23-5 Creating a Title Page FIGURES 1-1 DATATRIEVE Main Application Window with DECWindows 1-2 Organization of PHONES Domain 2-1 Sample VMS Directory Structure 7-1 Sample CDD/Plus Dictionary System 8-1 Sample CDO Format Dictionary 9-1 DMU Format Dictionary Structure 9-2 Sample DMU Format Dictionary 11-1 Domains and Tables in Sample Personnel System TABLES 2-1 Default File Types 2-2 Examples of the DELETE Command 2-3 System Default Logical Names 3-1 Default File Types for Journal Files 4-1 Notation Used in Syntax Diagrams 8-1 SHOW Command Options 8-2 Names for DATATRIEVE-Created CDO Objects 9-1 Specifying Version Numbers 9-2 SHOW Command Options for DMU Format Dictionary Definitions 10-1 Access Privileges for DMU Format Dictionaries 10-2 Access Privileges for CDO Format Dictionaries 10-3 DMU/CDO ACL Privilege Equivalents 10-4 Access Privilege Requirements 11-1 Fields for Personnel System 12-1 Picture String Characters 12-2 Relating Numeric Picture Strings to Stored Values 12-3 USAGE Clause Options 12-4 Editing Text Fields 12-5 Editing Numeric Fields 12-6 Editing Date Fields 16-1 Access Options 16-2 Access Modes 16-3 Multiuser Access 21-1 Value Expressions 21-2 Arithmetic Operators 21-3 Relational Operators 21-4 Symbols and Abbreviations for Relational Operators 21-5 Statistical Functions and Results 22-1 Print List Elements 22-2 Print Item Modifiers 23-1 Report Writer SET Statement Options C-1 DATATRIEVE Sort Order D-1 Edit String Characters