SeekQL 2.09 – Part 1

Author(s): Al Feng
Publication: ZXir QLive Alive!
Pub Details: ZXir QLive Alive! v6 n4 (Volume 6, Issue 4)
Date: Winter 1996
Pages: 16-20

SeekQL is a stand-alone, SuperBASIC database program which is intended to also complement the Archive-based DBEasy (Wood and Wind Computing) front-end program. SeekQL is capable of writing and reading multiple files which have dedicated, user-defined and record-specific field labels; and like DBEasy, you can easily sWitch between files.

The main purpose of the SeekQL program is to create and access a simple names-and-addresses database using DBEasy compatible “_exp” files (the truth is out there) — you can either read existing DBEasy “_exp” files using SeekQL, or you can create DBEasy compatible “_exp” files.

In an effort to make the migration between the SeekQL and DBEasy database environments easier, the SeekQL program provides the user with a simplified, read-only representation of the DBEasy “single menu” record screen that I use.

The Program’s History

Several years ago, I found myself relegated to using my unexpanded, backup QL. Despite the hardware limitations, the need for a database remained. Since Archive’s programming language was too much for me to handle, I opted to write a simple, hierarchical, program (“Sbase”) that wrote-and-read a simple “_txt” file. Quill was used for editing and printing address labels. Sbase’s functionality was marginal; and I ended up relying more on Quill to both manipulate and read the file(s).

Although my hardware problems were resolved, the idea of enhancing the original Sbase program to also create “_DIF” (data interchange format?) files eventually led to the prototype for the “SeekQL” program. My brief sojourn in “Navajoland” interrupted thinking about and/or working on the program.

After the interlude, it occurred to me that the SeekQL program would have greater utility for me if it wrote/read DBEasy compatible “_exp” files.

Vestiges of the original program include the design of the “first” menu page and many of the PROCedure names. However, the “hotkey” concept employed by DBEasy is used in tandem with the “Function” keys (“F6” == “shift F1” & “F7” == “shift F2”, etc).

Using The SeekQL Program

Before you can read any database, it must exist. The directorY (press “F9” or “y”) feature which will show you all of the files having an “_exp” suffix on the medium.

If you are NOT using an existing DBEasy compatible “_exp” file then you need to Create the file that you want to access. Of course, you will want to assign a meaningful filename (8 char. max) which suggests the nature of the data or use the default (“GADDRESS” == general address).

To sWitch the name, press the “F4” or “w” key and then INPUT the database’s “new” name.

Next, you will want to establish the specific field names that will be dedicated to the “_exp” file by pressing either the “F7” (shift F2) or “s” key for the program’s Screen edit function since this will make it easier to INPUT the data.

The field label file that is generated by the SeekQL program will have a “_lbl” suffix appended to the filename you have designated.

The “_lbl” file will be automatically loaded into the program when you Open an “_exp” file from the same storage device as specified for the “_exp” file. If the “_lbl” file is missing from the storage device, none will appear on the screen. Either copy the the “_lbl” file from a(ny) source, or “screen edit” a new set of labels.

SeekQL has no editing features beyond the initial creation of various files (nnnn_exp, nnnn_lbl & LineF_eed) which makes it particularly well suited for environments where the integrity of the database is a concern (e.g., a NETwork node).

The Print selection is set up for address labels, again “sharing” the format established within DBEasy; however, it is not set up to print the “country” field. The printer output can be readily extended to any “custom” output that you might be able to generate within DBEasy by modifying the “exp_to_txt” PROCedure (LINEs 2450 to 2840).

If you want to use the address label printing function as LLISTed, then the recommended labels for the first seven fields are:

Last Name
First Name
Address
more Address
City
State
Postal Code

As with DBEasy, these are only suggestions, and you can use whatever field labels that you choose.

Now, press either the “F2” or “c” key to Create the “_exp” file. Input data that corresponds to the labels you have defined.

As with DBEASY, the presumed “date” of the RECORD is the current date (presuming the QL’s clock is correct). Whenever you have an active cursor, you can INPUT whatever date-or-data you choose.

When you have finished putting in all the data for the final record in your database and the program presents you with a new RECORD screen, then INPUT “end” in the “date” field to close the file.

The “_exp” file you have Created can now be Opened for use directly by the SeekQL program or imported into DBEasy (or, Archive, alone).

Please note that if your ROM does not process WHEN ERRor properly, and the program halts (presuming you typed it in properly), then simply type “continue” to complete the Open process if it has balked. If the program still balks, then you will also need TK2_EXTensions (see below).

In addition to use of the arrow_keys for next/back/first/last, the user has the following options:

     Find More Record Print sWitch Exit

While SeekQL’s functionality might seem limited, it includes the most used (by me, anyway) features of a database; and, the lack of extended features should make the program less intimidating and more accessible for the novice and yet provide a useful complement for the experienced (DBEasy, in particular) database user.

The Find and More search is case sensitive and defaults to lower case to provide a general search. Where appropriate, you can indicate an upper case search for proper nouns. Thus, using lower cases and the word “and” will provide find all instances of ‘and’, ‘land’, and other words containing the search string. On the other hand, using the upper case and the word “and” will not find ‘land’ but will find words such as ‘Andrew’, ‘Andover’, etc.

If you know the specific Record number, you can request it specifically.

As within DBEasy, you can sWitch between your “_exp” databases from the single record screen or from the main menu screen.

SeekQL operates in 80 column, monitor mode.

About The Program LLISTing

The program is rather long, but every attempt has been made to purge the really redundant statements.

Some statement clusters which might have been consolidated into a single PROCedure have not been to make “reading” the LLISTing a little easier.

SeekQL was designed to run on any QL — from an unexpanded QL having only microdrives to a QXL (SeekQL’s “search” and “display performance will be better with computers having faster processing speed). Well, that was the plan …

The following LLISTing works well with either MINERVA or SMSQ. No TK2_EXTensions are necessary.

For reasons that are not clear to me, yet, several adjustments to the program have been necessary to make it work with the standard JSU ROM — some of the “fixes” were minor, and some were major.

The minor changes included amending the width of BLOCKs to a maximum of only 511 (sedit, redit, Cmd_Line). The major changes relate to the on-screen display of the files, are still quirky (for example, ‘commas’ are not read to the screen) and are too lengthy to relate herein. Most serious in the “JSU” version is the fact that at the current time “find” and, “more” do not function.

If you have a JSU (or, JS) ROM, or equivalent, and feel adventurous, then you can attempt to amend the current LLISTing.

If you are using a 128K QL (i.e., with a MINERVA ROM), then you will have to change LINE 2590 to read:

     2590 DIM Z$(100,512)
or, 2590 DIM Z$(72,640)

The first number (100) is indicates the number of RECORDS the SeekQL program will read, and the second number (512) indicates the maximum amount of data that will be read from each RECORD by the program.

You also need to change LINE 2610 to:

     2610 FOR c=0 TO 102
or, 2610 FOR c=0 to 74

These are just suggestions. If you have extensive data in each RECORD then you will probably want to maintain the second number at ‘756’ and reduce the first number to ’64’ and the upper value in LINE 2610 to ’66’. If you have extensive data in each RECORDS and you have more than 64 RECORDS then you are a candidate for memory expansion. For the time being, take advantage of the program’s multi-file feature and split your data into more discrete files.

Of course, if your default storage device is not flp1_ then you also want to change LINE 210; for example, if you want to LOAD the program from mdv1_ then LINE 210 should read:

     210 Dvice$ = "mdv1_"

Also, if you do not have “ram()_” devices, then references to “ram1_” should be changed to “Dvice$” for those PROCedures to function properly.

I have actually found that WHEN ERRor is impeded on the JSU and JS ROMS when TK2_EXTensions are invoked using a 128K QL. If your QL’s ROM does not process WHEN ERRor properly then try changing LINE 2430 to:

     2430 CONTINUE

As LISTed, the program uses my default for the labels that I use if-and-when the LineF_eed file is not found on the LOADing device. Once you ascertain the proper settings for the labels you use, you should input the appropriate data in LINE 2430.

SAVE the program on a fresh medium, RESET your computer, and see if the program LOADs.

If the program still halts, then REMark LINEs 2420-2440 and 2630-2650 (i.e., the “WHEN ERRor” routines) and SAVE; but, do not omit these lines from the LISTing. Now, when the SeekQL program halts, type “continue” (and then, press the ENTER key) to proceed.

Of course, the “other” REMarked statements can be omitted. The REMarked DIM statement (LINE 80) is incomplete and has been included for reference purposes.

If you do not want to type in the program, the program is available from me for $10.00 ($10.00 is the requested SHAREWARE price — in addition to the program, you will receive sample files, and other PLATYPUS Software programs). Don’t forget to state the disk size you use, otherwise a 3.5″ disk will be sent; microdrive users should also send two formatted microcartridges.

HAPPY TRAILS,
AND COMPUTING, TO YOU …

10 REMark **********************************
20 REMark * SeekQL v2.09
30 REMark * by Al Feng
40 REMark * 914 RIO VISTA CIRCLE SW
50 REMark * ALBUQUERQUE, NM 87105
60 REMark * @ 1992-7 PLATYPUS Software
70 REMark **********************************
80 REMark DIM BLANK$(12), Dvice$(8), n$(16),
Label$(12), Sname$(16), EXTen$(5), c$(2),
cap$(2), find$(80), REC$(256), now_$(20),
Datum$(10), Mo$(16), offset$(12),
Press$(26), date_$(32), key_$(32),
s1_$(72), s2_$(72), s3_$(72), s4_$(72),
s5_$(72), s6_$(72), s7_$(72), s8_$(72),
s9_$(72), s10_$(72), n1_$(24), n2_$(24),
n3_$(24), n4_$(24), n5_$(24), n6_$(24)
90 :
100 WINDOW#0,350,32,142,220: PAPER#0,7: INK#0,0
110 WINDOW#1,512,256,0,0: PAPER#1,7: INK#1,0
120 WINDOW#2,512,256,0,0: PAPER#2,7: INK#2,0
130 :
140 OPEN#3,scr_286x92a42x20
: REMark drop_down window
150 POKE 163976,255
: REMark CAPS on
160 :
170 GR=0
: REMark 0=paper 7 1=paper 31
180 n=0: lstnm=0: s=0: lf=0: offset=1
190 :
200 Blank$ = " "
: REMark 12 spaces
210 Dvice$ = "flp1_"
: REMark default data device
220 EXTen$ = "_exp"
: REMark Filename EXTension
230 Find$ = "NULL"
240 Label$ = "SeekQL 2.09"
: REMark program name
250 Sname$ = "GADDRESS"
: REMark default file name
260 Press$ = "PRESS [Any_Key] to CONTINUE"
270 :
280 Pre
: REMark opening screen
290 Adjust_Printer
300 offset$= Blank$(1 TO offset)
310 menu
: REMark menu screen
320 :
330 DEFine PROCedure bop: BEEP 300,30: END DEFine
340 DEFine PROCedure stripe: STRIP 7: INK 0:
END DEFine
350 DEFine PROCedure FndBlnk: Find$="":
BLOCK 330,12,172,220,7: END DEFine
360 DEFine PROCedure CLStrip: BLOCK 340,10,0,10,7:
END DEFine
370 DEFine PROCedure CLPart: BLOCK 500,60,0,21,7:
END DEFine
380 DEFine PROCedure CLScreen:
BLOCK 500,220,0,21,7: END DEFine
390 :
400 DEFine PROCedure Pre
: REMark Opening
410 CLS: CLS#2
420 AT #2,20,5: PRINT#2,Label$;TO 20;
"by Al Feng"TO 5;"@ 1997 PLATYPUS Software"
430 FOR n=2 TO 7: AT#2,21,10: PRINT#2,n: PAUSE 8:
NEXT n
440 END DEFine Pre
450 :
460 DEFine PROCedure datum
470 LET now$=DATE$
480 IF now$(6 TO 8)="Jan" THEN Mos$="01"
490 IF now$(6 TO 8)="Feb" THEN Mos$="02"
500 IF now$(6 TO 8)="Mar" THEN Mos$="03"
510 IF now$(6 TO 8)="Apr" THEN Mos$="04"
520 IF now$(6 TO 8)="May" THEN Mos$="05"
530 IF now$(6 TO 8)="Jun" THEN Mos$="06"
540 IF now$(6 TO 8)="Jul" THEN Mos$="07"
550 IF now$(6 TO 8)="Aug" THEN Mos$="08"
560 IF now$(6 TO 8)="Sep" THEN Mos$="09"
570 IF now$(6 TO 8)="Oct" THEN Mos$="10"
580 IF now$(6 TO 8)="Nov" THEN Mos$="11"
590 IF now$(6 TO 8)="Dec" THEN Mos$="12"
600 LET date_$ = now$(3 TO 4) & "/" &
Mos$(1 TO 2) & "/" & now$(10 TO 11)
610 END DEFine
620 :
630 DEFine PROCedure sedit
640 PAPER 7: CLS
650 BLOCK 512,40,0,0,2
660 redit
670 END DEFine sedit
680 :
690 DEFine PROCedure redit
700 BLOCK 512,20,0,236,0
710 BLOCK 400,110,100,45,0
720 BLOCK 150,40,100,162,0
730 BLOCK 150,40,350,162,0
740 END DEFine redit
750 :
760 DEFine PROCedure labels
770 BLOCK 86,160,10,45,7: BLOCK 86,40,260,167,7
780 stripe: ShowLabel
790 FOR m=1 TO 10
800 AT 4+m,2: PRINT L$(m)
810 NEXT m: END FOR m
820 FOR m=11 TO 13
830 AT 6+m,2: PRINT L$(m)
840 NEXT m: END FOR m
850 FOR m=14 TO 16
860 AT 3+m,44: PRINT L$(m)
870 NEXT m: END FOR m
880 END DEFine
890 :
900 DEFine PROCedure ShowLabel
910 DIM L$(16,11)
920 OPEN_IN#5,Dvice$ & Sname$ & "_lbl"
930 FOR m=1 TO 16
940 IF EOF(#5) THEN EXIT m
950 INPUT#5,L$(m)
960 END FOR m: CLOSE#5
970 END DEFine
980 :
990 DEFine PROCedure MakeLabel
1000 CLS: sedit
1010 OPEN_NEW#5,Dvice$ & Sname$ & "_lbl"
1020 AT 5,2: PRINT Blank$: AT 5,2: INPUT s1$:
IF LEN(s1$)>12 THEN GO TO 1020
1030 AT 6,2: PRINT Blank$: AT 6,2: INPUT s2$:
IF LEN(s2$)>12 THEN GO TO 1030
1040 AT 7,2: PRINT Blank$: AT 7,2: INPUT s3$:
IF LEN(s3$)>12 THEN GO TO 1040
1050 AT 8,2: PRINT Blank$: AT 8,2: INPUT s4$:
IF LEN(s4$)>12 THEN GO TO 1050
1060 AT 9,2: PRINT Blank$: AT 9,2: INPUT s5$:
IF LEN(s5$)>12 THEN GO TO 1060
1070 AT 10,2: PRINT Blank$: AT 10,2: INPUT s6$:
IF LEN(s6$)>12 THEN GO TO 1070
1080 AT 11,2: PRINT Blank$: AT 11,2: INPUT s7$:
IF LEN(s7$)>12 THEN GO TO 1080
1090 AT 12,2: PRINT Blank$: AT 12,2: INPUT s8$:
IF LEN(s8$)>12 THEN GO TO 1090
1100 AT 13,2: PRINT Blank$: AT 13,2: INPUT s9$:
IF LEN(s9$)>12 THEN GO TO 1100
1110 AT 14,2: PRINT Blank$: AT 14,2: INPUT s10$:
IF LEN(s10$)>12 THEN GO TO 1110
1120 AT 17,2: PRINT Blank$: AT 17,2: INPUT n1$:
IF LEN(n1$)>12 THEN GO TO 1120
1130 AT 18,2: PRINT Blank$: AT 18,2: INPUT n2$:
IF LEN(n2$)>12 THEN GO TO 1130
1140 AT 19,2: PRINT Blank$: AT 19,2: INPUT n3$:
IF LEN(n3$)>12 THEN GO TO 1140
1150 AT 17,44: PRINT Blank$: AT 17,44: INPUT n4$:
IF LEN(n4$)>12 THEN GO TO 1150
1160 AT 18,44: PRINT Blank$: AT 18,44: INPUT n5$:
IF LEN(n5$)>12 THEN GO TO 1160
1170 AT 19,44: PRINT Blank$: AT 19,44: INPUT n6$:
IF LEN(n6$)>12 THEN GO TO 1170
1180 PRINT#5, s1$s2$s3$s4$s5$s6$s7$
s8$s9$s10$n1n2$n3$n4$n5$n6$
1190 CLOSE#5
1200 END DEFine
1210 :
1220 DEFine PROCedure MakeFile
: REMark create File
1230 sedit: labels
1240 OPEN_NEW#5,Dvice$ & Sname$ & EXTen$
1250 STRIP 2: INK 7
1260 AT 1,2: PRINT "Using : ";Sname$ & EXTen$
1270 datum
1280 AT 2,2: PRINT " Date : ";date_$
1290 AT 2,40: PRINT "Key : "
1300 IF xyz<1 THEN PRINT#5,'"date_$","key_$",
"s1_$","s2_$","s3_$","s4_$","s5_$","s6_$",
"s7_$","s8_$","s9_$","s10_$","n1_","n2_",
"n3_","n4_","n5_","n6_"': xyz=xyz+1: END IF
1310 AT 2,10: INPUT now_$
1320 IF now_$="" THEN datum: date_$=date_$:
ELSE date_$=now_$
1330 AT 2,10: PRINT date_$;Blank$
1340 IF date_$ == "END" THEN GO TO 1370
1350 IF date_$ <> "END" THEN add_Name
1360 GO TO 1250
1370 PRINT#5,CHR$(26)
1380 CLOSE#5: GR=0: date_$ = "": menu
1390 END DEFine
1400 :
1410 DEFine PROCedure add_Name
: REMark continue create
1420 BLOCK 240,10,270,20,2
1430 AT 2,46 : INPUT key_$
1440 STRIP 0: INK 5
1450 AT 5,19: INPUT s1_$
1460 AT 6,19: INPUT s2_$
1470 AT 7,19: INPUT s3_$
1480 AT 8,19: INPUT s4_$
1490 AT 9,19: INPUT s5_$
1500 AT 10,19: INPUT s6_$
1510 AT 11,19: INPUT s7_$
1520 AT 12,19: INPUT s8_$
1530 AT 13,19: INPUT s9_$
1540 AT 14,19: INPUT s10_$
1550 AT 17,19: INPUT n1_$: IF n1_$=""
THEN n1_$="0": END IF : FOR h=1 TO LEN(n1_$):
IF n1_$(h)>CHR$(57) OR n1_$(h)<CHR$(48)
THEN bop: n1_$="0": END IF : NEXT h: END FOR h
1560 AT 18,19: INPUT n2_$: IF n2_$=""
THEN n2_$="0": END IF : FOR h=1 TO LEN(n2_$):
IF n2_$(h)>CHR$(57) OR n2_$(h)<CHR$(48)
THEN bop: n2_$="0": END IF : NEXT h: END FOR h
1560 AT 19,19: INPUT n3_$: IF n3_$=""
THEN n3_$="0": END IF : FOR h=1 TO LEN(n3_$):
IF n3_$(h)>CHR$(57) OR n3_$(h)<CHR$(48)
THEN bop: n3_$="0": END IF : NEXT h: END FOR h
1580 AT 17,61: INPUT n4_$: IF n4_$=""
THEN n4_$="0": END IF : FOR h=1 TO LEN(n4_$):
IF n4_$(h)>CHR$(57) OR n4_$(h)<CHR$(48)
THEN bop: n4_$="0": END IF : NEXT h: END FOR h
1590 AT 18,61: INPUT n5_$: IF n5_$=""
THEN n5_$="0": END IF : FOR h=1 TO LEN(n5_$):
IF n4_$(h)>CHR$(57) OR n5_$(h)<CHR$(48)
THEN bop: n5_$="0": END IF : NEXT h: END FOR h
1600 AT 19,61: INPUT n6_$: IF n6_$=""
THEN n6_$="0": END IF : FOR h=1 TO LEN(n6_$):
IF n6_$(h)>CHR$(57) OR n6_$(h)<CHR$(48)
THEN bop: n6_$="0": END IF : NEXT h: END FOR h
1610 PRINT#5,'"';date_$;'","';key_$;'","';s1_$;
'","';s2_$;'","';s3_$;'","';s4_$;'","';s5_$;
'","';s6_$;'","';s7_$;'","';s8_$;'","';s9_$;
'","';s10_$;'",';n1_$;',';n2_$;',';n3_$;',';
n4_$;',';n5_$;',';n6_$
1620 STRIP 2: show_key: redit: END DEFine
1630 :
1640 DEFine PROCedure sWatch
1650 bop: AT 24,22: INK 2: PRINT Blank$; CHR$(188);
CHR$(188); CHR$(188); Blank$(1 TO 5)
1660 AT 24,10: INK 7:
INPUT'NEW Filename : ";Sname$
1670 IF Sname$="" THEN Show_DIF
1680 IF LEN(Snames)=0: Sname$="GADDRESS":
BEEP 100,10
1690 IF LEN(Snames)>8: Sname$="GADDRESS":
BEEP 2000,20: GO TO 1650
1700 Find$="NULL"

Tags

People