dBASE-From the Dot Prompt

An Introduction to Structured Programming Using dBASE IV

By Warren M. Littlefield

Subjects: Computers
Paperback : 9780791417805, 591 pages, June 1993

Alternative formats available from:

Table of contents


1. Creating Your First Database

1.1 Preparing Your Diskette
1.2 Getting Into dBASE4
1.3 Creating a Database
1.4 Appending Records to a Database
1.5 Editing the Database
1.6 Browsing the Database
1.7 Appending to Your Database White in EDIT
1.8 Listing Your Database
1.9 Quitting from dBASE4
1.10 Example II: A Checkbook/Budget Account
1.11 Summary
1.12 Review
1.13 Laboratory Work
1.14 Exercise

2. Editing Your Database

2.1 Modifying your Database
2.2 Deleting Fields from the Database Structure
2.3 DISPLAYing your Database One Page at a Time
2.4 Deleting Records from your Database
2.5 Inserting a Record into a Database
2.6 Useful Features of the BROWSE Mode
2.6.1 Appending new data in BROWSE
2.6.2 Entering Data into a Database by Field
2.6.3 Browse Menu Options
2.7 Example II: Expanding the ACCOUNTS database
2.7.1 Navigating Around the Database in BROWSE Mode
2.8 Summary
2.9 Review
2.10 Laboratory Work
2.11 Exercises

3. Ordering a Database

3.1 Sorting a Database
3.2 Erasing a Database
3.3 Indexing a Database
3.3.1 Creating Individual (.NDX) Indexes
3.3.2 Indexing on Two Character Fields
3.4 Use of a Multiple or Production (.MDX) Index
3.4.1 Making a Multiple Index on LASTNAME + FIRSTNAME
3.4.2 Indexing on a Date Field and Character Field
3.4.3 Indexing on Numeric and Character Fields
3.4.4 Indexing on a Logical Field
3.4.5 Indexing in Descending Order
3.5 Selecting the Master Index in a Production (.MDX) Index
3.5.1 Selecting Individual (.NDX) Indexes
3.6 Deleting Indexes
3.7 Example II: Use of INDEXing Options in ACCOUNTS Database
3.7.1 Use of the UNIQUE Option
3.7.2 Use of the FOR Option
3.8 Summary
3.9 Review
3.10 Laboratory Work
3.11 Exercises

4. Columnar Reports

4.1 The Report Form Generator
4.1.1 Creating a Columnar Report
4.1.2 Modifying Report Forms
4.2 Example II: Quick Layout for ACCOUNTS Database
4.2.1 Using Group Bands with Subtotals
4.2.2 Printing a Group Report
4.3 Example II: Use of the Calculated Field in a Report Form
4.3.1 Use of a Running Sum of a Field in the Detail Line
4.4 Summary
4.5 Review
4.6 Laboratory Work
4.7 Exercises

5. Conditional Reports & Searches

5.1 Selecting Records in a Database
5.2 Conditional Reports
5.2.1 The HEADING Clause
5.2.2 Relational Operators
5.2.3 Use of the SET FILTER Command
5.2.4 Conditional Report Using a Date Funtion
5.2.5 Conditional Report Using the Substring Relational Operator
5.2.6 Use of the Logical Function LIKE(,) in a Filter
5.3 Calculations
5.3.1 The COUNT Command
5.3.2 Logical Operators
5.3.3 The SUM Command
5.3.4 Arithmetic Operators
5.3.5 The AVERAGE Command
5.3.6 Use of the CALCULATE Command
5.4 Searches
5.4.1 Searching Using the LOCATE Instructions
5.4.2 Searching Using the FIND and SEEK Commands
5.4.3 LOCATE Search versus INDEX Search
5.5 Summary
5.6 Review
5.7 Laboratory Work
5.8 Exercises

6. Labels, Mailmerge Reports and Forms

6.1 Label Form Generator
6.1.1 Creating a Label Form
6.1.2 Printing Sample Reports
6.2 Mailmerge Report Form
6.2.1 Importing a Text File Letter into the Mailmerge Layout
6.3 The Screen Generator
6.3.1 The Format File
6.4 Summary
6.5 Review
6.6 Laboratory Work
6.7 Exercises

7. Command Files & Memory Variables

7.1 Introduction to Command Files
7.1.1 Creating an "Add Records" Command File
7.1.2 Use of the WAIT Command in the COMPPACK Command File
7.2 Memory Variables
7.2.1 Use of System Memory Variables
7.2.2 Design of the Print Report Command File: COMPREPO.PRG
7.2.3 Design of the Label and Mailmerge Command Files
7.3 Design of a Search/Edit Command File
7.3.1 The @ and SAY Display Intructions
7.3.2 The GET and READ Instructions
7.3.3 The Design of COMPEDIT.PRG
7.4 Design of a Menu Driving Command File
7.5 Summary
7.6 Review
7.7 Laboratory Work
7.8 Exercises
7.9 Term Project

8. Selection

8.1 Structured Programming
8.2 Flow Charts
8.3 Binary Selection
8.4 Example of Binary Selection, COM_EDIT.prg
8.5 Multiple Selection - The DO CASE Structure
8.6 Alternative Data Entry Commands
8.6.1 The INPUT Command
8.6.2 The ACCEPT Command
8.6.3 The WAIT Command Revisited
8.7 Saving, Restoring and Releasing Memory Variables
8.8 The REPLACE Command
8.8.1 Example Using the REPLACE Command for Block Replacements
8.8.2 The REPLACE ALL Command
8.9 Program Example Using ACCEPT, INPUT, WAIT and REPLACE
8.10 Summary
8.11 Review
8.12 Laboratory Work
8.13 Exercises
8.14 Term Project

9. Iteration

9.1 Introduction to The Loop
9.1.1 The DO WHILE Command
9.1.2 Example if Use of DO WHILE Loop
9.2 Design of a Delay Loop
9.3 Use of DO WHILE Loop with EOF() Function
9.4 The Deletion Program - COM_DELE.prg
9.5 Design of a Fast Indexed Search Program
9.5.1 The LOCATE WHILE Instruction
9.5.2 Use of the FOUND() Function
9.5.3 An Example of Indexed Search - COM_EVAL.prg
9.6 Use of the SCAN-ENDSCAN Instruction
9.6.1 The Design of a Range Search Program
9.6.2 Example: The Design of COM_GRAD.prg
9.6.3 Use of the SCAN-ENDSCAN Loop for a LOCATE Search
9.6.4 Use of the SCAN FOR ... Loop
9.7 Remarks on the use of the WHILE Clause
9.8 Summary
9.9 Review
9.10 Laboratory Work
9.11 Exercises
9.12 Term Project

10. System Organization

10.1 Bottom Up Systems Design
10.2 The Systems Structure Chart
10.3 Menu Driver Program with Pop-Up Windows
10.3.1 Design of Menu Sub-Modules
10.4 Use of Windows in Sub-Menus
10.5 Program Structure Chart
10.6 Use of Procedures in dBASE
10.6.1 Appending Programs Together to Form COM_PROC.prg
10.6.2 Design of a Prodecure Driver Program
10.7 Comments About Compiled Code in dBASE IV
10.8 Summary
10.9 Review
10.10 Laboratory Work
10.11 Exercises
10.12 Term Project

11. Controlling Your Environment

11.1 The SET Command
11.1.1 The SET Mode
11.1.2 The SET FUNCTION TO Command
11.1.3 Setting a Color Display
11.2 The CONFIG.DB File
11.2.1 DBSETUP Routine
11.3 Password Protection
11.4 Backing Up Your System
11.4.1 Backing Up a Floppy Diskette
11.4.2 Backing Up Between Different Types of Media
11.5 Running DOS Commands While in dBASE
11.5.1 Macros
11.6 Modifications of COMPCLAS System
11.7 Summary
11.8 Review
11.9 Laboratory Work
11.10 Exercises
11.11 Term Project

12. Debugging & Documentation

12.1 Debugging
12.1.1 Using the Debugger
12.1.2 Use of SET TRAP Command to Locate Errors
12.1.3 Obtaining a Printed Trace of Your Program Execution
12.1.4 Use Modular Programming to Minimize Errors
12.2 Creating Help and Reference Screens
12.2.1 Creating Help Screems
12.2.2 Creating Reference/Help Screens
12.3 Documentation
12.3.1 Brief Narrative of System Function
12.3.2 User Instruction Guide
12.3.3 Sample Reports
12.3.4 Program Structure Diagram
12.3.5 System Structure Chart Diagram
12.3.6 Database Contents List
12.3.7 List of all Indexes & their Keys
12.3.8 Fully Documented Program Listings
12.3.9 Optional Documentation
12.4 Summary
12.5 Review
12.6 Laboratory Work
12.7 Exercises
12.8 Term Project

13. Accounts System - Multiple Files

13.1 Top Down Systems Design
13.1.1 The Budget Database
13.1.2 System Structure Chart for ACCOUNTS System
13.1.3 The Database ACCOUNTS.DBF
13.2 Use of Saved Memory Variables to Select Multiple Databases
13.3 Use of Stubs in Top Down Implementation
13.4 Design of the Update Accounts Sub-Modules
13.4.1 Design of BROWSIT.prg
13.4.2 Design of CATHELP.prg - Use of Multiple Databases
13.4.3 Design of REBALANC.prg
13.4.4 Design of RECONCIL.prg
13.5 Powerful Commands - The Design of SPREADIT.prg
13.5.1 Use of the TOTAL Command
13.5.2 Use of the SET RELATION TO Command
13.5.3 Design of BROWBUDG.prg
13.6 Design of the SETUP Module
13.6.1 The Use of a "Do Until" Loop
13.6.2 The Design of CHANGEYR.prg
13.7 Use of FUNCTION and PICTURE in Design of SEARCAT.prg
13.8 The Budget Report
13.9 Summary
13.10 Review
13.11 Laboratory Work
13.12 Exercises
13.13 Term Project

14. Functions, Arrays & Queries

14.1 User Defined Functions
14.1.1 Elements of User-Defined Functions
14.1.2 Function Example: CDATE()
14.2 Use of Arrays on dBASE
14.3 PUBLIC & PRIVATE Memory Variables
14.4 Inserting Memory Variables Into a Customized Screen Form
14.5 Design of the Re-Calculation Function: RETOTAL()
14.5.1 Attaching a Function to a Screen Entry
14.5.2 The Program BUDGEDIT.prg
14.6 Query Generator
14.6.1 Creating a QUERY of Two Databases Linked Together on a Single Common Key
14.6.2 Creating a QUERY of Multiple Databases Using Multiple Keys
14.6.3 Creating a Composite Database
14.7 Use of the JOIN Command
14.8 Usse of the UPDATE Command
14.8.1 Design of an Updating Program for the COMPCLAS System
14.9 Summary
14.10 Review
14.11 Laboratory Work
14.12 Exercises
14.13 Term Project

Appendix A: Setting Up the Proper Pathways and Directories

A.1 Accessing an Already Installed Copy of dBASE IV on Your Hard Drive
A.2 Creating an AUTOEXEC.BAT file that Established the Proper Pathway
A.3 Creating a CONFIG.SYS file that Establishes the Proper System Config
A.4 Creating the Proper Directories

Appendix B: Free Form Reports

B.1 The Free Form Report

Appendix C: Query By Example

C.1 Creation of Simple Queries
C.2 Queries With More than One Condition in an AND Relationship
C.3 Queries With More Than One Condition in an OR Relationship
C.3.1 Queries with Inclusive OR Conditions Existing in the Same Field
C.3.2 Queries With Inclusive OR Conditions Existing in Different Fields



This is an introduction to systems programming using dBASE IV as a first programming language. The author uses dBASE IV (version 1. 1 or 1. 5) because it is the easiest language to learn initially, and applications can be up and running more easily and quickly.

This textbook is very easy to use. The results of commands are shown on monitor screens illustrated in the text. Page two begins the creation of a data base with immediate interaction with the computer. Students know exactly what they are doing because of the clear and concise explanations and because they have a view of their screens in the text. If the student's screen does not match, he or she can just backtrack. Little backtracking will be necessary because the language is so exact. The text is self-teaching.

Warren M. Littlefield is Associate Professor of Computer Information Science at Sullivan County Community College.


"I like the way the author begins at a low level with one example and continually develops the same example in increasing complexity. Littlefield presents the material so that it is easily understandable to beginners and also interesting to experienced users. " -- Larry Fudella, Erie Community College