Mailing List

BY GARRY J. PATTON

This program is written to take advantage of the NOTE and POINT capabilities of the Atari. It is relatively fast and requires the 810 disk drive with DOS 11 and 16K if only 75 records are desired. On a single diskette 750 records can be accessed if needed. This requires 24K. The program is versatile and can be used for any home use for maintaining that list of important addresses. One of my "gripes" about current commercial mailing list programs (besides shelling out $25-$35) is the time required to get at an address quickly. By the time the machine is powered up, the program loaded, and the list searched, as much as two to three minutes have gone by. That seems a little excessive. This program stores all addresses on the diskette and can access them quickly. It doesn't require loading in the program and then loading in the data file. It also doesn't search every file - only until it finds the appropriate address. It then stops and prints the name.

For most of us 50-100 names are all that are required to keep up our Christmas list. However, if you have an exhaustive list (who does at 20 cents a letter), up to 750 addresses can be stored on a single diskette if desired. As the number of addresses on file increase, the initial start increases; thus, the advantage of quickly finding that missing address is decreased. So only create the number of files that you think you will need. Presently the program is set for 100 names.

Because of its uniform file structure, this program can easily be adapted to search for any major field and to sort by each field. However, these "niceties" Are not generally required by most of us. In order to keep RAM to a minimum, these "extras" were not included.

The program has several error protecting features; thus, it shouldn't crash for you. If you encounter an error, just type GOTO MENU and try again. The TRAP command is an excellent tool to prevent those unwanted crashes. When writing a program, this command can help keep your program out of trouble.

The heart of this program is the FILE$. The Atari has excellent string handling capabilities which are used to our advantage in this program. Each subset of the FILE$ is a major field. As mentioned above, each of these fields could easily be searched for individually and sorted or manipulated as desired with only the addition of a short additional subroutine.

The FILE$ is structured such:
FILE$(1,15) = LAST NAME
FILE$(16,25) = FIRST NAME
FILE$(26,49) = STREET ADDRESS
FILE$(50,69) = CITY
FILE$(70,71) = STATE
FILE$(72,81) = ZIP
FILE$(82,95) = PHONE
FILE$(96,116) = EXTRA

A datafile called MAILDATA.FIL is created to store each record. An error trapping routine alerts you if the datafile is not on your diskette, and then it asks if you want to create one. Be sure you have enough sectors left on your diskette before creating the datafile. (It requires .94 SECTORS for each record. Thus, if you want 100 records, have 94 SECTORS left.) The number of records created is controlled by line 87. Set the FOR/NEXT loop to the number desired if you want different than 100 records. (CAUTION! Be sure then that lines 13, 87, 352, 604, and 2501 all match! These lines all have references to the number of records.) If you want more or less records, be sure to change the appropriate lines.

Each record's position in the datafile is stored in two arrays named SECTOR and BYTE. The reason for the need for increased memory for more records is that these arrays must be DIM'ed for the proper amount. This requires memory. The more records created (say 750 instead of 100) the more memory you will need. Remember too that your start-up time will increase because at initialization each record must be counted and its location stored in the appropriate array.

Okay! Now on to the program:

lines 10-30 initializes the program, opens the screen editor, the keys, and MAILDATA.FIL
lines 74-89 if MAILDATA.FIL is not located on the diskette, you are given the choice of creating the file or ending. 100 records are created with a dummy FILE$ of +'s. Each record's position is NOTED and stored in the arrays SECTOR. and BYTE for future reference. POKE 559,0 turns off ANTIC (the screen goes blank because ANTIC controls the screen updating). With ANTIC off 6502 can go merrily about its way doing the task at hand without interruptions from ANTIC. This can save up to 30% of the time required for completion. POKE 559,34 turns ANTIC back on. MAILDATA.FIL is now created and ready to receive your entries.
lines 100-354

This is the meat of the program. With the appropriate prompts each field of FILE$ is created here. A short subroutine at 10001010 causes the cursor position to flash, advances the cursor, and assigns the ATASCII value of the key struck to the variable XX. If the delete key (126) is struck, the flag Q is set; then the entire field is erased, and you start again. If the return key (155) is struck, this terminates the entry to the field..

Each field is assigned a discrete length and is protected to that length. If you go over, an error message routine at 700-708 tells you of your error, and you start again. If the field you enter is less than the prescribed length, the field is padded with blanks until it equals the proper length.

EDIT is a flag that says you've come here from some other subroutine in the program and allows return to that area. Flags allow one to give a program versatility and to reduce RAM useage as an area of your program can be used for several purposes. This reduces repetition. You'll find flags used throughout this program to direct you in and out of various areas smoothly depending on your needs.

You'll note that this program is "with the times" and allows for the new ZIP+four postal wonder or nine digit zip code. If you know your ZIP+four, go ahead and use it. If not it will be here soon. Space is reserved for the additional + four. So you can add it later.

Line 344 allows you to change your mind before the record is committed to the disk. If you keep the file, the next free space is POINTED to by the SECTOR /BYTE arrays, and your file is now stored for your future use.

lines 500-570 This is the main MENU giving you your choice of options to operate the program. Each choice sends you to the appropriate subroutine to complete your task as requested.
lines 600-610 At initialization if MAILDATA.FIL is available on the disk, each record is looked at to determine each record's position, to determine the number of names on file to date, and to create the SECTOR/BYTE arrays for future use.
lines 2000-2504 This subroutine allows you to search for a wanted name. You can search by last name or first and last names. Using last name only allows faster execution time because less manipulations are required, but if you have ten Smith's, the first and last names will be needed to return the correct one. Otherwise, the first Smith encountered will be printed. Lines 2390-2410 look at the console keys and allow you to page through the datafile record by record. This is a nice convenience that will allow you to occasionally page through your listings and find outdated files or the names of "ex-friends" whose names you don't want any longer.
lines 4000-4055 This subroutine is used for the printer. You can print out one record at a time or you can chose to print out all of the addresses you have stored on file. You will be asked how many lines you want between records (1-9). This will allow for labels to be printed to cut down the drudgery of addressing all those Christmas cards.
 
Well, there you have it. It was fun writing this program. (Not quite as fun debugging it, but that's the price you pay if you want to write!) The Atari is truly an amazing machine. It never ceases to astonish me. As more and more programs become available, I'm sure my amazement will onIy increase. Now it's off to try to get my wife to talk to me again!