CONTENTS Title Page Copyright Page Preface 1 Getting Started in Report Writing 1.1 Using the DATATRIEVE Report Writer 1.2 What the Report Writer Can Do 1.3 Writing Simple Reports: Examples 1.3.1 The PRINT Statement 1.3.2 Summarizing Data with the SUM Statement 1.3.3 Writing a Simple Report with the Report Writer 1.3.4 Defining a Procedure to Produce a Report 1.3.5 Printing Summary Statistics with the Report Writer 2 Designing a Report with the Report Writer 2.1 Identifying the Data and Invoking the Report Writer 2.2 Exiting from the Report Writer 2.3 Using an Editor to Correct Mistakes 2.4 Selecting the Output Medium 2.4.1 Default: Output to Terminal 2.4.2 Option 1: Output to a Line Printer 2.4.3 Option 2: Output to a File 2.4.4 Option 3: Prompt 2.4.5 Using an ON Statement to Specify Multiple Output Media 2.5 Formatting the Report Page 2.5.1 Default Page Width and Length 2.5.2 Option 1: Setting the Page Width 2.5.3 Option 2: Setting the Page Length 2.5.4 Option 3: Limiting the Total Lines or Pages in a Report 2.6 Setting Up the Report Heading 2.6.1 Default Format 2.6.2 Option 1: Naming the Report 2.6.3 Option 2: Assigning a Date 2.6.4 Option 3: Suppressing a Date 2.6.5 Option 4: Assigning a Page Number 2.6.6 Option 5: Suppressing the Page Number 2.6.7 Option 6: Suppressing the Date and Page Number 2.7 Printing Detail Lines and Column Headers 2.7.1 Content of the Detail Line 2.7.1.1 Field Values 2.7.1.2 Value Expressions 2.7.2 Format of Fields in the Detail Lines 2.7.2.1 Order of Print Items 2.7.2.2 Column Position of Print Items 2.7.2.3 Edit String Format of Print Items 2.7.3 Column Headers for Print Items 2.7.3.1 Option 1: Suppressing Column Headers 2.7.3.2 Option 2: Specifying a Column Header 2.8 Summarizing Data 2.8.1 COUNT, AVERAGE, and TOTAL 2.8.2 Maximum Value, Minimum Value, and Standard Deviation 3 Mastering Report Writing Techniques 3.1 Dividing Data Records into Groups 3.1.1 Developing Control Groups with a Sort Key 3.1.2 Developing Levels of Control Groups Using Multiple Sort Keys 3.1.3 Reporting Group Summaries Only 3.1.3.1 Summaries Through the Report Writer 3.1.3.2 Summaries by the SUM Statement Outside of the Report Writer 3.2 Reporting Data Grouped by Date 3.2.1 Solution 1: Control Groups Based on Dates 3.2.2 Solution 2: Grouping Records with a Common Month and Year 3.3 Reporting Data from More Than One Record Source 3.3.1 Using CROSS to Report Data from Two Domains 3.3.2 Using Inner Print Lists to Compare Budgets with Expenses 3.3.3 Using Inner Print Lists with a Hierarchical View 3.4 Printing a Title Page and Other Special Headings 3.4.1 Printing a Title Page 3.4.2 Printing Special Page Headings 3.5 Printing Row Totals 3.6 Reporting Hierarchical Records 3.6.1 Using Nested FOR Statements to Flatten the Hierarchy 3.6.2 Using CROSS to Flatten the Hierarchy 3.6.3 Accessing List Items with the SET SEARCH Command 3.6.4 Using the REPORT Statement to Report List Data 3.7 Printing a Variety of Detail Lines in One Report 3.7.1 CHOICE Value Expression in COMPUTED BY Fields 3.7.2 CHOICE Value Expression Within a PRINT Statement 4 Writing VAX DBMS Reports 4.1 Accessing VAX DBMS Data with DATATRIEVE 4.2 Writing a Simple Report with VAX DBMS Data 4.3 Developing a Procedure for a Bill-of-Materials Report 4.4 Using Control Groups with VAX DBMS Data 5 Writing Relational Database Reports 5.1 Accessing VAX Relational Databases with DATATRIEVE 5.2 Writing a Simple Report with Relational Data 5.3 Combining Data from Many Relations in a Single Report 5.3.1 Using View Domains to Combine Data from Many Relations 5.3.2 Using the CROSS and OVER Clauses to Combine Data for a Report 5.4 Developing a Procedure for a Report 6 DATATRIEVE Report Writer Reference Section AT BOTTOM Statement AT TOP Statement END_REPORT Statement PRINT Statement (RW) REPORT Statement SET Statement (RW) A Listing of Record Definitions A.1 CATS_REC Record Definition A.2 CHECKS_REC Record Definition A.3 EMP_REC Record Definition A.4 EMP_REVIEW_REC Record Definition A.5 PAYABLES_REC Record Definition A.6 PERSONNEL_REC Record Definition A.7 SALES_REC Record Definitions A.7.1 SALES_REC Record Definition (Original) A.7.2 SALES_REC Record Definition (Expanded) A.8 WAGES_REC Record Definition A.9 YACHT Record Definition FIGURES 2-1 Field Structure of PAYABLES_REC 2-2 Field Structure of EMP_REVIEW_REC 2-3 Field Structure of SALES_REC 3-1 Field Structure of PERSONNEL_REC 3-2 Control Group Report Based on One Sort Key 3-3 Control Group Report Based on Two Sort Keys 3-4 Field Structure of PAYABLES_REC 3-5 Report with Detail Lines Grouped by Date 3-6 Accounts Payable Report by Month 3-7 Sample Title Page for a Report 3-8 Field Structure of WAGES_REC 3-9 Field Structure of EMP_REC 3-10 Field Structure of SALES_REC 3-11 Revised Field Structure of SALES_REC 3-12 Control Group Report with Variety of Detail Lines 5-1 Sample Relational Database TABLES 3-1 Commission Schedule for the Sales Division 6-1 Summary of Report Writer Statements 6-2 AT BOTTOM Statement Summary Elements 6-3 AT TOP Statement Header and Summary Elements 6-4 Report Parameters Controlled by Print List Elements 6-5 Report Parameters Affected by Print List Modifiers 6-6 Output File Specification Defaults 6-7 SET Statement Arguments