Jonathan E. Sisk's
Pick/BASIC: A Programmer's Guide
Introduction: The Ground Rules
In writing Pick/BASIC: A Progammer's Guide, certain ground rules had to be established. Without setting boundaries, the job would never have been completed and no one could have benefited from the information. The ground rules are listed here so you might understand the working concepts used to create this textbook.
- This is not an encyclopedia or dictionary; it is intended to be a textbook. It will provide a general understanding of nearly every instruction in the language, and the principles behind putting them to use.
- It is not as important to identify which version of PICK/BASIC does what. The intention is to thoroughly explain the standard instructions and features. Tying specific capabilities to specific manufacturers is therefore given low priority.
- This textbook does not replace your existing system documentation. There is still a need for standard system reference manuals.
- Manufacturers change their versions of PICK/BASIC, eliminating bugs and adding features, frequently without acknowledging the existence of any problems. For this reason, every known bug, change, improvement or modification is not documented.
- To further expand on point 1, there are actually several very good reasons that not every instruction is covered. Some instructions, like "INPUT @" and "INPUTTRAP," don't work consistently. Other instructions, like "RETURN TO statement.label" make programs too hard to debug. Still others, like "SADD," are specific to one manufacturer, but are listed here for reference purposes.
The Pick System comes equipped with a very powerful programming language: PICK/BASIC. It has some remote similarities to standard Dartmouth BASIC (Beginners All-purpose Symbolic Instruction Code), but far exceeds it in features and benefits.
The comparison of PICK/BASIC to the "standard" BASIC ends its similarities at the READ, WRITE, and PRINT statements. Outside of a few intrinsic functions, PICK/BASIC is significantly enhanced and different in syntax. For example, statement labels in PICK/BASIC are optional. When they are used, most versions of Pick still require numeric statement labels, while some now allow alphanumeric statement labels.
The language is very well suited to dealing with strings of characters. This is particularly convenient in a system where everything is stored as a string. A special set of intrinsic functions, like INSERT, REPLACE, and DELETE, are provided to deal with the Pick "three-dimensional" data (item) structure. This means that items (records) are composed of attributes (fields), which in turn are optionally composed of "multi-values" (sub-fields), and finally, "sub-values" (sub-sub-fields?). Through PICK/BASIC, you tell the computer what you want to do to an item, not how to do it. This is why it is beneficial to have a general understanding about the Pick file and item structure before jumping into updating files.
PICK/BASIC programs are primarily used to capture and validate data before storing it on disk. They also can be used to format reports and menus, but generally these functions are done in ACCESS and PROC, respectively.
The many other features of this unique language are covered throughout this text. The bottom line is, if you have used "standard" BASIC, you will find PICK/BASIC to be a much more elegant alternative. If you have not used standard BASIC, congratulations; here's your chance to be exposed to a sophisticated, flexible, and easy-to-learn programming language.
This book deals with "generic" PICK/BASIC code; that is, the programs in the tutorials are designed to be used on any implementation of the Pick System, unless otherwise mentioned in the text.
About the Intended Reader
This book assumes that you already are familiar with the Pick Editor (EDIT) and the Pick file structure. Some of the Editor commands are provided in the tutorials, but there are many features of the Editor which are not discussed.
A background in programming in any language would be helpful, but it's not absolutely vital in order to comprehend and make use of this book. For newcomers to programming, it is important to read the section called "If You Are New To Programming." Even if you have programmed before, this section is suggested reading.
What to Expect
Using a "cookbook" approach, this book takes you through practical working examples of nearly every command in the PICK/BASIC language. Some instructions, like the trigonometric functions, are not called upon very frequently where the majority of Pick systems are actually used, such as in accounting departments. Thus, these and other esoteric instructions are omitted.
After going through all of the program examples and quizzes, you will have the tools necessary to write straightforward, maintainable programs. More importantly, you will be able to read the programs that you already have. By read, I mean that you will be able to figure out the syntax of nearly every instruction in any PICK/BASIC program. Figuring out the logic is another matter altogether. Every programmer has their own style of writing code. Coupling this with the fact that the Pick System is technically very forgiving to even the sloppiest "spaghetti code," produces lots of different approaches to problem solving.
As you explore existing application programs, you will probably find many cases where improvements may be made from techniques obtained in this book. Don't hesitate_put them in! Often a single change won't provide an obvious increase in the performance of your computer; cumulatively, however, each little piece adds up to a big improvement, like the old adage that "the whole is greater than the sum of its parts." For this reason, attention is paid to programming standards and conventions, in addition to technical aspects. Current hardware is so fast that even inefficient programs run at blazing speed. This compensates for bad code, but nothing compensates for code that can't be supported.
Certain typographic conventions are used throughout this book and have the same meaning each time they are encountered.
Any text in all uppercase characters indicates the text is shown exactly as it is displayed by the computer or exactly as you must enter it. Most implementations of the Pick System are generally sensitive to the case of commands, instructions, statements, etc. If they are not entered in the right case, they won't work.
The <cr> symbol is used to represent a carriage return. This is sometimes referred to as the "Enter," "Newline," or "Line Feed" key. They all mean the same thing: press the Return key.
If You Are New to Programming
If you have never touched a computer before and expect to learn how to program from scratch using this book, your task may be more than a little difficult. This book is an introductory approach to the PICK/BASIC language. Many principles of programming are covered in the course of the text, but to keep this book from running about 1500 pages, some topics had to be skipped. For this reason, you may want to explore your local library or bookstore for books that explain the general concepts of programming. Another excellent source for this information is your local community college or university. Don't expect to find university courses on Pick just yet, but we're working on getting it in there.
If you have a reasonable "digital aptitude," however, this book may provide everything you need to understand programming in PICK/BASIC.
Chapter 1 explains some terms that you will need to understand throughout this book. Study them carefully. The glossary contains a much more complete list of Pick terminology.