TS-2068 Program “Dbx.B6” A software for RECORD Keeping

See all articles from Update July 1990
Author(s): Bill Jones
Publication: Update Magazine
Pub Details: Update July 1990
Date: July 1990
Pages: 18-24

“”Dbx.B6″” is a New “Record Data Base” Software that takes advantage of the MERGE function to conserve FREE MEMORY and thus provide the largest data base ever before created with the TS-2068. In addition, there is a word processor included, “Search and Find”, and the most versatile of Sorting choices ever before offerred. There are four programs to key in. Dbx.B6 is the main program. As it operates two other programs are automatically MERGED when needed by the function in progress. “sort.B6” MERGES when SORT is selected at menu. “Init.B6” is MERGED when the Dbx.B6 program is first RUN. “ml6.B6” is the MENU that is saved to Disk to be loaded each time the program needs the menu. A fifth program “var.B6” is given to be used only once to initialize a set of variables used in the main program.

Actually, Dbx.B6 evolved from an earlier program called “Mail Merge”. Most of the Mail Merge functions were upgraded and expanded and more lattitude of sorting was added. The addition of more sorting choices makes Dbx.B6 a software that is adaptable for just any type of records that one may need to create and manage. Some typical types of records are: Telephone lists, Mailing Lists, Inventory lists, Disk Library, Audio Tape Library. It can even be used for such diverse purposes as Invoices, or Daily Diary. If you can think of any type of records needing from one to 50 lines or more, this program will create and manage the records. The data capacity is enoromous by TS-2068 standards. A Telephone list having single line records of 28 chrs can be built to over 1000 names.

Other examples: A Seven Line Record for use as a combination Mail File with 2 lines for notes can be built up to over 130 records. A smaller Mail File having 4 lines of 31 characters each can reach over 240 records in length. A 5 line invoice of 60 chrs per line can be as large as 100 customers. A 3 line by 20 chr INVENTORY FILE can hold up to 500 records. The SIZE of the RECORDS determines the maximum number of records, and the user sets up the Record dimensions. SORTING CHOICES are by any line, and by “First or Last” group within the line. When the records are Sorted each record remains intact and the records are lined up by the sorted line. Example: a mail file can be sorted by either LAST NAME or by Zip Code. A Stock List can be sorted by NOUN or by Stock Number. IF there are 10 record lines there are 20 sorting choices.

Print Out of the records is controlled by menu choice. Whole records may be printed or partial records. For example, the Mail List that is used for Update Magazine has 7 lines per record. The first four are Name and Address, the fifth is the person’s first name as “Dear John,” and lines 6-7 are information lines. To print LABELS, we elect to print-out the first four lines. Then prompts ask for “TAB and Spaces Between”. Such control allows any size label to be printed. For just paper print of listings prompts guide the set-up of printing so that pages of listings are printed without over-running the page separations.

The Menu offers a “SEARCH” option. The “Search Word” is input, and prompts ask for the “Line to Search”. Input “Danka” and the first record to have Danka is presented on screen. We can continue for more Dankas, or elect to Quit to Menu. Dbx.B6 has a management protocol that lets the user use any numer of disk drives from one to four. Prompts allow different drives to be used for data files and the program itself. Data files are SAVED and LOADED by discrete “numbered files” for best orientation of record files management.

Dbx.B6 is programmed 100% in BASIC. If mistakes are made during operation the program interrupts with a REPORT CODE at the bottom of screen. There are two “GO TO” solutions to operator error. The one to use during a SORT operation is <GO TO 1974>. Line 1974 DELETES the sorting program (if on board) and re-constructs the main “Dbx.B6” program, then presents the main Menu. If a report code comes during operation in any mode EXCEPT SORTING, <GO TO 2000> resumes operation. These two corrective <GO TOs> should be posted somewhere until you have operated the program enough to remember them. Just remember that REPORT CODES come only after a MISTAKE in operation, mostly from entering the wrong DISK Number. A line number where the mistake occurred will be given in the report code.

Most often, after a report code, you can LIST the line number and see that a <GO TO> the previous line number will resume operation at that point. A study of the main Menu given at the end of this article will be helpful at this point. *** See Menu *** We have dwelled upon Report Codes too much really. The program is FRIENDLY and easy to operate. After Key-in of the five programs DO NOT RUN the program to get it started, instead <GO TO 1804>. The Dbx.B6 program SHOULD NOT be Saved to Auto Run unless you want to create a separate Auto Run Loader. This is because during operation the main program is actually Destroyed when SORT is ordered by menu selection. Then when SORTING has completed the sort program is DELETED, and the Dbx.B6 program is MERGED BACK. If the Dbx.B6 program were saved to Auto Run this process would be thwarted.

A typical AUTO LOADER that you might use to Load and Run this program is: <10 RANDOMIZE USR 100:LOAD “Dbx.B6”: GO TO 1804>. Then SAVE this one line auto loader by the direct command: <RANDOMIZE USR 102: GO TO 10>. When the music plays touch s. This is for LKDOS Systems. All of the SAVE and LOAD functions are given in LKDOS syntax. For other systems the SAVE, MERGE, and LOAD lines should be edited and changed in syntax to that needed by the DOS in use. Some DOS does not support MERGE. For those systems ALL of the lines having DELETE and MERGE should be edited to remove the DELETE and MERGE. But KEEP the GO TOs. This way will result in a larger program that remains in TS-2068 memory and has a reduction in maximum RECORD capacity of about 15%.

The Key-in Tutorial

We’ll use the key in project as a tutorial. DID YOU KNOW that Sinclair Computer have “BUILT IN SORTING” capability? Well, dont be ashamed as most users dont know that. The Sinclair ROM has a sophisticated SORTING function built in. All we need to do is manage it with Basic Programming. Lets learn to do this in a simple fashion. Type these direct commands from the keyboard. 1. <LET A$=”ABC Benjamin Franklin and Joe Smutz” ENTER>. 2. <LET B$=”Ben Franklin” ENTER>. Now we have two lines of data entered that can be SORTED. It would appear that “A$ is LARGER then B$”, now wouldn’t it? But instead, “B$ is LARGER”. At least it is “to the Sinclair ROM”, because A$ begins with lower number characters than does B$. Lets prove it. 3. Type: <IF A$<B$ THEN PRINT A$ ENTER>.

The data in A$ will print to screen because the ROM has SORTED the two data lines. So despite the fact that the A$ data is much “longer” than the B$ data, “A$ is Smaller”. If this is news to you then you should monkey around entering different data in A$ and B$ and see how the ROM evaluates the two data lines. Actually you can see HOW the Rom COMPARES data by looking at the user manual pages 239-245. Each Character is assigned a numbered CODE for the ROM to evaluate. “PRINTABLE” characters range between CODE 32 (space) to CODE 122 (z). The ROM sorting priority (order) is the order of the character CODE Numbers. Since we wont be sorting “non printable” characters, we will trap out all codes BELOW 32 and ABOVE 122, and just ask the ROM to sort PRINTABLE CHARACTERS by comparing one data line with another.

Dbx.B6 will assume that no record line should begin with an empty space and discard the line if it does. We will set up a SORTING system that lets us choose to sort by GROUPS WITHIN A LINE- first group in the line, or LAST group within the line. Then we will choose which line to sort the records with. Lets look at a couple of examples: A Telephone List would be a set of records having only one line, such as, “Mr. George W. Washington Jr. 942 466 9223”. We could sort by “First Group”, but that wouldn’t do anything intelligent to sort by “Mr.”. Or, we could sort by “LAST GROUP” and sort by tel numbers, another exercise in folly!.

Lets fix the line so that it can be sorted. Change it to: “Washington,Jr Mr. George W.” See what we have done? We put LAST NAME FIRST in the lines to be sorted and the telephone list can be sorted by entering “Sort By First Group”. Then if we enter all of the names “last name first” we can let the ROM compare all “First Groups” of the lines and sort them. Also, in managing the records you’ll want to keep the lines as short as practical. So some abbreviations of long names may be in order, as “Washington,Jr Geo W. 6494448222”. That will trim the line to 31 characters. By shortening the lines and keeping within the bounds you can make much longer record files.

Another Example: A Mail file of records is constructed using 5 lines. Four lines are used for name and address, the fourth line containing “STATE and Zip Code”. The fifth line will be the person’s FIRST NAME to use for picking off in a letter (Dear John,). You will want the first line of Mail files to sort, and if you are doing Bulk Mail, you’ll also want to sort byZip Code. A typical First Line: “Mr. George W. Bush,Jr.”. Note that the only practical sort for the first line would be “LAST GROUP” or <Bush,Jr>. Also note that the space has been removed between “Bush Jr.”. We wouldn’t want to sort “Jr.”, eh?. Sorting by LAST GROUP could also be accomplished with LINE 4 to sort by ZIP CODE. Canadians use a hyphen between the twin postal codes. To sort by Zip Code you would enter <Line 4> <LAST GROUP>.

An EXAMPLE of an INVENTORY Record FILE: Line 1 could be “noun and Stock Number”. Line 2 could be “Dollar value and ON HAND number”. Sort by first group of line 1 for a line up by noun. Sort by Last Group of line 1 for a stock number sort. Sort by first group of line 2 to get Inventory Value, or last group of line 2 to get On Hand Levels (for re-order information). As you can see, there is a certain amount of discipline required to be consistant with the format for entering LINE data in a record data base.

The speed of Sorting is (in my opinion) not a critical criteria for a useful data base program such as Dbx.B6. One spends days working on a large Record Data Base. Sorting is needed only once, when the record file input has been finished for the day. Sorting with BASIC is indeed slow. But by comparison with the data input chore, sorting is fast. As a bench mark, I sorted a record file having 100 records of 7 lines and 31 characters per line. It was a Zip Code Sort, which requires more time than a “first group” sort. The sort was accomplished in 57 minutes. The length of time required to sort depends upon the variable factors of Total number of Records, and the number of fields (lines) in the records, and whether sorting by “First or Last” group within the sort line.

Later, in another issue of Update Magazine I will give you a fast Machine Code program to key in that will do the sort function in about 10 seconds. But for now lets do it in BASIC and learn something about sorting techniques. The act of keyin in the program should be educational, and when finished you’ll have the best RECORD DATA BASE program ever done for the TS-2068.

Also a Daisy.B6 Annex Program

The Dbx.B6 program and its Sort annex is operated as satelite programs from the Daisy.B6 software. Dbx.B6 is MERGED to Daisy by Menu elective to create and manage record data bases to be integrated within Text print-out products. Also, Daisy uses the Dbx.B6 data base files (without Dbx.B6 being on-board) for Mail Merge purposes to print personalized form letters to the mailing list. Other types of Dbx.B6 data base record files can be print processed within Text files (or alone) by the Daisy software. The maximum size data base that can be created by Dbx.B6 (when it is MERGED into the Daisy environment) is reduced by the size of other Daisy data bases that may be present. ** Other Basic Programs may be MERGED to the Dbx.B6 program and operated, as long as the line numbers of the Merged program do not overlay the Dbx.B6 program lines.

Typically, a letter data base can be present in the daisy program and still allow about 100 mail files to be created, or loaded from disk. When creating records with the Dbx.B6 program to be later used with the Daisy software, one should bear in mind that the files must be kept within maximum bounds of total Memory used. A good rule of thumb would be to keep the Record Dimensions within a boundary of about 10K of memory usage, which would accommodate a mail file of about 60 records of 5 lines and 31 characters. Then such a record data base could “co-reside” in the Daisy program with other files to be “mix printed”.

The Key in Project

Start the key-in project by FORMATTING a new Disk to have ready for the SAVES. Key in each of the five programs and save each one separately with the file name given. Take your time in doing the key in. Dont just have the goal of finishing, but study the program lines as they are keyed in. Such study is more valuable than a manual to learn what will be taking place as the program operates. And, you might learn some of my unorthodox methods of programming while you are at it. It will likely take several days of work to get it all keyed in, so SAVE your work often. Now we will discuss each of the five programs individually.

The “Dbx.B6” Program

The Dbx.B6 program contains the Menu call and all of the functions EXCEPT SORTING. It is also a CONTROL program that DELETES itself before MERGING the Sort Program. It also MERGES the Init.B6 program as needed to set the LKDOS system and Set the Printer to one of three print styles. Dbx.B6 is organized to keep FREE MEMORY at maximum by using DELETE and MERGE.

The “Init.B6” Program

The “Init.B6” program MERGES in when needed to provide the initialization of the LKDOS system for the type of interface in use. It also contains a menu for PRINTER STYLE set-up. The Printer Style changes are programmed for an Epson Compatable Printer, the Panasonic KXP 1124. The program line # 1996 will likely need editing and change of the OUT commands for a different type of printer than the KXP 1124. A temporary measure can be taken to by-pass the PRINTER SET function and just use MANUAL Settings at the printer itself. To do so place a REM after line numbers 1996 and 1997. Then you can set your printer to the Print Style needed and the software wont command the printer at all.

Two of the programs are not used at all by the Dbx.B6 operating program, but are necessary to key in and use “BEFORE” running the Dbx program. These are:

The “var.B6” Program

Key in the var.B6 program and save it with the name “var.B6”. Then LOAD the “Dbx.B6” program from disk and do the following: Type <GO TO 1976 ENTER>. This results in the var.B6 program MERGING, the vars being initialized, and then the var.B6 program is DELETED, never to be needed again. But later, if you want to add more functions to the Dbx.B6 program and use more variables you can add new vars to the var.B6 program and type <GO TO 1976> to add the vars to an operating program.

The “Menu.B1” Program

Type in the “Menu.B1” program. This program’s only purpose is to CREATE the Menu in a Disk Screen File, to be loaded to the Dbx.B6 program when the menu is needed. This menu would normally take up about 900 bytes of FREE MEMORY, reducing the total data capacity by several records. When the Menu is saved to disk it is called up as needed using only 10 bytes of programming. After keying in the Menu.B1 program type RUN. The menu will appear on screen. Compare it with the printed Menu SAMPLE for correctness. If the menu is the same as the Sample, then type <CONTINUE ENTER> and it will be SAVED to disk. The following help is given for keying in the graphics characters.

In line 9998 the first group is gotten (after the Quote) by using CAPS SHIFT 9 to shift into GRAPHICS, then SHIFT 3 three times, followed by SHIFT 2, then SHIFT 9 to get out of Graphics. Then later in the same line, the second group of graphics characters are entered by, using CAPS SHIFT 9 for graphics, then SHIFT 3 three times, followed by SHIFT 2, then SHIFT 9 to get out of graphics. The third graphics group is gotten by SHIFT 9 to start graphics, then SHIFT 1, followed by SHIFT 3 nine times. Then SHIFT 9 to get out of graphics.

Challange to Math Programmers

This suggestion is for our MATH Expert programmers (How about it Warren!”). Such a data base program as Dbx.B6 can be ammended to have quite a powerful “VIEW CALC” annex far beyond the capabilities of the old PSION View Calc Program. The DEF FN function could be used for base formulas. The annex program could be MERGED as needed to use the DEF FN formulae to calculate from figures given in one of the lines of the data base. The MERGE annex could be arranged to do the following: 1. Elect the record line to exercise a formula. 2. Elect the record line to RECEIVE the results of the Calc. 3. Exercise the formula and deposit the results in the receiving line.

Example: a DEF FN formula has been added to the main program to “calculate the value of “B” when “A” is given”. Line #4 of the data base contains the value of “A”. The program picks off the value of “A” from line 4, performs the calc and then deposits the value of “B” in line 5. Perhaps this will give someone ideas. As for me, I’m not sharp enough on mathematics to create such an annex.


The Dbx.B6 is offerred as an ISSUE DISK in LKDOS 40 or 80 Track Format (5 1/4″ Disk) ready to operate. But I encourage all who want to learn something about Basic Programming to key the programs in for the educational value. Then in a latter issue we will add the faster MC sorting functions. _BJ-

The ISSUE DISK

To Receive the Dbx.B6 ISSUE DISK, send $22.00 to: Update Magazine, 513 E. Main St., Peru, IN 46970. Available for LKDOS in either 3 1/2″ or 5 1/4 inch diskette, formatted either 40 or 80 tracks. Specify Drive Size and Format.


"Dbx.B6" The Main Data Base Program, lines 1800-2004 (listing)
"Dbx.B6" The Main Data Base Program, lines 1800-2004 (listing)
"Dbx.B6" The Main Data Base Program, lines 2005-2050 (listing)
"Dbx.B6" The Main Data Base Program, lines 2005-2050 (listing)
"Dbx.B6" lines 2050-2056 and "sort.B6" The Sorting Program, lines 1810-1911 (listing)
"Dbx.B6" lines 2050-2056 and "sort.B6" The Sorting Program, lines 1810-1911 (listing)
"sort.B6" lines 1912-1975 and "var.B6" The Variable File Program (listing)
"sort.B6" lines 1912-1975 and "var.B6" The Variable File Program (listing)
"Init.B6" The LKDOS Initialization And Print Style Menu Program, and "Menu.B1" The Program to Construct the Menu (listing)
"Init.B6" The LKDOS Initialization And Print Style Menu Program, and "Menu.B1" The Program to Construct the Menu (listing)

Key the two program lines in and then <RUN>. The Menu will present itself on screen and a STOP will occur. Examine the screen for balance and compare it with the printed screen below. If there is a report code or if the menu isn’t shaped like the sample, then correct your work and <RUN> again. When satisfied, type <CONTINUE ENTER> and the menu will be SAVED to disk. After the SAVE you can delete the program, as we dont need it anymore. Or, if you wish you may SAVE it as a Basic help utitlity for constructing other menus.

The Menu Sample

The Menu Sample
The Menu Sample

The Menu Auto Loads as Needed

When we need the menu the program pulls it in from disk with a line command <RANDOMIZE USR 100: LOAD “ml6.C1″SCREEN$>. Such menus “left in RAM” would drastically depreciate the “record capacity” of the software. This one menu, if left in RAM, would reduce the number of records possible to generate by 24 records (A One line record of 31 characters). Some softwares NEED as many as 15 menus, which would cost up to 8K of memory to include. So, the practice in the past has been to “skimp on menus” and make the user REMEMBER what keys to use for a miriad of functions.