Dec 172017
 
Strips comments & abbrev. reserved words to increase DBASE .PRG speed.
File DECANT09.ZIP from The Programmer’s Corner in
Category Dbase Source Code
Strips comments & abbrev. reserved words to increase DBASE .PRG speed.
File Name File Size Zip Size Zip Type
DECANT.COM 24571 15448 deflated
DECANT.KEY 759 354 deflated
DECANT.TXT 14112 4383 deflated
PRINTDOC.BAT 69 69 stored

Download File DECANT09.ZIP Here

Contents of the DECANT.TXT file





Decant 0.9 Copyright M.D. Sadler
1985, 1986




1.0 INTRODUCTION

Decant reduces the size of dBase III* programs by removing
leading and training blank spaces, reducing dBase III
keywords to four characters (optional), and by removing
comment lines (optional). This results in dBase programs
which run faster and take up less space on disk.

dBase III is an interpretive program language. The computer
must interpret each line of the program as it is executed.
If a line of code is executed ten times, it must be
interpreted ten times. If the number of characters that
dBase must interpret is reduced, the program will execute
faster. This is what Decant does.

It is good programing practice to make programs self
documenting. That is, the program contains all the notes,
as comments, needed to allow another programmer to quickly
understand how the program works. This also allows the
original programmer to remember his own work. Typically
certain rules of indentation are followed to show IF-ENDIF,
DO WHILE-ENDDO, and CASE program structures. While this is
good programing practice, for interpretive languages like
dBase, it results in slower running programs. Decant allows
a dBase programmer to follow good documentation practices
and still generate code which will execute faster and
require less disk space.

Who will benefit most from Decant? If you include extensive
comment lines, never abbreviate dBase keywords, carefully
follow the rules of indentation, and use a text editor which
pads program lines out to 80 spaces, Decant will benefit you
the most. If you never add comment lines, always abbreviate
dBase keywords to four letters, never indent, and use a text
editor which removes trailing blanks, you might as well
forget Decant. Most of us fall somewhere in between these
two these two extremes. Most of the programs that I have
written are reduced in size by 20 to 30 percent by Decant.
The speed improvement depended upon the program structure.
If there were lots of comments within loops, the speed
improvement was very significant. One program which I
copied from a magazine was reduced in size by 58 percent and
ran twice as fast. The results you get will depend on how
your program structures and the extent of your comments.




____________________

* dBase III is a trademark of Ashton Tate.



Page - 1 -






Decant 0.9 Copyright M.D. Sadler
1985, 1986

2.0 COMPATIBILITY

Decant is written for IBM PC's and close compatibles running
under PC or MS DOS 2.0+. I have tested this program on a
IBM PC-1 running PC-DOS 2.1, with black and white monitor,
PC-2 with color monitor and external hard disk , and a
Compaq Portable using MS-DOS 2.11. I have test Decant with
dBase III version 1.1. It is should be possible to use
Decant with dBase II by modifying the keyword file (see
section 5.0). Since I do not have access to dBase II, I
have not been able to test this.


3.0 INSTALLATION

Decant uses two files. DECANT.COM is the program file.
DECANT.KEY contains all the dBase keywords longer than four
characters. Both of these files must be on the same disk
drive and in the current subdirectory to execute Decant.
From the DOS prompt, type "DECANT" and return (please leave
out the quotation marks). Decant will load the keyword
file, DECANT.KEY, and then display the main menu.


4.0 MAIN MENU

The main menu allows the user to select which files will be
compressed and the name of the output files. From the main
menu, the user may select or deselect the keyword truncation
and comment deletion options.

The default selections will compress all files on drive A
with the file extension .PRG and write the resulting program
files with the same name on drive B. Dbase keywords will be
shortened to four characters and comments will not be
deleted.

Main Menu options may be selected by pressing the first
letter of the desired command. The available option letters
are highlighted on the Main Menu. The subcommands for input
and output file selections require pressing first "I" for
(I)nput or "O" for (O)utput and then the letter for the
subcommand.


4.1 (I)nput

By typing "I", you may change the selected input drive
and path, the file mask, or the file extension. Decant
uses the normal DOS filenaming conventions and supports
wildcard selections. Typing "I" will allow the
following sub-commands to be given to Decant:





Page - 2 -





Decant 0.9 Copyright M.D. Sadler
1985, 1986

4.1.1 (D)rive\Path

After pressing "D", you will be asked for a
new Drive\Path. You should respond with the
drive and path that your input program files
exist on. Examples:

C:\DBASE\PROGRAMS\MASTERS
A:\
B:\


4.1.2 (F)ile Mask

After pressing "F", you will be asked for a
new input file mask. This specification can
be as specific as a single file name or you
may use the DOS * and ? wildcards. Examples:

menu
program1
program?
pro*


4.1.2 File (E)xtension

Pressing "E" allows the selection of the
input file extension. Examples:

.PRG
.CMD
.OLD


4.2 (O)utput

Pressing "O" allows changing the output file drive and
extension. Decant will not willingly overwrite the
input file. Decant will test for duplicate input and
output specifications. If you should succeed in
fooling Decant into trying to overwrite the input file
the results are unpredictable. For this reason, the
output specification should include a different
Drive\Path or Extension from the input specification.


4.3 (K)eyword Truncation

When this option is on, Decant will shorten all dBase
III keywords to four characters. Pressing "K" toggles
this option on and off.





Page - 3 -





Decant 0.9 Copyright M.D. Sadler
1985, 1986

4.4 (C)omment Deletion

When this option is on, Decant will delete all comment
lines. Pressing "C" toggles this option on and off.


4.5 (G)o

This is the execute command for Decant. While Decant
is operating, Decant will display what files it is
currently operating on. As each input file is
completed, the input file size, output file size and
the percent reduction is displayed. At the same time
Decant checks to see if any key has been pressed. If a
key has been pressed, Decant will ask the user if the
program should be aborted.


4.6 (Q)uit

Return to DOS.


5.0 THE KEYWORD FILE, DECANT.KEY

The Keyword file is a ascii file containing all of the dBase
keywords longer than four characters. These keywords are
listed one word on a line and in alphabetical order. The
keyword file may be edited with any word processor or text
editor capable of ascii file output. Decant compares each
word of the input file with the words included in
DECANT.KEY. If the words match, the word from the input
file is shorted to the first four characters before it is
written to the output file.

While it is poor practice, dBase will often allow you to use
dBase keywords as variable names. If you have used a dBase
keyword as a variable, Decant will shorten it to four
characters and your program may not work any more. If this
happens, you may change your variable name or you can delete
the keyword from DECANT.KEY.

If future revisions of dBase include new keywords, they may
be added to DECANT.KEY. If you have a copy of dBase II, you
may be able to use Decant if you revise DECANT.KEY.












Page - 4 -





Decant 0.9 Copyright M.D. Sadler
1985, 1986

6.0 USAGE SUGGESTIONS


6.1 Floppy Disk Users


The easiest way to use Decant is to develop your dBase
programs as you normally would on one floppy. When you are
satisfied that your programs are complete. Use Decant to
compress your programs on to another disk with the same file
names. You may then keep the diskette with the original
program files for backup and future updates. Use the
compressed files for everyday use.


6.2 Hard Disk Users

If you have a hard disk, keep your original program
files in a separate subdirectory. Use Decant to
compress your programs into a working subdirectory.


7.0 COPYRIGHT NOTICE

Decant is offered as is. I have made every effort to debug
and test Decant that I can think of. However, I
specifically disclaim all other warranties, expressed or
implied, including but not limited to, implied warranties of
merchantability and fitness for a particular purpose with
respect to defects in the program or the documentation, and
the program license granted herein in particular, and
without limiting operation of the program license with
respect to any particular application, use, or purpose. In
no event shall I be liable for any loss of profit or any
other commercial damage, including but not limited to
special, incidental, consequential or other damages.

A limited license is granted to all users of this program,
to make copies of this program and distribute them to other
users, on the following conditions:

1. The program is not to be distributed to others in
modified form.














Page - 5 -





Decant 0.9 Copyright M.D. Sadler
1985, 1986

2. No fee is to be charged (or any other considera-
tion received) ,except as noted below, for copying or
distributing the program without the express written
permission from:


Mark D. Sadler
8502 Scenic Green Drive
Houston, Texas 77088
(713) 999-3447
Compuserve ID: 75135,1552

Clubs may freely copy and distribute this program for a
nominal diskette or copying fee not to exceed $8.

You are encouraged to copy and share this program with
others users. If you find this program of use, your
contribution of $15 (suggested) will be appreciated. If you
will let me know of any problems you have, I will be glad to
try and help you out.


8.0 VERSIONS

VERSION 0.8 12/15/85 Initial Release

VERSION 0.9 1/11/86 Corrected handling of TEXT-ENDTEXT.
Corrected handling of strings not
preceeded with a space.




























Page - 6 -




 December 17, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)