Classic Computer Magazine Archive PROGRAM LISTING: 88-05a/DATAX.TXT


DATA-X DATABASE MANAGEMENT SYSTEM

By Jeffrey A. Summers

   DATAX.CTB is a full-featured
information processing system for
Atari XL/XE computers with at least
64K.  The program can handle files
with up to 300 characters (letters
or digits) per field, 20 fields per
record, 1,000 records per file, for
a maximum of 600,000 bytes of
information.  The program performs
certain mathematical manipulations
across fields as well as the add,
delete and update functions normally
found in this type of program.  With
the use of windows, no complicated
commands need be learned.  The

XXX
program prompts for all needed
information to perform its
functions.

   Like most current database
systems, you create files that are
arranged as groups of RECORDS.  Each
record contains a number of FIELDS,
which contain the actual
information.

GETTING STARTED
   Take a blank disk and format it
with DOS 2 or DOS 2.5.  (Be sure to
WRITE DOS FILES to this disk.)  Now,
copy the files RNTIME.OBJ and
AUTORUN.CTB to this disk.  Finally,
rename RNTIME.OBJ to AUTORUN.SYS.
When you're done, you should have

XXX
four files on your disk:
   DOS.SYS
   DUP.SYS
   AUTORUN.SYS
   AUTORUN.CTB

   To start, put this disk into your
drive, hold down the [OPTION] key
and turn on the computer.  DATA-X
will load and run automatically.


USING DATA-X:

THE FILES MENU

   The FILES menu, the first menu
you'll see, has the following
options:

XXX

CREATE A FILE

   First, decide how to arrange your
data.  Each field can contain up to
300 characters (although only 255 of
these can be printed on the system
printer).  The TOTAL number of
fields (total records times fields
per record) in a file cannot exceed
2,000, and the maximum number of
fields per record is 20 -- so you
define your file for 100 records
with 20 fields each, 1,000 records
with two fields each, or anything in
between.

   Let's create a sample address
book.  Press [C] at the main FILES

XXX
window to Create a file.  When
prompted for a filename for your
database, choose any legal filename
(up to 11 alphanumeric characters,
including an extender).

   When asked for the number of
records you want in the file, you
are setting the MAXIMUM number of
records.  Though you can extend the
database later, you should choose an
adequate number of records to begin
with.  Here, enter 10.  At the
prompt for the number of fields,
enter seven: last name, first name,
street address, city, state, ZIP and
phone number.

   When prompted, enter field labels

XXX
and lengths.  In this case, enter:
LAST, 20; FIRST, 10; STREET, 25;
CITY, 15; STATE, 2; ZIP, 5; and
PHONE, 10 (to include the area
code).  The program then creates the
file and displays the MAIN menu.

DISK DIRECTORY

   Typing D at the FILES menu lists
the files in drive 1 to a window.
You are then asked to press [RETURN]
again to go back to the FILES menu.

EXIT

   This option closes all files and
returns you to DOS.


XXX
REBOOT

   This is equivalent to turning the
computer off and back on again but
causes less wear on the electronic
components inside.  This option is
most useful when you're finished
with DATA-X and wish to use another
commercial program.

OPEN A DATABASE

   This opens a previously created
database for data entry, searches,
sorts, etc.  Just type in a filename
when prompted.  (Drive 1 is the
default.)  Then you'll return to the
MAIN menu.


XXX

THE MAIN MENU


ADD A RECORD

   Pressing [A] lets you Add
information (records) to the
database.  Since there is nothing in
our sample database yet, you'll
first need to add a few records.
The program prints the labels for
the fields one at a time, prompting
you to make your entry.  Enter a
name, address and phone number,
pressing [RETURN] when you're done
with each field.  Use [DELETE] be as
usual to delete typos.  After you
enter a record, the program returns

XXX
you to the MAIN menu.  Just press A
again to add more records.  For our
example, make four or five entries.

FIND RECORDS

   This is one of the most powerful
functions in the program.  It lets
you search the database, selecting
records for further processing.

   Choosing this option brings up a
sub-menu.  Press [L] to list the
field labels in your file (in case
you've forgotten their order).
Press [R] to reset the flags.  Only
"flagged" records are operated on
with most other options.  Therefore
resetting the flags reselects ALL

XXX
the records (see below).  Pressing
[E] exits to the MAIN menu, and [S]
initiates a search.

   When you start a session, all
records are "flagged," or selected.
This part of the program lets you
eliminate the records you don't want
to work with.  The FIND routine lets
you include or exclude based on a
pattern match.

   From the FIND sub-menu, press [S]
to begin a search.  When prompted
for the field on which to search,
press [1] and [RETURN] for our
example, choosing the first field
(last names).  When asked for a
search string, type part or all of

XXX
one of the entries you made.

   The program can search such that
either the BEGINNING of the field or
the ENTIRE field is checked.  The
first method will find the BUG in
BUGBLATTER but not in LADYBUG.  The
second will find both.

   Next you are presented with a
list of logical operators -- AND,
OR, XOR and NOT -- which control the
manner in which the records are
flagged or unflagged:

   AND: if the field contains the
string and was previously flagged,
it is again flagged.  All others are
unflagged.  For example, if you want

XXX
anyone named BEESON who lives in
BUFFALO, you would first search on
LAST NAME for BEESON using AND,
which eliminates anyone who isn't a
BEESON, and then search on the city
field for BUFFALO, again using AND,
which makes it only the BEESONs in
BUFFALO.  You'll probably use AND
for most of your searches -- it
simply eliminates all those records
from the current group that don't
match.

   OR: if the record is already
flagged OR if it contains the string
OR BOTH, then it is flagged.
Unflagged records that do not
contain the string remain unflagged.


XXX
   XOR (exclusive OR): works the
same as OR but excludes records that
meet both conditions.  Normally, if
you wanted the BEESONs or anyone
else from BUFFALO, you'd first
search the LAST NAME field for the
BEESON using AND (so you get only
the BEESONs at first), then the CITY
field for BUFFALO using OR.  If you
wanted all the BEESONs as well as
everyone from BUFFALO, but NOT any
of the BEESONs IN BUFFALO, you'd use
XOR for the second search.

   NOT: similar to AND NOT.  If you
want the BEESONs who are NOT from
BUFFALO, search the LAST NAME field
for BEESON using AND.  Then search
the CITY  field for BUFFALO using

XXX
NOT.  Combining these logical
operators enables you to do very
complex searches easily.  The
program always tells you how many
records are flagged at the end of
your search.

PRINT AND DISPLAY

   Currently flagged records can be
displayed onscreen or printed on a
printer (or to a disk file)
according to the format you choose.

   For now, press D for DISPLAY to
look at the currently flagged
records.  If there aren't any, go
back to the FIND menu and RESET the
flags.  When you press D for

XXX
DISPLAY, the computer displays the
first flagged record.  If the record
is long enough to go outside the
window space allotted, the program
asks you to press [RETURN].  Then it
clears the window and continues
displaying the record.

   After the record is displayed,
you can press: [U] to unflag that
record and display the next; [M]
returns you to the MAIN menu; or any
other key (including [RETURN]) to
display the next flagged record.  So
before printing a set of records,
you can preview and unflag any you
don't want printed.

   Pressing [P] brings you to the

XXX
PRINT routine.  When asked where you
want output directed, enter a
filename -- or simply press [RETURN]
to direct output to the printer.
You're then asked a repetitive
series of questions about which
field you want printed, where, and
how many characters per field.

   If you want the whole field
printed, typing a number greater
than 255 guarantees the entire
field.  (There is a limit of 255
characters per field, however.)

   In our example, you may want the
first and last names on the same
line, the address on the next line,
the city, state and ZIP code on the

XXX
third line, and the phone number
ignored.

   To accomplish this, enter 2 for
the first field to be displayed, 1
for the column and 1 for the row.
(Press [RETURN] after each entry).
This prints the first name first.

   To add the last name to the same
line, enter 1 for the field, 12 for
the column and 1 for the row.  The
address can be indented by using 5
for the column, but remember this
should now be row 2.  Row 3 would
contain the city, state and ZIP,
using starting columns of 5, 20 and
25, respectively.


XXX
   Although entering the positions
and lengths for all of the fields
can be tedious, it gives you a great
deal of flexibility.  To end your
list, type 0 for the field number.
You'll be prompted to check your
output device, then press a key to
start printing.  If you want extra
lines between records, the easiest
way is to have the lines at the top.


SORTING A DATABASE


   The SORT option lets you arrange
and rearrange your data to suit your
current needs.  After choosing this
option, you're asked for the field

XXX
on which to base the, then whether
you want the sort in ascending or
descending order.

   In our example, it would make
sense to sort by last name when
printing out the address book or if
making up a set of nametags, but if
you are bulk-mailing newsletters
from the same list, these must be
organized by ZIP code.  So, to sort
by last name you'd enter 1 for the
field and then A for an ascending
(alphabetical) sort.  To sort by ZIP
code, enter 6 for the field and A or
D for the order of the sort.

   You can also sort your database
on more than one field, with

XXX
different fields having priority.
For example, to sort names in strict
alphabetical order, sort the
database first on the first names,
THEN by last name.  The most recent
sort will take priority.

   NOTE: upon exiting the program
the order of the data returns to the
original.  To make the sort
permanent, use the COPY database
function.

   Another important point is that
ONLY FLAGGED RECORDS ARE SORTED.
This lets you sort only certain
records in the database, but be sure
if you want the ENTIRE database
sorted to RESET the flags through

XXX
the FIND option.

   One last point regarding the
sorting routines.  Fields are sorted
by the ATASCII values of the
characters.  Therefore, numbers come
before the letters, uppercase comes
before lowercase, and spaces come
before everything.  For numbers to
be sorted properly, make sure
they're right- justified within the
field.

   The only complication here is
that the first character of the
first field of any record cannot be
a space.  Therefore, don't use a
field that's likely to contain a
number as the first field in a

XXX
record.

DELETE RECORDS

   This is easy.  Simply flag the
records using the SEARCH function
and press [D] at the MAIN menu.
When the program asks if you really
want these records eliminated, press
[Y] if that's what you want.  If
not, press [N].

   NOTE: the space occupied by
deleted records is NOT freed up for
further entry.  To clean up a
database after deleting records,
using the COPY database function.

UPDATING RECORDS

XXX

   To change the data within a
field, press [U] on the MAIN menu.
The program then cycles through the
flagged records, displaying the
first field of each.

   You are asked whether that record
requires updating.  Because only
flagged records are displayed, you
don't have to go through the entire
database looking for the record to
update; you can select the records
with FIND and the update only the
ones you wish.

   If you press [Y] at the prompt
for updating the displayed record,
the program lists each field in

XXX
order.  You can make changes to the
field, and pressing [RETURN]
re-enters the field.  If you don't
want to make changes, press [RETURN]
to proceed to the next field.  After
the record has been updated the
program then continues to list the
first field of each flagged record.

MATH

   The program can perform a number
of mathematical functions.  By
pressing [M] at the MAIN menu and
then entering an appropriate field
number, a series of values are
displayed onscreen: the sum of the
field, the average of the field, the
sum of the flagged records in the

XXX
field, the average of the flagged
records in the field, the percentage
of records flagged, and the
percentage of the VALUES of the
flagged records as a fraction of the
total.

   Thus it's easy to flag a group of
records to see whether that group
contributes proportionately to the
totals (for example, a business can
have multiple divisions or areas
that contribute to the profit).

   Non-numerical values are excluded
from consideration.  If a result
would cause an error (for example,
if no records are flagged, or the
calculation of flagged records would

XXX
involve dividing by zero) the result
is skipped.

COPY

   This utility lets you copy all or
part of a database.  It also lets
you clean up a database that has
been cluttered by deleted records.

   After pressing [C] at the MAIN
menu, you are asked for the output
file.  Type the complete filename.
Next, you're asked if you want the
entire database copied or just the
flagged records.  Either way, the
data will be written out to the new
file in the order of the current
sort.

XXX

   If you choose to copy the entire
database, it will remain the same
size, but deleted records will be
cleared out, making more room for
additions.  If you choose to copy
just the flagged records, the new
database will only be as long as the
number of flagged records.  To add
more records to the database, use
the XTEND option from the MAIN menu.

EXTENDING A DATABASE

   In case you've underestimated the
number of records you needed in a
database, this option lets you
extend it (keeping in mind the 2,000
total field limit).  After choosing

XXX
this option from the MAIN menu, you
are asked how many records you want
to add.  (Keep in mind that whenever
you extend the database you waste
some disk space.)  This option
reverses any sorting you had done,
so be sure to use the COPY function
to save your sorted database before
using this option.

EXIT

   This option closes the database
properly and returns you to the
FILES menu so you can work on
another file.





Back to previous page