(c)1984 PSION LIMITED
According to Webster’s Ninth New Collegiate Dictionary, “data-base n (1967): a collection of data organized especially for rapid search and retrieval (as by a comuputer)”.
According to the QL User Guide, “QL Archive is a database program which enables you to create filling systems for any type of information you choose”.
As many of you know, QL-Archive (QLDB) is one of four programs given free with the purchase of a Sinclair QL. It is perhaps the most difficult of the three to program (but not to use). The everso powerful command structure and programming language within Archive can give the ‘un-taught’ user many fitful moments.
Before starting, the program we will be using comes straight from the QL User Guide (Chapter 10, page 21) and therefore is directly aimed towards the new user. This tutorial, will hopefully enlighten non-Archive users to realize the potential they have when given the proper tools for programing (like Archive).
We will, however, be giving the particular program somewhat of a face lift. A few tricks learned from QL World magazine will be used to give our program some flare.
First, let us start by creating a card index (Rolodex??). “An Archive file behaves rather like a card index. A real card index consists of a box containing a set of record cards, each card contains various items of information”. In this case, the ‘box’ represents the most important part of any data base, the data base file (DBF). Technically speaking, without the DBF, there really would not be any data base. The DBF contains all the pertinent information which the data base program uses.
Load Archive as per the QL User Guide (versions 2.01, 2.30, 2.30RTM, 2.38 and 3.87 Turbo are all supported). To ‘CREATE’ the DBF, we must first specify all the fields each record will use. To accomplish this, enter the following as shown:
CREATE "mail" <PRESS ENTER>
This places you in sort of a DBF editor. Archive expects you to input the titles of every field needed for your DBF. Knowing this, enter the following:
TITLE$ <PRESS ENTER> FIRST_NAME$ <PRESS ENTER> LAST_NAME$ <PRESS ENTER> ADDRESS$ <PRESS ENTER> CITY$ <PRESS ENTER> STATE$ <PRESS ENTER> ZIP_CODE$ <PRESS ENTER> TELEPHONE$ <PRESS ENTER> ISSUES_DUE <PRESS ENTER> MONTH_DUE$ <PRESS ENTER> YEARLY_DUES$ <PRESS ENTER> PAYMENT_INFO$ <PRESS ENTER> USERGROUP$ <PRESS ENTER>
When all typed in and complete, press <ENTER> to activate the ‘ENDCREATE’ command. This will notify Archive you have finished your input to create a DBF (which you’ve just created). Please take note, your DBF is presently open and will remain so until you ‘CLOSE’ it. The
To view your newly created DBF, type ‘DISPLAY’. You will see a blank record with just the field names. Upon closer scrutiny, you will notice the field ISSUES_DUE does not have a ‘$’ following it. To Archive, the ‘$’ represents an open string. This means you can mix characters and numbers all on the same line. Without the ‘$’, Archive expects numeric values only.
Let us explian the fields that represent your DBF. The TITLE$ field is designed for official titles, ie Dr, Mr, Mrs, etc. The ISSUES_DUE field represents the total number of issues (newsletters) due the member. The MONTH_DUE$ gives the month and year the member needs to renew his/her membership. The YEARLY_DUES$ is used to display the amount paid by the member for his/her membership. To record the check number, cash amount, date received, etc, the PAYMENT_INFO$ field is used. Finally, the USERGROUP$ field allows information about members who live outside the local area and just pay dues to receive the newsletter. Normally, these members officially belong to another group.
I am sure your fingers must be getting antsy, so let’s ‘CLOSE’ our DBF and begin designing the mailing list program (type ‘CLOSE’ and press <ENTER>).
The following requirements are needed to accomplish our goal:
Add a new member to the DBF Output all records to printer Record membership payments Modify a members record Delete a members record Order the DBF Exit/Quit the program
explaination of each procedure module is best described within the QL User Guide. Type ‘EDIT’ and press <ENTER> to input the listing given. Follow the instructions.
The procedure ‘BORder’ gives us an ASCII border around the main menu by using ‘CHR(XX)’ codes. It was mentioned in QL World that Archive has this available. However, the author stated he could not find documents to support this except in PSION’s PC-FOUR program (IBM’s version of the QL’s bundled software AND it costs almost $100.00, hah!). So, he experimented and found the coding was duplicated within the QL’s version of Archive. Even though the affect is the same, the ASCII characters do not corespond to the ‘CHR’ numbers. Plus, the IBM ASCII character set is only half given for QL-Archive. But this does not stop us from (ab)using it.
The SCR procedure allows a 3-D or shadowing effect. The shadow will of course display as black. The actual paper with the menu will be colored red. And the background will show as green. If you do not like the green background, change the ‘CHR(4)’ in the first line to ‘CHR(7)’ for white (also alter the REM statement to reflect the change)
The WINDOW procedure really is sort of a clear screen (or clear window). The CHR(12) gives a form feed. The command line before it makes sure the window remains red in color.
When your program is all typed in, do not forget to save it. While in the procedure ‘EDIT’ mode, press <ESC>, then enter:
SAVE "MAILLIST" <PRESS ENTER>
proc BORder
print tab 8;chr(234);chr(4)+chr(231)+chr(40);chr(226)
print tab 8;chr(235);chr(4)+" "+chr(40)+chr(235)
print at 2,19;"TIMELINEZ MEMBERSHIP"
print tab 8;chr(230);chr(4)+chr(231)+chr(40);chr(225)
let A=0
while A<11
print tab 8;chr(235);chr(4)+" "+chr(40);chr(235)
let A=A+1
endwhile
print tab 8;chr(227);chr(4)+chr(231)+chr(40);chr(233)
endproc
proc bye
close
print "bye"
paper 0: mode 8,0: cls
stop endproc
endproc
proc change
rem ***** alter record *****
let n$="x"
cls
while n$<>""
getrec
if ok$="y"
alter
paper 2: cls
endif
endwhile
endproc
proc choose
rem ***** choose an option *****
print at 4,15;"SELECT OPTION"
print at 6,18;"[A]dd a member"
print at 7,18;"[D]espatch to printer"
print at 8,18;"[P]ay on account"
print at 9,18;"[C]hange a record"
print at 10,18;"[W]ipe a record"
print at 11,18;"[O]rder a file"
print at 12,18;"[Q]uit program"
print at 14,15;"CHOICE? ";
let choice$=lower(getkey())
if choice$="a": insert :window:BORder: endif
if choice$="d":despatch:window:BORder: endif
if choice$="p":pay:window:BORder: endif
if choice$="c":change:window:BORder: endif
if choice$="w":wipe:window:BORder: endif
if choice$="o": order last_name$;a: update :window:border: endif
if choice$="q":bye: endif
endproc
proc despatch
cls
all
dolabel
endall
endproc
proc dolabel
rem ***** print labels *****
if issues_due
if issues_due=1
doline;"REMINDER - Subscription Now Due"
else
doline;""
endif
doline;" "+month_due$
doline;title$+" "+first_name$+" "+last_name$
doline;address$
doline;city$+", "+state$+" "+zip_code$
let issues_due=issues_due-1
update
endif
endproc
proc doline;x$
lprint x$
endproc
proc getrec
rem ***** locate a particular record *****
cls
let ok$="n"
input "who? ";n$
if n$<>""
find n$
while ok$<>"y" and found()
print
print title$;" ";first_name$;" ";last_name$
print address$
print
print "OK (y/n)? ";
let ok$=lower(getkey())
cls
if ok$<>"y"
continue
endif
endwhile
if not found()
print
print n$;" not found"
endif
endif
endproc
proc pay
rem ***** record subscription payment *****
cls
let n$="x"
while n$<>""
getrec
if ok$="y"
let issues_due=issues_due+6
update
endif
endwhile
endproc
proc SCR
print chr(2)+chr(4):REM GREEN PAPER
print chr(12):REM FORM FEED = CLS
print chr(20)+chr(12)+chr(4)+chr(69)+chr(21)
print chr(2)+chr(0):REM BLACK PAPER
print chr(12):REM FORM FEED
print chr(20)+chr(10)+chr(3)+chr(67)+chr(20)
print chr(2)+chr(2):REM RED PAPER
print chr(12):REM FORM FEED
endproc
proc start
rem ***** start procedure *****
mode 0,0: cls
ink 7
SCR
BORder
open "mdv2_mail"
while 1
error choose
let n=errnum()
if n
print "Mistake - Press any key to continue"
let m$=getkey()
endif
endwhile
endproc
proc window
print chr(2)+chr(2)
print chr(12)
endproc
proc wipe
rem ***** delete non-paying subscribers *****
cls
display
select issues_due=0
all
sprint
print at 15,0;"Delete (y/n)? ";
let ok$=lower(getkey())
print ok$
if ok$="y"
delete
print "DELETED"; tab 15
else
print tab 15
endif
endall
reset
endproc
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.