Superbase : a Guide to Database Applications
Total Page:16
File Type:pdf, Size:1020Kb
ij Precision Books Supeak^' THE^BOOK Dr Bruce Hunt ■ Programming ■ System Design ■ Troubleshooting Guide SUPERBASE: THE BOOK A Guide to Database Applications Dr. Bruce Hunt Precision Books 1986 First Published 1986 by Precision Software Limited © Copyright Precision Software Limited 1986 Copyright notice: no part of this publication may be reproduced or transmitted In any form or by any means, electronic or mechanical. Including photocopy, recording, or any Information storage or retrieval system, without permission In writing from the publisher. ISBN 1 85231 000 6 Printed by Repro Workshop Limited, Alton, Hampshire, Mastered on Superscript 128 and Canon LBP-8 A2 Laser Printer, Precision Software Limited, 6 Park Terrace, Worcester Park, Surrey KT4 IJZ, England, USA Distribution: Progressive Peripherals & Software, 464 Kalamath Street, Denver, CO 80204, CONTENTS Introduction 1 PART I: SETTING UP A DATABASE 1 First Steps: Designing Files and Indexes 3 2 Designing the Fields 13 3 More Design Considerations 23 4 Basic Menu Operations 36 PART Zl: THE AUTOMATED DATABASE 5 Using the Command Line 59 6 Programs: Theory, Practice and Management 68 7 Automated Search, Sort, Update and Output 82 8 Reporting 105 PART III: THE PROGRAMMED DATABASE 9 Programming Menus and Input Screens 115 10 Advanced Programming 127 11 Parameterizing the System 156 Appendix: Troubleshooting 160 Index 190 Introduction Since Superbase 64 was first released in 1983 there have been many requests for a "Book of the Program". We have been promising one for almost as long, but every attempt has come to nothing, energy and resources always being needed for some other project. However, at last, here it is, a book which although it cannot lay claim to being definitive, has at least the merit of filling a gap. I have tried to provide an extension of the Superbase Manual rather than an alternative to it. This means that everyone expecting to benefit from the discussions and examples in the text should really have read the manual first. However, expertise in Superbase is not required: the book caters for all levels of familiarity with the Superbase system, and should help people experimenting at home as much as those trying to set up a serious office system. There are three main sections to the book and an appendix. Anyone looking for a solution to an immediate problem with Superbase should turn at once to the Troubleshooting appendix. Otherwise, the three sections are arranged to match increasing levels of knowledge of the Superbase system. Part One, Setting up a System, is for users who have recently acquired Superbase and want to design a database on sound principles, and for those who feel that their existing systems may not be doing the best possible job. The chapters take the reader from the essential process of analysis and design of file structure, with discussions of topics such as index key construction methods, screen design, and database components, through to the core menu options for data entry, database searching, sorting, and output. In Part Two, The Automated Database, users can learn how to build on the foundation of Part One and construct their own simple Superbase programs. A guide to effective use of the Superbase command line develops into a worked example of a simple program, and advise on how to manage a programmed system. The remaining chapters expand on the topics raised in Part One, showing how to transform simple menu selections into powerful time-saving automatic routines. A final chapter concentrates on Superbase's reporting functions. Part Three, The Programmed Database, goes further into the mysteries of the Superbase programming language. Three techniques for menu creation are discussed in the context of general screen handling. Then the lengthy Chapter 10 explores many advanced topics, including multi-file applications, reporting refinements such as page numbering, database reorganization, and the 'do/perform' metacommand. The last chapter gives some pointers on how to parameterize a system to gain benefits of increased flexibility and reduced overhead. Finally, the Troubleshooting appendix lists the known errors in all Superbase versions and provides you with a means of identifying the most common problem areas and how to deal with 1 Introduction them. This book owes a great deal to others. My colleagues and friends in Britain and the United States, as well as the 100,000 Superbase users around the world, have contributed greatly to the stock of knowledge on which the book is based. In particular, Simon Tranmer, the designer of Superbase, has helped me to transform technical arcana into plainer truths. And we must all salute the expertise and dedication of the former Superbase Technical Support Manager, Brian Leighfield. Before you take the plunge, a word of warning. The examples in the book have all been tested, and they work as far as we know. But they are only examples, deliberately simplified for the book, and they are not intended to be copied directly into a working system without modification. You should always expect to have to make a few changes. 2 PART I SETTING UP A SYSTEM CHAPTER 1 FIRST STEPS: DESIGNING FILES AND INDEXES Have you read the Superbase Manual? In particular, have you worked through the tutorials? If you want to make the most of this section of the book you must have some knowledge of the basics of the Superbase system. I assume that you know, for example, how to load the program, create a work disk, and set up a database for yourself. You should also know how to move between the two main menus and the Select and Maintain submenus, how to select options from the menu, and how to exit from options when you no longer need them. All this is covered in the Superbase manual, and you won't find much guidance at this level of basic operation here. If you don't know how to do any of the things mentioned above, I suggest you go back to the manual and look them up (there are references in either the Table of Contents or the Index). Then come back to this book and read on. Anybody can set up a Superbase database after a few hours work, enter data into it, and retrieve it for screen display or printed output. But there is a great difference between a system that reflects a first attempt to understand Superbase, which for some people is indeed their very first contact with computers, and a system that incorporates a greater depth of experience. Many people go through the sometimes frustrating process of setting up systems, running them for some weeks, and then having to start again when they realize that they have designed their systems in such a way that many of Superbase's powerful features cannot be used. This is the point at which Precision Software receives many a plea for help. The following pages try to remedy this situation. My aim is to help you jump over some of the delay in learning what makes a good system. I do this by concentrating on the underlying elements of every system, trying to focus on just the menu options that really matter and how to use them most effectively. Here is a list of the options I'll be discussing, and the actual elements of work they correspond to. file Thinking about your data, deciding how to group it on the basis of how you plan to use it, especially how you plan to print it out. format Designing an "input screen" so that it's legible and logical; understanding the best ways to use the different types of data field. enter Putting record data into the file, amending select add records already there, and loading up large select replace numbers of records automatically, import select key Calling records back to the screen with the select n/p/f/1 "key field", flipping through the file, under¬ select current standing the idea of the "current record". 3 Designing Files and Indexes select match Searching through the file for certain records find you want to work with, for example to delete, to sort into a new order, or to print out. batch Going through the file making changes to some of the records. sort Sorting a whole file or a group of records into a new order, usually prior to printing them out. calc Doing calculations on screen output Producing printed output in the form of lists or as one record per page; controlling the appearance of the output; showing lists on the screen; making lists on disk for use with the word processor. If your work includes some of these activities (and if it doesn’t then perhaps you don’t need Superbase at all) then thinking about them carefully before you begin to design your system is bound to produce greater efficiency all round. File Design If I had to pick the most important discussion in the book, this could be it. If you don’t think clearly about the raw material of a system — the data -- you’ll never manage to get the best out of it. Imagine the chaos if that ubiquitous example of a file, the telephone book, was printed in the order of the numbers, or contained no address information. But if some Orwellian police force wanted to get a name from a number, how useful a directory in number order would be. The key to the business of file design lies in the question "What do I want to do with the file?" but since there are as many individual purposes as there are individuals, I shall have to offer only general suggestions to help you find your own answer to the problem.