Classic Computer Magazine Archive COMPUTE! ISSUE 41 / OCTOBER 1983 / PAGE 52


Ken D. McCann and Dale McBane, Technical Assistant

Not only will this program create easily accessible files for disk or tape storage, but also it will run on any Commodore machine, Atari, TI, Apple, and Color Computer. And with minor adjustments, you can file nearly anything.

This program allows you to file and search for coupons. Coupons may be located by brand name, product, or expiration date, and you may scan the contents of all the files. "Coupon File" could also help you file a great variety of things.

The use of DATA statements as file structures is one of the things that makes this program so versatile. Because the DATA statements are saved with the program, file retrieval is not a problem, even if you don't have disk capability.

The DATA statements were placed before the main program loop to simplify file insertions and deletions. Because the file number and line number for the DATA statements are the same, those of you unfamiliar with programming will find it easy to create files.

Using The Program On Your Computer

There is room for 499 files, assuming you have enough memory to store 499 files. Because of the search routine, each file must have the same format. This is especially true with the date search. 6/30/83, 6-30-83, and 30JUN83 are all different representations of the same date, but for the computer to locate that date, you must choose one format and be consistent.

Coupon File was written to run on any machine which supports BASIC, with one exception. Lines 501, 1000, 1550, 2000, 4000, 6000, and 7100 consist of the statement PRINT "{CLR}". This is COMPUTE!'S listing convention for clear screen on the Commodore 64 and VIC-20. You should substitute the statement to clear the screen on your particular machine (ESC SHIFT < for Atari, CALL CLEAR for TI, etc.).

To make more room for files, you can leave out the instructions. To do this, delete lines 550-555, 630, and 6000-7000, and change line 590 to:

590 IF (K$ <> "L") * (K$ <> "B") * (K$ < > "P") * (K$ <> "D") * (K$ <> "C") THEN GOTO 570

This versatile program is very easy to use, and it's easy to adapt for other purposes. With a few changes, you can create a program to file nearly anything.

Special Note To Timex/Sinclair Users:

Because your machine's version of BASIC does not contain READ or DATA statements, this program will not run on your machine. You may be able to adapt it to your machine using strings for file storage.

Program Explanation Lines

1-499		DATA
500-650		mainmenu
1000-1700	list all routine
2000-3600	brand search routine
4000-5700	date search routine
6000-7000	instructions
7100-8610	product search routine
9000-9600	display routine
10000-10300	file input routine