Dec 232017
 
Interesting database generator. You specify your design outline, and DESIGN will generate TP 5.0+ source that you can then compile into a final program using your TP compiler.
File DESIGN.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Interesting database generator. You specify your design outline, and DESIGN will generate TP 5.0+ source that you can then compile into a final program using your TP compiler.
File Name File Size Zip Size Zip Type
COMPILE.BAT 46 39 deflated
DESIGN5.DOC 28351 7854 deflated
DESIGN5.EXE 96400 28367 deflated
DSORT.PAS 16869 4191 deflated
DSORT.TPU 9760 4613 deflated
EDITLN.PAS 4617 1381 deflated
EDITLN.TPU 2992 1491 deflated
ERR.INC 3242 1075 deflated
HELP.FIL 2174 1024 deflated
HELP.TXT 4224 1223 deflated
HELPCONV.PAS 1804 717 deflated
IBMLIB1.INC 17858 4744 deflated
IBMLIB2.INC 7552 1795 deflated
MISCTOOL.PAS 2284 761 deflated
MISCTOOL.TPU 1936 903 deflated
RCD.INC 65 45 deflated
REPORT.INC 1345 182 deflated
TYPES.INC 552 149 deflated
VARS.INC 1454 614 deflated
WINDOWS.PAS 4426 1617 deflated
WINDOWS.TPU 3824 1797 deflated
WRITSORT.INC 760 285 deflated

Download File DESIGN.ZIP Here

Contents of the DESIGN5.DOC file














DURA DESIGN

DESIGN5.EXE

INTELLIGENT DATABASE DESIGNER

(C) Jerry Adkins 1988



RELEASE 5.0, January, 1989




Design program and documentation Copyright (C), 1989
7770 Regents Road
Suite 113-226
San Diego, CA 92122

Registered users will receive a diskette with the latest version
of Dura Design. The disk will also contain the following programs:

DURA MENU Hard drive menu control system, with optional virus
protection, and encrypted password. This program is currently the
standard menu system in nine Ford car plants.

FKEYS Program function keys to execute several commands at
DOS level.

----------------------------------------------------------------------------

I wish to register Dura Design, and receive the update diskette that also
includes Dura Menu and FKEYS. Included is the $20 registration fee.


Name: _____________________________________________


Street: ___________________________________________


City: ________________________ State: ___________ Zip: ___________



----------------------------------------------------------------------------

You may freely distribute copies of this disk to others, provided
the files are not altered, or sold.

Due to the many variations of programs created by this product,
J. Adkins or Adkins Enterprises will not assume any liability
for the use of this product, or the suitability for any particular
machine.











Table Of Contents
-----------------

Introduction........................................D-1

Mew Features........................................D-2

Defining And Generating Your Program................D-3

Editing A Defined Program...........................D-4

How To Use The Generated Program....................D-5

Format Of Design Disk Files.........................D-6

Limited License For Design..........................D-7

D-1) Introduction
------------

At Adkins Enterprises, we do quite a lot of database work, both for
ourselves and for clients. After writing about the one millionth
database manager, we came to a startling conclusion: very little
was actually changing from program to program. We became good at
reinventing the wheel, but this time a thought struck us, "Why not
write a database program generator?" Design is the end result.
Basically what it does is allow you to set up your unique database
needs, and then actually writes a dedicated database program in
Pascal while you watch.

What we found was that we were doing in a few minutes what used to
take days or weeks. Here's a brief outline of Design's capabilities
and features:

1) This program allows you to set up a customized data entry system
and then writes a dedicated Pascal database manager program.

2) Several different types of input fields are supported: Numeric,
Alphanumeric, Calculated, etc. Strict type checking is done on
the input.

3) The generated program is documented with remarks for easy
customization.

4) Typical record access (no matter how many records in the system)
when the key field is known is under 1/2 second.

5) Knowledge of Pascal, data-file input/output routines, or other
special functions is not required. A small amount of Pascal
formula format is helpful for using formula fields.

6) Number of fields can be as many as 50.



D-2) New features in 5.0
-------------------

Version 5.0 no longer requires toolbox sort modules. There is
nothing else to buy. This version takes advantage of the unit
structure of Turbo Pascal 5.0. Fewer support files are needed.
The archive file is over 30k smaller.

Advanced error protection is incorporated into your programs.
This takes advantage of the Custom Exit procedures available to
the latest Turbo Pascal.

All programs generated are designed to be compiled with Turbo
Pascal 5.0.

Field input now has word processor type editing features, with
insert, delete, etc. The commands are Wordstar (tm) compatible.
This field input is incorportated into your programs, as well as
the designer program.

A windows unit (WINDOWS.TPU) is provided, which can be incorporated
into other programs. It features removable windows.

VAR files created by the older version can still be used to create
a newer version program. If you do this, delete the COM version of
your previous program. Turbo Pascal 5 creates EXE files.


D-3) Defining And Generating Your Database
-------------------------------------

Before executing the Design program generator, you should insure
that the following files are on the diskette in your logged
(default) disk drive:

1) Design program generator (DESIGN5.EXE)
2) Design library files (IBMLIB1.INC)
(IBMLIB2.INC)
(WINDOWS.TPU)
(DSORT.TPU)

5) Turbo Pascal 5.0 (tm) compiler. (TURBO.EXE or TPC.EXE).


From the DOS prompt, type: DESIGN5
and the program should load and execute after a few seconds. You
will first be presented with the screen:

DESIGN5.EXE
(C)COPYRIGHT ADKINS ENTERPRISES 1989
7770 Regents Road Suite 113-226
San Diego, CA 92122


PROGRAM NAME: .PAS


The program will ask you for a filename for the resulting
program (7 characters, first character alphabetic). The eighth
character is reserved to name the sort program.

Now it is time to designate the record fields , variable names,
and variable types. A fair amount of error checking is done to
insure you only use legal Pascal variable names, but it is best
to avoid using illegal Pascal variables.


1 : string1;
2 : string2;
Which type for this variable? 3 : string3;
4 : string4;
5 : string5;
6 : string6;
7 : string10;
8 : string12;
9 : string15;
PROGRAM NAME: TEST.PAS 10 : string20;
11 : string25;
12 : string30;
13 : string40;
14 : string50;
15 : string60;
Used = 1. Avail = 49. Variable name = first_name 16 : string65;
17 : string75;
18 : string80;
19 : integer;
20 : real;






First, a little background on database files. A database file
consists of a group of individual entries called "records". A record
might be a recipe, information on an employee, or an address book
listing. Each record is further subdivided into groups of
information called "fields". In an employee record, one field might
contain the date the employee was hired, and another might have his
zip code. One of the fields in each record is predefined as the "key
field". This is the field that best identifies each record, and will
be used to retrieve the record from the file. If a file contained
records of inventory parts, you might designate the inventory number
as the key field. In an address list, you might use the person's
last name as a key field.

Why the last name instead of the full name? Design works best in
applications where you know the key field. It's easy to forget
whether you entered a person as John Smith or J. G. Smith, so the
last name system would work best. If you're not sure of the key
field exactly, there is a mechanism for still finding the record, but
it is much slower. Better yet, use a key identifier that makes each
particular record unique, such as a social security number.

Back to the program.

ADDRESS BOOK
Move cursor to location for first_name prompt and press ENTER























The above prompt will be repeated until you have positioned all
the field prompts and input locations on the screen.

At the top of the screen, a new message appears telling you to
enter the field prompt you wish to use. Type in a descriptive
message that will prompt the user to type in the correct information
for that field (like NAME: or PART NUMBER:, for instance). You have
up to 40 characters for the field prompt, and you can leave it blank
should you wish. The program will again ask you to position the
cursor and press Enter. Don't worry about moving the cursor
over other characters on the screen, it's doesn't destroy what it
moves over. Don't allow your information to overlap other fields,
though.

The following is a typical screen after all the variables have
been defined. Now a sort key may be selected. Any of the fields
can be used for a sort key, even numeric ones. In this case, we
are using 7, the social security number. The sort key is the
same as the key field.


1 fname : string15;
2 lname : string15;
3 street : string25;
4 city : string25;
5 state : string2;
6 zip : string10;
7 social_security : string10;
8 amt_owed : real;

Sort key # 7
















CUSTOMER DATA
Formula = 'AMT DUE: ',(amt_owed / 12)



FIRST NAME:

LAST NAME:

STREET:

CITY:

STATE:

ZIP:

SOCIAL SECURITY:

AMT OWED $





D-4) EDITING A DEFINED PROGRAM
-------------------------
You didn't think I would leave you hanging without a way to change
an already generated program did you?

For each program generated, there is a small token VAR file. The
only thing you need to reconstruct your program is this file. A
typical file size is about 1k bytes. This means you could store
several dozen programs on a single floppy diskette. A typical
CUST.PAS program would also have a CUST.VAR file generated.
When Design asks for a filename in the opening screen, just type
in the name of the program you want to change.


DESIGN5.EXE
(C)COPYRIGHT ADKINS ENTERPRISES 1989
7770 Regents Road Suite 113-226
San Diego, CA 92122


PROGRAM NAME: CUST.PAS



Will CUST be a new program? (Y/N) N



dd elete hange nsert uit (A/D/C/I/Q) A

Used = 7. Avail = 43. Variable name =



After the editing is complete, a new VAR file is also created.
Now, let's suppose you have already keyed in a lot of data into
your database. It's no longer compatible with the new program.
Don't worry. Design will optionally create a data convert program
CONV.PAS. How's that for service? When you run CONV.PAS, it will
convert the old database over to the newer format. If you didn't
have a lot of time in the data, you may want to just delete the
data file. Your generated program will create it again first time
run.

Warning! Always delete CONV.PAS after it is used. Running it more
than one time would damage the new database. Of course you DID
have a backup copy of your data didn't you? Well, DIDN'T YOU???


TIPS FOR MAKING DESIGN A PLEASANT EXPERIENCE:
---------------------------------------------
1) Although the use of a hard drive is not mandatory, it will make
life a lot easier.

2) You can't go back until later if you make an error during
definition, so move slowly and have some sense of direction.
freestyle coding can be fast, but you're better off at least
having a rough sketch of what you'd like to end up with before
starting. This goes double if you intend to use formulas.


D-5) How To Use The Generated Program
--------------------------------
The following is an example menu showing the options of your
generated program. All your programs will use this menu. Your
program will have actual removable windows that are almost
instantly displayed and removed during the operation of the
program. Don't confuse this section with the instructions for
running the Design program.

In the right window, there are three options. These options
are selected by pressing the up/down arrow keys and pressing
enter when the option is highlighted.


01/04/89. - 05:34:05 PM

CUSTOMER DATABASE
3112960 bytes free




F1: Help
F2: Printer setup >EDIT RECORD
F3: Colors ADD RECORD
F4: Clock On/Off REPORT
F5: Sort
F6: Shrink
F7: Backup Data
ESC-Exit




EDIT RECORD
-----------
Allows changing any or all fields within a record. Within the
edit screen, there are several sub-commands that allow you to
change data, delete the entire record, move forward/backward
through the database. Use the edit option when you want to
navigate through the database to find and change things.

SUB-OPTIONS FOR EDIT RECORD
---------------------------
+ Move forward one record.
- Move back one record.
B Move to beginning of file (first record).
C Change a record.
D Delete current record.
E Move to end of file (last record).
F Find a record by search key.

If the change option is selected, you can press enter for the
fields you want to keep, or overtype the ones you want to
change. You can move back one field by pressing the up-arrow
key.

ADD RECORD
----------
Displays the edit/add screen and allows you to key in the
information for a new record. You can move forward/backward
through the fields with the up/down arrow keys.

REPORT
------
A screen similar to the edit/change screen is displayed. This
allows you to pick out certain fields for printing. For
instance, if you wanted to print all records for people who
live in California, and ignore all others, you would press
enter for all fields except the state filed, and then type
CA for the state.

Using this technique makes it possible to make various
combinations of printed reports, by keying in partial
fields we could do something like print all records that
have people in the 9 zip area who have last names beginning
with S.

LEFT WINDOW FUNCTION KEY COMMANDS
---------------------------------
F1: Help
--------
Brings up a help window. The help text can be any text file
created by you and converted by the HELPCONV.COM program.
HELPCONV is a program that converts your ASCII files over to
a record structure usable by your generated program. This
allows you to move forward/backward through the help file
with the + - keys.

Handy tip: the calls to (procedure help) in your program can
be modified to make more efficient use of the help file. For
instance, if your help file talks about the edit screen
beginning with line 50, then change the call in the edit
procedure to "help(50)" which starts at line 50 in your help
file.

VERY IMPORTANT: Make sure any lines in your help file to be
converted don't exceed 65 characters. This is the width of
the help window. An example file "HELP.FIL" is provided for
your use. When it is converted, the file "HELP.TXT" is
created.

F2: Printer setup
-----------------
Allows you to configure the program for an Epson or Okidata
printer. In order to use the codes in your program, you will
need to modify (procedure print_record) a bit, otherwise the
program will use normal print. Three string variables are
used for this purpose. They will be in the CONST section of
your program. The defaults are for the Okidata printer:
The following typed constants are actually initialized
variables.

preset : string[5] = #24;
expanded : string[5] = #31;
normal : string[5] = #30;

You could change a line like:
writeln(lst,fname);
in the print_record procedure
to
writeln(lst,expanded,fname); { Print first name expanded }

F3: Colors
----------
Sets all the foreground/background window colors. Pressing
enter for each one will use the defaults. The first time
your program is run, this option will be executed.

F4: Clock On/Off
----------------
Toggles the ticking clock on/off. If the clock annoys you,
you can turn it off. The default is on, but you can change
that by changing the line in the main program:
Change
clockon := true;
to
clockon := false;

F5: Sort
--------
Executes the sort program that was also created by Design.
Yes, your created program has the ability to execute external
programs as well.

In order to rapidly find a record, a binary search is employed.
If the file isn't sorted, the binary search will fail, then your
program will attempt a sequential search from the end of the
database backward. The reason for this is all new records are
appended to the end of the database until they are sorted.

F6: Shrink
----------
Physically removes deleted records by re-writing the database.
The database is copied record by record to a temporary file,
minus the deleted records, then the old database is deleted and
the temporary file is renamed to the normal database filename.
It is VERY important to insure that you have enough temporary
free disk space to accomplish this.

F7: Backup Data
---------------
Copies the database to diskettes. If the database is larger than
the size of a diskette, it will pause after each diskette is
full for insertion of the next diskette.

This option also allows you to copy the database from diskettes
to a hard drive.

ESC-Exit
--------
Pressing the Escape key will exit the program. A window will
appear so you can verify that you really want to exit. Upon
exit, the database file is closed.



D-6) FORMAT OF THE DATABASE FILE
---------------------------
Since the database file is random access, it will allow read/
write anywhere in the file. The file is open all the time
during the operation of the program. No serious damage should
occur in the event of an unexpected shutdown such as a power
failure. In the event of a run time error, the file will be
closed, and an error message will appear in a window. Pressing
enter will reopen the file, and return to the program menu.

The data file used is a file of records. Each record has a
series of fields determined by you when you run DESIGN5.EXE.

The search routine uses a binary search, which is very fast,
but requires a database that is sorted by the key field. In
the event that the binary search fails, a sequential search
is attempted. The sequential search starts at the end of the
file and reads backward. The reason being that all new data
keyed in resides at the end of the file, and a match is more
likely to occur in this area.

DESIGN5 was intended to create database programs that handle
only a few hundred records. If very large databases are
intended, a B-Tree type database program would probably be
better. DESIGN5 doesn't use index files. All searching is
done in the master database file. If the file is sorted,
the search is very fast, however, very large databases require
time to sort.


D-7) LIMITED LICENSE FOR DESIGN
--------------------------
Any programs generated by DESIGN5.EXE may be freely distributed
or sold for profit. DESIGN5.EXE or the source code modules for
DESIGN5.EXE may not be distributed or sold for profit.


Leave a Reply