← Apple Basic Data File Programming 1982

Apple Basic Data File Programming 1982

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

APPLE® BASIC: DATA FILE PROGRAMMING A SELF-TEACHING GUIDE Save time and errors! The programs in this book are available on 5¼" disk—ready for instant use. Buy at your favorite computer store or use the order card inside. LeROY FINKEL JERALD R. BROWN

A book cover with a repeating blue background pattern of 'DATA FILES BY FINKEL & BROWN' text, a large torn-paper red apple with olive-green leaves, bold white title type at top, and a small logo in the bottom-left corner.

Reading notes: Background repeated text 'DATA FILES BY FINKEL & BROWN' is partially obscured and was not transcribed as primary copy. Small logo in bottom-left corner contains no legible text. Trademark symbol after APPLE rendered as ® in headline.

Printed product names
Apple BASIC
Languages
English
PDF page 1

APPLE BASIC: DATA FILE PROGRAMMING

APPLE® BASIC: DATA FILE PROGRAMMING A SELF-TEACHING GUIDE Save time and errors! The programs in this book are available on 5¼" disk—ready for instant use. Buy at your favorite computer store or use the order card inside. LeROY FINKEL JERALD R. BROWN

A book cover with a repeated dark blue background pattern of 'DATA FILES BY FINKEL & BROWN' text, bold white title type, and a torn-paper red apple with olive-green leaves holding a white caption box.

Reading notes: Background repeated text 'DATA FILES BY FINKEL & BROWN' is partially visible and overlapped by the title; not transcribed as primary copy. The small logo in the lower left corner is not transcribed. The ® symbol after APPLE is rendered as a superscript circled R.

Printed product names
Apple BASIC
Languages
English
PDF page 2

The image is a plain, entirely blank white page with no visible artwork, layout, or markings.

PDF page 3

More than a million people have learned to program, use, and enjoy microcomputers with Wiley paperback guides. Look for them all at your favorite bookshop or computer store: BASIC; 2nd ed., Albrecht, Finkel, & Brown BASIC for Home Computers, Albrecht, Finkel, & Brown TRS-80 BASIC, Albrecht., Inman,·& Zamora More TRS-80 BASIC, Inman, Zamora, & Albrecht ATARI.BASIC, Albrecl:tt, Finkel, & Brown Data File Programming in BASIC, Finkel & Brown Data File Programming for the Apple Computer, Finkel & Brown ATARI Sound & Graphics, Moore, Lo.wer, & Albrecht Using CP/M, Fernandez & Ashley Introduction to 8080/8085 Assembly Langu~ge Programming, Fernandez & Ashley 8080/Z80 Assembly Language, Miller Personal Computing, McGlynn · Why Do You Need a Personal Computer? Leventhal & Stafford Problem-Solving on the TRS-80 Pocket Computer, Inman & Conlan Using Programmable Calculators for Business, Hohenstein · How to Buy the Right Small Business Computer System, Smolin The TRS-80 Means Business, Lewis ANS COBOL, 2nd ed., Ashley Structured COBOL, Ashley FORTRAN IV, 2nd ed., Friedmann, Greenberg, & Hoffberg Job Control Language, Ashley & Fernandez Background Math for a Computer World, 2nd ed., Ashley Flowcharting, Stern Introduction fo Data Professing, 2nd ed., Harris

Reading notes: Some OCR-like character corruption in author names (e.g., 'Albrecl:tt', 'Lo.wer', 'Albrecht.,') and titles ('Introduction fo Data Professing'). Bullet markers and layout make it unclear whether some entries are separate titles or continuations.

Printed product names
BASIC; 2nd ed., Albrecht, Finkel, & Brown · BASIC for Home Computers, Albrecht, Finkel, & Brown · TRS-80 BASIC, Albrecht., Inman, & Zamora · More TRS-80 BASIC, Inman, Zamora, & Albrecht · ATARI.BASIC, Albrecl:tt, Finkel, & Brown · Data File Programming in BASIC, Finkel & Brown · Data File Programming for the Apple Computer, Finkel & Brown · ATARI Sound & Graphics, Moore, Lo.wer, & Albrecht · Using CP/M, Fernandez & Ashley · 8080/Z80 Assembly Language, Miller · Personal Computing, McGlynn · Why Do You Need a Personal Computer? Leventhal & Stafford · Problem-Solving on the TRS-80 Pocket Computer, Inman & Conlan · Using Programmable Calculators for Business, Hohenstein · How to Buy the Right Small Business Computer System, Smolin · The TRS-80 Means Business, Lewis · ANS COBOL, 2nd ed., Ashley · Structured COBOL, Ashley · FORTRAN IV, 2nd ed., Friedmann, Greenberg, & Hoffberg · Job Control Language, Ashley & Fernandez · Background Math for a Computer World, 2nd ed., Ashley · Flowcharting, Stern · Introduction fo Data Professing, 2nd ed., Harris
Languages
English
PDF page 4

APPLE® BASIC: DATA FILE PROGRAMMING

APPLE® BASIC: DATA FILE PROGRAMMING LEROY FINKEL San Carlos High School and JERALD R. BROWN Educational Consultant John Wiley & Sons, Inc. New York • Chichester • Brisbane • Toronto • Singapore

Printed product names
Apple
Languages
English
PDF page 5

Publisher: Judy V.Wilson Editor: Dianne Littwin Composition and Make-up: Trotta Composition Copyright © 1982, by John Wiley & Sons, Inc. All rights reserved. Published simultaneously in Canada. Reproduction or translation of any part of this work beyond that permitted by Sections 107 or 108 of the 1976 United States Copyright Act without the permission of the copyright owner is unlawful. Requests for permission or further information should be addressed to the . PermisSions Department, John Wiley & Sons, Inc. Library of Congress Cataloging in Publication Data Finkel, LeRoy. Apple BASIC, data ftle programming. (Wiley self-teaching guides) Includes index. 1. Basic (Computer-program language) 2. Apple computer-Programming. I. Brown, Jerald, 1940- 11. Title. III. Series: Self-teaching guide. QA76.73.B3F52 001.64'24 81-13100 ISBN 0-471-09157-X Pripted in the United States of America 82 83 10 9 8 7 6 s.

Reading notes: Headline is not clearly identifiable; no primary heading appears in the copy. Some characters appear damaged or garbled, such as 'ftle' and 'Pripted' and 'II.' and 's.' Printed dates list includes both 1982 copyright years and a 1981 catalog number reference; ISBN and catalog numbers are not treated as dates.

Printed product names
Apple
Printed dates
1982 · 1976 · 1940
Languages
English
PDF page 6

How To Use This Book

How To Use This Book When you use the self-instruction f<,mnat in this book, you will be actively involved in learning data file programming in APPLESOFf* BASIC .. Most of the material is presented in sections called frames, each of which teaches you something new oi provides practice. Each frame also gives you questions to answer or asks you to write a pmgram or program segment. You will learn best if you actually write out the answers and try the programs on your APPLE II computer (with at least one disk drive). The questions are carefully designed to call your attention to important points in the examples and explanations and to help· apply what is being explained or demonstrated. Each chapter begins with a list of objectives - what you will be able to do after completing that chapter. At the end of each chapter is a self-test to provide valuable practice. The self-test can be used as a review of the material covered in the chapter. You can test yourself immediately after reading the chapter. Or you can read a chapter, take a break, and save the self-test as a review before you begin the next chapter. At the end of the book is a final self-test to assess your overall understanding of data file programming. This book is designed to be used with an APPLE computer close at hand. What . you learn will be theoretical only until you actually sit down at a computer and apply your knowledge "hands-on." We strongly recommend that you and this book get together with a computer! Learning data file programming in BASIC will be easier and clearer if you have regular access to a computer so you can try the examples and exercises, make your own modifications, and invent programs for your own purposes. You are now ready to teach yourself to use data files in BASIC. *APPLE and APPLESOFf are registered trademarks of Apple Computer, Inc. v . -

Reading notes: OCR artifacts such as 'f<,mnat' and 'SOFf*' in the source may be damaged characters Possible OCR errors in the word 'pmgram' and 'help·' in the body copy

Printed product names
APPLE II · APPLE
Languages
English
PDF page 7

The image is a blank white page with no visible artwork, layout elements, or text.

PDF page 8

Preface Titls text will teach you to program data files in APPLESOFT BASIC. As a pre- requisite to its use, you should have already completed an introductory course or book in BASIC programming and be able to read program listings and write simple programs: This is not a book for the absolute novice in BASIC. You should already be comfortable writing your own programs that use statements including string vari- ables, string functions, and arrays. We do start the book with a review of statements that you already know, though we cover them in more depth and show you new ways to use them. The book is designed for use by readers who have little or no experience using data files in BASIC (or elsewhere, for that matter). We take you slowly and carefully through experiences that "teach by doing." You will be asked to complete many programs and program segments~ By doing so, you will learn the essentials and a lot more. If you already have data file experience, you can use this book to learn about data files in more depth. The particular data files explained in this text are for APPLESOFT BASIC. Data files in other versions of BASIC will be similar, but not identical, to those taught in this book.* You will find this book most useful when used in conjunction with the reference manual for your computer system. Data files are used to·store quantities of information that you may want to use now and later; for example, mailing addresses, numeric or statistical information, or tax and bookkeeping data. The examples presented in this book will help you use files for home applications, for home business applications, and for your small business or profession. When you have completed this book, you will be able to write your owri programs, modify programs purchased from commercial sources,. and adapt programs using data files that you find in magazines and other sources. *For programrriing data files in TRS-80 BASIC, MICROSOFf BASIC-80, and Northstar BASIC, read our other book, Data File Programming in BASIC by Finkel and Brown (John Wiley & Sons, Inc., N.Y., 1981). For programming data files on the IBM PC, read IBM PC: Data File Programming by Brown and Finkel (John Wiley & Sons, Inc., N.Y., 1983). vii

Reading notes: Possible OCR spacing and punctuation errors in the source text (e.g., 'Titls', 'MICROSOFf', 'vari-able') Footnote text is partially merged with main text in the copy

Printed product names
APPLESOFT BASIC · BASIC · TRS-80 BASIC · Northstar BASIC · IBM PC
Printed dates
1981 · 1983
Languages
English
PDF page 9

Contents Chapter 1 Writing BASIC Programs for Clarity, Readability, and Logic 1 Chapter 2 An Important Review of BASIC Statements 15 Chapter 3 Building 'Data Entry and Error Checking Routines 49 Chapter 4 Creating and Reading Back Sequential Data Files 79 ' Chapter 5 Sequential Data File Utility Programs 134 Chapter 6 Random Access Data Files 198 Chapter 7 Random Access File Applications 252 Final Self-Test 281 Appendix A ASCII Chart Code 294 Appendix B List of Programs 296 Index 302 ix

Reading notes: Stray apostrophe characters appear between entries near Chapter 4 and Chapter 5, possibly OCR artifacts.

Languages
English
PDF page 10

Writing BASIC Programs for Clarity, Readability, and Logic

CHAPTER ONE Writing BASIC Programs for Clarity, Readability~ and Logic Objectives: When you have completed this chapter you will be able to: 1. ·describe how a program can be written using a top-to-bottom format. 2. write an introductory module using REMARK statements. 3. ·describe seven rules to write programs ·that save memory space. INTRODUCTION _This text will teach you to use data files in APPLESOFT BASIC. You should have already completed an introductory course or book in BASIC prograniming, and be able to read program listings and write simple programs. This is not a book for the abso- lute novice in BASIC, but is for those who have never used data files in BASIC (or elsewhere, for that matter). The particular data files explained in this text are for the APPLE II computer and the BASIC languages found on it. Data files in other versions of BASIC and for other computers will be similar, but not identical, to those in this book. (If you are using a computer other than the APPLE II, you may want to read.Data Files Programming in BASIC, or IBM PC: Data File Programming, available at your local computer store or bookstore.) You will find this text most useful when used in conjunction with the APPLE II reference manuals and the Disk Operating System (DOS) Manual: It is not a substitute for your careful reading of the APPLE II DOS Manual, though the workings of sequential and random access files are explained here in far more depth and with more examples. Since it is assumed you have some knowledge of programming in BA~IC and have practiced by writing small programs., the next step is for you to begin thinking about program organization and clarity. Because data file programs can: become fairly large and complex, the inevitable de\:mgging process - making the program actually work ·- can be proportionately complex. Therefore, this chapter is important to you be- cause it provides some program organization methods to help make your future programming easier .. 1

Reading notes: OCR-style spacing and punctuation irregularities in the source (e.g., 'prograniming', 'BA~IC', 'Data Files Programming in BASIC') Possible garbled characters in 'BA~IC' and 'prograniming' that may be OCR errors

Languages
English
PDF page 11

2. APPLE BASIC: DATA FILE PROGRAMMING

2. APPLE BASIC: DATA FILE PROGRAMMING THE. BASIC LANGUAGE The computer language called BASIC was developed at Dartmouth College in the early 1960s. It was intended for use by people with. little or no previous computer experi- ence who were not necessarily adept at mathematics. The original language syntax included only those functions that a beginner would need. As other colleges, computer manufacturers, and institutions began to adopt BASIC, they added embellishments to μieet their own needs. Soon BASIC grew in syntax to what various sources called Extended BASIC, Expanded BASIC, SUPERBASIC, XBASIC, BASIC PLUS, and so 0!1· Finally, in 1978 an industry standard was developed for BASIC, but that standard was for only a "minimal BASIC," as defined by the American National Standards Institute {ANSI). Despite· the ANSI standard, today we have a plethora of different BASIC langu~ges, most of which "look alike," but each with its own special characteristics and quirks. · In the microcomputer field, the most widely used versions of BASIC were developed by the Microsoft Company and are generally referred to as MICROSOFT BASICs. These BASICs are available on a variety of microcomputers but, unfortu- nately, the language is implemented differently on each computer system. The APPLE version of MICROSOFT BASIC is called APPLESOFT. . The programs and· runs shown in this text were ·actually performed on an APPLE II and an APPLE II PLUS computer using Disk Operating System (DOS) 3.3. {They will work in .DOS 3.2, as well.) We wrote all of our programs using APPLE- SOFT BASIC. To use the programs in INTEGER BASIC, you will have to ma).ce the usual APPLESOFT to INTEGER modifications described in your reference manual. The file commands described in this text may be used in APPLESOFT or INTEGER BASIC. For INTEGER BASIC you may have to modify the file .input and output statements, as described in your DOS Manual. · · Where possible, we use BASIC language features that are common to all versions of BASIC, regardless of manufacturer. We do nc:it attempt to show off all of the · bells and whistles found in APPLESOFT BASIC, but rather to present easy-to-under- stand programs that will be readily adaptable to a variety of computers. I THE BASIC LANGUAGE YOU SHOULD USE Conservative Programming Since you will now be writing longer and more complex programs, you should adopt conservative programming techniques so that e"ors will be easier to isolate and locate. (Yes, you will still make errors. We all do!) This means that you should NOT use all the fanciest features available in APPLESOFT BASIC until you have tested the features to be sure they work the way you think they work. Even then, you still might decide against using the fancy features, many of which relate to printing or graphic output and do not work the same on other computers. Some· are special functions that simply do not exist on other computers. Leave them out of your programs unless you feel you must include them. The more conservative your pro- gramming techniques, the less chance there is of running into a software "glitch. "

Reading notes: Possible OCR artifacts in the source, e.g. 'μieet' and '0!1·' and 'langu~ges', may affect exact spelling. Some words are hyphenated across line breaks (e.g. 'experi-ence', 'under-stand'), so reading order is reconstructed.

Printed product names
APPLE II · APPLE II PLUS · DOS · APPLESOFT · INTEGER BASIC · BASIC · MICROSOFT BASIC · DOS 3.3 · DOS 3.2 · DOS Manual
Printed dates
1960s · 1978
Languages
English