CONTENTS Title Page Copyright Page Preface Part I General DEC DATATRIEVE Concepts 1 Introduction to DEC DATATRIEVE 1.1 What is DEC DATATRIEVE? 1.2 Commands and Statements 1.3 Command Files and DEC DATATRIEVE Procedures 1.4 Character Set 1.5 Keywords 1.6 Names 1.7 Termination and Continuation Characters 1.8 Entering Long Command Lines 1.9 Turning Off the ``Looking for...'' Messages 1.10 Comments 1.11 Current Objects 1.12 Using Help 1.12.1 Getting Help on Errors 1.12.2 Using DEC DATATRIEVE Help in a DECwindows Motif Environment 1.13 Application Design Tool (ADT) 1.14 Guide Mode 1.15 Using Editors Within DEC DATATRIEVE 1.15.1 Changing the default editor 1.16 Using the DEC DATATRIEVE EDIT Command 1.16.1 Editing a Dictionary Object Specified by Path Name 1.16.2 Editing by Types of Objects Within DEC DATATRIEVE 1.16.3 Using EDIT to Recover from a System Failure 1.17 Editing in a DECwindows Motif Environment 1.18 The Sample Domains, Records, and Data Files 1.19 Setting up a Oracle CDD/Repository Environment 1.20 Improving Screen Displays and Controlling Output 1.20.1 Adjusting Screen Width and the Columns Page Setting 1.20.2 Using the LIST Statement 1.20.3 Using Concatenation Characters to Conserve Line Space 1.21 Using the Computer Based Training Package Part II Data Definitions (Describing Data) 2 Record Definitions 2.1 Defining a Record 2.1.1 Field Levels 2.1.2 Level Numbers 2.1.3 Elementary and Group Fields 2.1.4 Field Classes 2.1.5 Field Names 2.1.6 Differences Between Record Name and Top-Level Field 2.2 Using Column Headers 2.2.1 Using FILLER Fields 2.2.2 Overriding Column Header Defaults with the PRINT Statement 2.3 The Important Field Definition Clauses 2.3.1 Specifying a PIC Clause 2.3.2 The USAGE Clause 2.3.3 Date Fields 2.3.4 Virtual (COMPUTED BY) Fields 2.3.5 Using the REDEFINES Clause 2.3.6 Specifying Fixed and Variable Occurrence Lists 2.3.7 Defining Sublists 2.4 Formatting Field Values Using the EDIT_STRING Clause 2.5 Defining Data with DEC DATATRIEVE and Oracle CDD/Repository 2.5.1 Including Validation Requirements 2.5.2 Initializing Field Values 2.6 Specifying Values to be Ignored in Statistical Computations 2.7 Including CDO-Defined Field-Level Definitions 2.8 Editing Record Definitions 3 Defining Domains 3.1 Reviewing the Requirements 3.2 Analyzing the Data 3.3 Grouping Fields into Domains and Tables 3.4 Defining a Domain 3.5 Naming the Domain 3.6 Specifying the Record Name 3.7 Specifying the Data File 3.7.1 Determining Which Parts of the File Specification to Include 3.7.2 Avoiding Problems When Naming Files 3.8 Using the WITH RELATIONSHIPS Clause 4 Defining Data Files 4.1 Organizing Files 4.2 Defining Sequential Files 4.3 Defining Indexed Files 4.3.1 Selecting the Primary Key 4.3.2 Selecting Alternate Keys 4.3.3 Selecting Group Field Keys 4.4 Designing Files 4.4.1 Using EDIT/FDL to Design Your File 4.4.2 Creating the Data File 4.5 Planning for File Maintenance 4.5.1 Using RMS Utilities to Load and Maintain Files 4.6 Restructuring Data 4.6.1 Changing Only File Organization, Storage Options, and Keys 4.6.2 Changing Fields Defined in the Record Definition 4.6.3 Restructuring a Domain 4.7 A Sample Domain 4.8 Adding Fields to a Record Definition 4.9 Entering Data in the New File 4.10 Creating Record Subsets 4.11 Combining Data from Two or More Domains 4.12 Using the Alias Clause to Restructure a Domain 4.13 Changing the Organization of a Data File 5 Defining Tables 5.1 Creating Dictionary Tables 5.2 Modifying the Table 5.3 Creating Domain Tables 5.4 Using Tables 5.5 Using DEC DATATRIEVE Tables 5.5.1 Accessing Values in Tables 5.5.2 Validating Values with Tables 5.5.3 Using Domain Tables Based on Relational Sources 5.6 Choosing Between Dictionary and Domain Tables Part III Data Management (Storing, Managing, Reading, Erasing, RSEs) 6 Starting and Ending Access to Data 6.1 Readying Domains 6.1.1 Readying Domains Defined with Relationships 6.1.2 Readying a CDD$RMS_DATABASE 6.1.3 Defining Your Own Default Access 6.2 Finishing Domains 7 Record Selection Expressions 7.1 The RSE Format 7.2 Specifying the Source of Records 7.2.1 Domains as Sources of Record Streams 7.2.2 Collections as Sources of Record Streams 7.2.3 Lists as Sources of Record Streams 7.2.4 Using Relations and Oracle CODASYL DBMS Records as Sources of Record Streams 7.2.4.1 MEMBER Clause 7.2.4.2 OWNER Clause 7.2.4.3 WITHIN Clause 7.3 Displaying All the Records in a Domain 7.4 Limiting the Number of Records in the Record Stream 7.5 Joining Records from Two or More Sources 7.5.1 Crossing Two Domains 7.5.2 Crossing More Than Two Domains 7.5.3 Crossing a Domain with Itself 7.5.4 Using the CROSS Clause Instead of Nested FOR Loops 7.5.5 Using CROSS to Flatten Hierarchical Domains 7.6 Identifying the Records That Meet a Test 7.6.1 Comparing Records by Pattern Recognition 7.6.2 Grouping Records When Values Fall Within a Range 7.6.3 Grouping Records Based on a MISSING VALUE Clause 7.6.4 Grouping Records by Reference to a Table 7.6.5 Setting Up Multiple Tests with Compound Booleans 7.7 Finding a Unique Field Value in a Record Stream 7.8 Sorting the Record Stream by Field Values 8 Maintaining Data 8.1 Using the STORE Statement 8.2 Using Direct Assignments 8.3 Using DEC DATATRIEVE Prompts 8.4 Modifying Data 8.5 Modifying Records in the CURRENT Collection 8.6 Modifying Records in a Record Selection Expression 8.7 Ensuring Valid Values 8.8 Erasing Records 9 Compound Statements 9.1 Using the REPEAT Statement 9.2 Using the FOR Statement 9.3 Using a BEGIN-END Block 9.4 Using the WHILE Statement 9.5 Using IF-THEN and IF-THEN-ELSE Statements 9.6 Using the CHOICE Statement 9.7 Using the Keyword THEN 9.8 Using the AT TOP and AT BOTTOM Clauses 9.8.1 RUNNING COUNT and RUNNING TOTAL Used with Conditional Statements and Expressions 9.9 Avoiding Looping Mistakes 10 Using DEC DATATRIEVE Procedures 10.1 Defining a Procedure 10.2 Editing a Procedure 10.3 Invoking a Procedure 10.4 Contents of a Procedure 10.4.1 Commands and Statements 10.4.2 Arguments and Clauses 10.4.3 Comments 10.5 Aborting Procedures 10.6 Executing a Procedure Repeatedly 10.7 Generalizing Procedures 10.8 Protecting Procedures 10.9 Getting a Procedure to Work the Way You Want 10.9.1 Writing a Session Log to a File 10.10 Invoking a Command File from DEC DATATRIEVE 11 Accessing Data the Easy Way: Using Collections 11.1 Specifying Records in a Collection 11.2 Forming and Naming Collections 11.3 Choosing a Target Record for an Operation 11.4 Restricting Record Fields in a Collection 11.5 Sorting Records in a Collection 11.6 Forming a Collection from Two or More Record Sources 11.7 Removing Records from a Collection 11.8 Removing Collections from Your Workspace 11.9 Disadvantages of Using Collections 12 Accessing Data the Expert Way: Using RSEs and View Domains 12.1 Ensuring Fast Access 12.2 Creating RSEs 12.3 Working with Multiple Records 12.3.1 FOR Statement Looping Errors 12.3.2 CROSS Clause Looping Errors 12.3.3 Lists: Using the ``Record'' Within the Record 12.4 Creating View Domains 12.5 Views Using Subsets of Records 12.6 Views Using Subsets of Fields 12.7 Views Using More Than One Domain 12.7.1 Creating Hierarchies With View Domains 12.8 Using Views with Remote Domains 12.9 Access Privileges Needed for Using Views 12.10 Restrictions on Views with No Physical Record Source 13 Reporting Hierarchical Records 13.1 Retrieving Values from Repeating Fields 13.1.1 Using FIND and SELECT 13.1.2 Using Nested FOR Loops 13.1.3 Using Inner Print Lists 13.1.4 Using Context Searcher 13.2 Retrieving Repeating Field Values by Flattening Hierarchies 13.2.1 Using the CROSS Clause 13.2.2 Using Inner Print Lists 13.2.3 Using Nested FOR Statements 13.2.4 Restructuring a Hierarchical File to a Flat File 13.3 Modifying Values Stored in Repeating Fields 13.3.1 Modifying Repeating Field Values with FIND and SELECT 13.3.2 Modifying Repeating Field Values with FOR and MODIFY 13.3.3 Modifying Every Repeating Field Value with OF 13.3.4 Changing the Length of a Variable-Length List 13.4 Creating Hierarchies with Multiple RSEs 13.4.1 Creating Hierarchies with View Domains 13.4.2 Using Inner Print Lists to Create Dynamic Hierarchies 13.4.3 Using Nested FOR Statements to Create Dynamic Hierarchies Part IV Data Presentation 14 Using the Report Writer 14.1 What the Report Writer Can Do 14.2 Designing a Report with the Report Writer 14.3 Identifying the Data and Invoking the Report Writer 14.4 Exiting from the Report Writer 14.5 Setting Up the Report Heading 14.6 Printing Detail Lines and Column Headers 14.6.1 Column Headers for Print Items 14.7 Creating Title Pages and Other Special Headings 14.7.1 Creating a Title Page 14.7.2 Creating Special Page Headings 14.8 Creating End-of-page or End-of-report Summaries 14.9 Producing Row Totals 14.10 Developing a Procedure for a Report 15 Report Writer Formats 15.1 Report Writer Formats 15.1.1 Page-based or Table-based Formats 15.1.2 Digital's Compound Document Architecture (CDA) 15.2 Producing High-quality Printouts 15.2.1 Changing Font Attributes in a Report 15.2.2 Using the Report Layout 15.2.3 Changing Paper Size 15.2.4 Formatting for DDIF and PostScript 15.3 Using the TEXT format 15.3.1 Formatting TEXT Reports 15.3.2 Changing the Default Page Width and Length 15.4 Reporting data for spreadsheets 15.4.1 Formatting spreadsheets 16 Report Writer Advanced Techniques 16.1 Dividing Data Records into Control Groups 16.1.1 Developing Levels of Control Groups Using Multiple Sort Keys 16.1.2 Reporting Group Summaries Only 16.2 Reporting Data Grouped by Date 16.3 Summarizing Data 16.3.1 COUNT, AVERAGE, and TOTAL 16.3.2 Maximum Value, Minimum Value, and Standard Deviation 16.4 Changing the Content of the Detail Line 16.4.1 Field Values 16.4.2 Value Expressions 16.5 Format of Fields in the Detail Lines 16.5.1 Column Position of Print Items 16.5.2 Edit String Format of Print Items 16.6 Printing a Variety of Detail Lines in One Report 16.6.1 CHOICE Value Expression in COMPUTED BY Fields 16.6.2 CHOICE Value Expression Within a PRINT Statement 16.7 Using Report Writer to Flatten Hierarchies 16.7.1 Using CROSS to Flatten the Hierarchy 16.7.2 Accessing List Items with the SET SEARCH Command 16.7.3 Using the REPORT Statement to Report List Data 16.8 Using Report Writer with Other Database Products 16.8.1 Writing a Simple Report with Oracle CODASYL DBMS Data 16.8.2 Writing a Simple Report with Relational Data 17 Using DEC DATATRIEVE Plots 17.1 Hardcopy Output Devices 17.2 Steps to Take Before Using DEC DATATRIEVE Plots 17.3 Changing from a PRINT Statement to a Plot Statement 17.3.1 Plot Statement Using Data from a Collection 17.3.2 Plot Statement Using Data from RSE 17.3.3 Same Plot Produced by FIND Statement and RSE 17.4 Five Types of Relationship 17.4.1 Time Comparisons (Line, Scatter, Bar Charts) 17.4.2 Parts of the Whole (Pie, Bar Chart) 17.4.3 Comparing Several Items (Bar, Pie Chart) 17.4.4 Comparing Multiple Values (Line, Scatter, Bar Chart) 17.4.5 Frequency Distribution (Histogram) 17.5 Designing and Improving Plots 17.5.1 Guidelines for Designing Plots 17.6 Labels with DEC DATATRIEVE Plots 17.6.1 Default Labels 17.6.2 Specifying Label Strings 17.6.3 Eliminating Scientific Notation 17.7 Using DEC DATATRIEVE Plots with Other Database Products 17.7.1 Using DEC DATATRIEVE Plots with Oracle CODASYL DBMS 17.7.2 Using DEC DATATRIEVE with Relational Databases 18 DEC DATATRIEVE Plot Types 18.1 Bar charts 18.1.1 PLOT BAR 18.1.2 PLOT BAR_AVERAGE 18.1.3 PLOT HISTO 18.1.4 PLOT MULTI_BAR 18.1.5 PLOT MULTI_BAR_GROUP 18.1.6 PLOT NEXT_BAR 18.1.7 PLOT RAW_BAR 18.1.8 PLOT STACKED_BAR 18.2 Line graphs 18.2.1 PLOT MULTI_LINE 18.2.2 PLOT MULTI_LR 18.2.3 PLOT MULTI_SHADE 18.3 Scattergraphs 18.3.1 PLOT DATE_LOGY 18.3.2 PLOT DATE_Y 18.3.3 PLOT LOGX_LOGY 18.3.4 PLOT LOGX_Y 18.3.5 PLOT X_LOGY 18.3.6 PLOT X_Y 18.4 Pie charts 18.4.1 PLOT PIE 18.4.2 PLOT RAW_PIE 18.4.3 PLOT VALUE_PIE 18.5 Utilities 18.5.1 PLOT BAR_ASCENDING 18.5.2 PLOT BIG 18.5.3 PLOT CONNECT 18.5.4 PLOT CROSS_HATCH 18.5.5 PLOT HARDCOPY 18.5.6 PLOT LEGEND 18.5.7 PLOT LIMITS_X and PLOT LIMITS_Y 18.5.8 PLOT LR 18.5.9 PLOT MONITOR 18.5.10 PLOT PAUSE 18.5.11 PLOT REFERENCE_X and PLOT REFERENCE_Y 18.5.12 PLOT RE_PAINT 18.5.13 PLOT SHADE 18.5.14 PLOT SORT_BAR 18.5.15 PLOT TITLE 18.5.16 PLOT WOMBAT 18.6 Using Utilities with other Plot Statements Part V Advanced Topics 19 Using DEC DATATRIEVE with the Oracle CDD/Repository Dictionary System 19.1 What is the Oracle CDD/Repository Dictionary System? 19.2 The Oracle CDD/Repository Dictionary System Structure 19.2.1 CDO Format Dictionaries 19.2.2 DMU Format Dictionaries 19.2.3 Distinguishing CDO Objects from DMU Objects in SHOW Command 19.3 The Compatibility Dictionary 19.4 DEC DATATRIEVE and Oracle CDD/Repository 19.5 Integrating CDO and DMU Definitions in Applications 19.6 How DEC DATATRIEVE Determines Dictionary Destination 19.7 Converting DMU Definitions to CDO Format Definitions 19.7.1 Using the DEC DATATRIEVE EDIT Command to Convert Definitions 19.7.2 Using the DEC DATATRIEVE EXTRACT Command to Convert Definitions 19.8 Choosing a Dictionary Format 19.9 Creating and Using Oracle CDD/Repository Path Names 19.9.1 Rules for Naming Oracle CDD/Repository Objects and Directories 19.9.2 Abbreviating Oracle CDD/Repository Path Names 19.9.3 Using Logical Names 19.9.3.1 Logical Names in Dictionary Path Names 19.9.3.2 Using Logicals for Search Lists 19.10 Setting Dictionary Location 19.11 Deleting, Purging, and Extracting Definitions 20 Using DEC DATATRIEVE with a CDO Format Dictionary 20.1 Organization of a CDO Format Dictionary 20.2 Displaying Information About Directories, Objects, and Session Defaults 20.3 Creating Dictionaries and Dictionary Directories 20.4 Deleting CDO Dictionaries and Dictionary Directories 20.5 Defining DEC DATATRIEVE Objects for CDO Format Dictionaries 20.5.1 Defining DEC DATATRIEVE Domains in CDO Format 20.5.2 Defining DEC DATATRIEVE Records in CDO Format 20.5.3 Defining Data Files for CDO Format Domains 20.6 Readying CDO Format Domains 20.7 The DEC DATATRIEVE CDO Command 21 Using DEC DATATRIEVE with a DMU Format Dictionary 21.1 Organization of the DMU Format Dictionary 21.2 Creating DMU Format Dictionary Directories 21.3 Deleting Dictionary Directories 21.4 Using Oracle CDD/Repository to Design System-Wide Applications 22 Improving DEC DATATRIEVE Performance 22.1 Redesign and Maintenance 22.1.1 Adding Data to the File 22.2 Using the OPTIMIZE Qualifier to Improve Performance 22.3 Choosing Optimal Queries 22.3.1 Using EQUAL Rather Than CONTAINING 22.3.2 Using STARTING WITH Rather Than CONTAINING 22.3.3 Using Domains Rather Than Collections in an RSE 22.3.4 Using the CROSS Clause and Nested FOR Loops 22.3.5 Choosing Domains or Collections as Record Sources 22.3.6 Choosing the Order of Domain Names in the CROSS Clause 22.3.7 Order of Domains in Nested FOR Loops 22.3.8 Nested FOR Loops Followed by a Conditional Statement 22.4 Performance Enhancements for Certain Oracle CDD/Repository Dictionary Operations 22.5 Performance Enhancements for Databases 22.6 Timing Procedures to Improve Efficiency 22.7 DEC DATATRIEVE Evaluation of Compound Boolean Expressions 22.8 Summary of Rules 23 Access Control Lists and DEC DATATRIEVE Protection 23.1 Access Control Lists 23.1.1 An Overview of ACL Entries 23.1.2 Displaying an Access Control List 23.1.3 Hierarchical Protection in the DMU Dictionary 23.1.4 Accumulation of Privileges in the DMU Dictionary 23.1.5 Combinations of DMU ACL Entries 23.1.6 Protection in the CDO Dictionary 23.1.7 Summary of ACL Results 23.2 The Parts of an ACL Entry 23.2.1 User Identification Criteria 23.2.2 Identifying Users by User name 23.2.3 Identifying Users by the UIC 23.2.4 Identifying Users by Rights Identifiers 23.2.5 Identifying Users by the Password 23.2.6 Identifying Users by the Terminal Number or Job Class 23.2.7 DEC DATATRIEVE and Oracle CDD/Repository Privilege Specification 23.3 Creating ACL Entries 23.3.1 Suggestions for Assigning Privileges 23.3.2 Sequence Number in the DEFINEP Command 23.4 Removing Entries from an ACL A Name Recognition and Single Record Context A.1 Establishing the Context for Name Recognition A.1.1 The Right Context Stack A.1.1.1 The Content of a Context Block A.1.1.2 Global Variables A.1.1.3 Collections A.1.1.4 Record Streams A.1.1.5 Local Variables A.1.1.6 VERIFY Clause in the STORE Statement A.1.1.7 VALID IF Clause in a Record Definition A.1.2 Using Context Variables and Qualified Field Names A.1.2.1 Context Variables as Field Name Qualifiers A.1.2.2 Other Field Name Qualifiers A.1.2.3 The Effect of the CROSS Clause on Name Recognition A.1.3 The Left Context Stack for Assignment Statements A.2 Single Record Context A.2.1 The SELECT Statement and the Single Record Context A.2.2 The CURRENT Collection as Target Record Stream A.2.3 The OF rse Clause and Target Record Streams A.2.4 FOR Statements and Target Record Streams B DEC DATATRIEVE Restrictions and Usage Notes B.1 DEC DATATRIEVE Usage and OpenVMS Disk Quota Considerations B.2 Restriction on Concatenating Double-Precision Numbers B.3 Errors During STORE and MODIFY Statement Execution B.4 Restriction on Missing Values and Default Values B.5 Restriction on Modifying Facility-Specific Definitions B.6 Spurious Divide-by-Zero Errors B.7 Execution out of Sequence in Procedures B.8 Interactive Users Can Set Stack Size B.9 Clarification About Using Prompting Value Expressions Glossary EXAMPLES 2-1 Level Numbers in the YACHT Record Definition 2-2 Sample DEC DATATRIEVE Record Definition 3-1 Defining a Sample Domain 4-1 Defining a Data File 4-2 Restructuring a Domain to Change File Organization 4-3 Restructuring a Domain to Change the Record Definition 5-1 Defining a Dictionary Table 5-2 Defining a Domain Table 5-3 Using Keywords to Access Values in Tables 6-1 Starting and Ending Access to Data 8-1 Modifying Records by First Creating a Collection 8-2 Modifying Records in a FOR Statement RSE 8-3 Erasing Records by First Creating a Collection 11-1 Creating and Using a Collection 11-2 PRINT ALL Example 11-3 Restricting Record Fields 11-4 Using the SORT Statement 12-1 Including RSEs in Statements 12-2 Accessing Values in List Fields 13-1 PRINT Statement with Inner Print List 14-1 Control Group Report Based on One Sort Key 15-1 Example Report Changing Font Types for the Output 15-2 Example Producing Layout Boxes 15-3 Example Producing Layout Grid 15-4 Report with Long Fields 16-1 Control Group Report Based on Two Sort Keys 16-2 Accounts Payable Report by Month FIGURES 2-1 Structure of CURRENT_REC 3-1 Domains and Tables in Sample Personnel System 4-1 Flat File Structure 4-2 A File with Two Levels of Index 7-1 Joining Records from Two Domains 13-1 Field Structure of EMP_REC 14-1 Boardroom-quality Report 14-2 Sample Title Page for a Report 14-3 Example Postscript Report Header 14-4 Field Structure of WAGES_REC 15-1 Sample PostScript Output 15-2 Layout Boxes 15-3 Report with Background Grid 15-4 Report Without WIDTH Clause 15-5 Report with WIDTH Clause 16-1 Field Structure of PERSONNEL_REC 16-2 Field Structure of PAYABLES_REC 16-3 Field Structure of SALES_REC 16-4 Revised Field Structure of SALES_REC 16-5 Control Group Report with Variety of Detail Lines 17-1 Plot Produced by FIND Statement or RSE 18-1 Relationship Between Utilities and Plots 20-1 Sample CDO Format Dictionary 21-1 Sample DMU Format Dictionary 23-1 DMU Privileges Passed from Higher Directories 23-2 DMU Privilege Inheritance in a Four-Level Hierarchy A-1 Duplicate Field Names in YACHTS and OWNERS TABLES 1-1 Default File Types for Journal Files 2-1 Field Classes 2-2 Oracle CDD/Repository and DEC DATATRIEVE Data Types 3-1 Fields for Personnel System 12-1 Advantages and Disadvantages of Data Access Options 14-1 Summary of Report Writer Statements 16-1 Commission Schedule for the Sales Division 17-1 Five Types of Relationships 17-2 Bar Charts for Time Comparisons 20-1 Names for DEC DATATRIEVE CDO Objects