While my DATA_FILE and the associated INFOwriter, MERGEwriter, and QL_LLIST programs satisfy my own devious purposes quite well, the fixed-size data fields are not as memory-efficient as those which are marked off by de-limiter codes and vary in size according to the actual number of characters entered. I used a fixed-size string matrix because it allows much more simple access to files as well as faster search and re-order in SuperBasic.
I experimented with variable-length fields in a massive string but found the QL limits the length of each string to no more than 32765 bytes. A sequential INSTR search or a sort of several such string-array elements is unacceptably slow.
Since the only other alternative is to directly access data to and from a reserved block of memory in RAM, which is best done in machine code, rather than trying to “re-invent the wheel” it seemed to me to make more sense to make use of Archive programming. Because of the large memory overhead to store the program itself, in an unexpanded QL the creation of a simple mailing list in Archive actually allows about 50 fewer file items than in my DATA_FILE. With added RAM, however, Archive is more efficient and faster.
(By the way, if you want to add the 8 or 16 ICs needed to fully populate your Trump Card board, the 41256AP-10 chips, available from suppliers like Sabina in CA for about $1.50 each, plus $10 S & H, are easily installed. Bend the pin-rows in slightly by pressing them evenly against a flat, clean surface before insertion into the sockets next to those already filled.)
No doubt this will all be old stuff to veteran QL users, but perhaps a once-over-lightly on the steps and procedures in setting up a mail file in Archive might be helpful. Please note that < > brackets mean ENTER is to be pressed after keying in the characters that are contained within the brackets. Also, remember that it is good practice to get into the habit of always using <close> on any open file if you will be giving your attention to something else for awhile. Using <new> will perform a close and CLS as well as clearing any file from memory.
Enter <create> then <mail> to open a new file for the definition of its field labels. Since we will be using only text or string entries, all the labels will have a $ suffix. Numeric entries or expressions do not use $ in the label. After entering <create> <mail> make these label entries:
<TLFIRST$> <LASTNM$> <ADDRESS$> <PO$> <STATE$> <ZIP$> <PHONE$> (optional)
The use of separate fields for first and last names as well as for state and ZIP will allow re-ordering by last name or ZIP. Key ENTER by itself to invoke the endcreate command after the final field-name entry. This will also save these definitions to a formatted disk or mdv in drive 2. The file will remain open for entry of file data but <close> for now as we move on to writing the procedures for sorting, searching, and printing of files.
Enter <edit>, which produces a split screen with proc displayed, ready for entry of the first procedure name, which is <doprint>. This procedure prints a title (if any) and first name on the same line as last name, the address and P.O. on separate lines, then state and ZIP on the bottom line. The PHONE$ is not printed but displayed only during a search. The lprint “” line may be repeated as many times as necessary to adjust line-spacing for printing labels or a null-string input line may be used here to pause for insertion of the next envelope.
Procedures fprint and fsearch call doprint. It may also be called while in display mode to do a “snap-shot” print-out of the item currently on-screen. The forder procedure sorts a currently open file, which will be saved as re-ordered when closed, unless look mode is being used. The fprint procedure must then be called with a separate command unless you prefer to insert <forder> as the first line in the fprint procedure.
The file will be closed automatically at the conclusion of both fsearch and fprint unless N or n is keyed at the prompt. The lower(getkey()) converts either key-stroke to the lower-case character. Command-words and functions must be avoided in naming procedures, so I usually add an “f” prefix to any procedure name that accesses a file and “do” as a prefix if an action is performed on data. This allows more concise and meaningful names without conflict with Archive commands.
Enter the lines as listed for each procedure. If you see an error after a line has been entered, use the up/down cursor keys to highlight the line, then key F5 to edit it and re-enter. If insert mode is enabled, key ESC then F3 then N to commence the next procedure listing, or just F3 and N if in edit mode. F3 then C then ENTER will delete the line that is highlighted. Key SHIFT TABULATE together to backstep to a previous listing or key TABULATE to step downward. Listing indentations are supplied by Archive.
To save all procedures currently in memory key ESC (twice if in insert mode) then enter <save “dolprint”> or your own name of 8 or less characters. When Archive is booted up, procedures must be loaded in before they may be called. Use <merge “name”> instead of load to add procedures to any already in memory. Use <llist> to print out listing of all procedures currently in memory.
After saving the set of procedures that you have keyed in, key <open> then <mail> then <insert> to add data to the mail file. Key F5 to insert the data. Key ESC to exit ALTER/INSERT mode, and be sure to enter <close> before leaving Archive.
DOLPRINT LISTING
proc doline;x$
lprint x$
endproc
proc doprint
lprint TLFIRST$+" "+LASTNM$
lprint ADDRESS$
lprint PO$
lprint STATE$+" "+ZIP$
lprint ""
endproc
proc fclose
print "CLOSE will occur to protect
file unless N or n is keyed"
let yn$=lower(getkey())
if yn$<>"n": close :endif
endproc
proc forder
print "Re-order by LASTNM$ or ZIP$ (L
or Z)?"
let ro$=lower(getkey())
if ro$="l": order LASTNM$;a: endif
if ro$="z": order ZIP$;a: endif
endproc
proc fprint
all
doprint
endall
fclose
endproc
proc fsearch
cls
input "Enter search-string: ";srch$
find srch$
while found()
doprint
continue
endwhile
fclose
endproc
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.