home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
prntsay.zip
/
PRINTSAY.DOC
< prev
next >
Wrap
Text File
|
1988-01-01
|
46KB
|
857 lines
- PRINT-SAY* MANUAL -
- TABLE OF CONTENTS -
PART ONE - (PRINTSAY.DOC):
SECTION 1: Introduction
1.1: Purpose
1.2: What It Does
1.3: Who Should Use It?
1.4: Advantages
1.5: Disadvantages
SECTION 2: General Instructions
2.1: Installation
2.2: How To Use
2.3: How To Proceed
SECTION 3: A Crib Sheet
3.1: Initial Questions Section
3.1.1: Logo Heading
3.1.2: Your Name
3.1.3: Absolute Or Relative Row-Addressing:
3.1.4: Allow Compressed Pitch
3.1.5: Width Of Paper
3.1.6: Length Of Paper
3.1.7: Separators
3.1.8: Bar Character
3.1.9: Out-Put File Name
3.1.10: Report Title
3.1.11: Database
3.1.12: Indexes
3.1.13: Conditional If Statement
3.1.14: Number Of Fields
3.2: Field Questions
3.2.1: Field Title
3.2.2: Field Contents
3.2.3: Is Field Numeric?
3.2.4: Field Size
3.2.5: Number Of Decimals
3.2.6: Sub-Totals
3.3: PRINTSAY.DAY and Re-Usables
SECTION 4: Taking a Guided Tour:
4.1: Getting Started
4.2: The Re-Usables Questions
4.3: Throw-Aways
4.4: Revisions
4.5: Field Questions
4.6: Repeating the Process
4.7: Handling Numeric Fields
4.8: Field-By-Field Revision
4.9: Running the Report
4.10: Where To Go From Here
PART TWO - (CUSTMIZE.DOC):
SECTION 5: Exploring a PRINT-SAY .PRG File
5.1: First Thoughts
5.2: How To Proceed
5.3: Step-By-Step
5.3.1: Step One
5.3.2: Step Two
5.3.3: The Title Block
5.3.4: Initialize Environment
5.3.5: Initialize Variables
5.3.6: Creating the Screen Display
5.3.7: Setting Up For Printing
5.3.8: Control Structures
5.3.9: Printing the Header Lines
5.3.10: Printing the Field Titles
5.3.11: Drawing the Underline
5.3.12: The Work-Horse Loop
5.3.13: Accumulating the Sub-Totals
5.3.14: Displaying the Sub-Totals
5.3.15: Restoring the Environment
SECTION 6: Making Changes
6.1: The Header Block
6.2: Initialize Environment Block
6.3: Initialize Variables Block
6.4: Create Screen Display Block
6.5: Set-up For Printing Block
6.6: Page Header Block
6.6.1: Using Expanded Print
6.6.2: Adding An Additional Logo Line
6.6.3: Other Changes
6.7: Column Titles Block
6.7.1: Re-Locating Individual Titles
6.7.2: Adding an Additional Title Line
6.8: Printing Records Block
6.9: Closing Off
SECTION 7: Index
- BEFORE WE GET STARTED -
i. A note on the typographic conventions used in this manual:
- dBASE and DOS commands and command words are shown in capitals.
E.g.: RUN PRINTSAY.
- Commands you should enter as shown are separated from the text
of the manual with extra spaces.
E.g.: now type RUN PRINTSAY at the dot prompt.
- When a command requires you to enter a specific referent,
E.g.: LIST <FileName>
the unknown is shown in angle brackets, and you are expected
to enter an actual file name from your own work.
- Keys on the keyboard are enclosed in square brackets: [PgUp];
and when one key needs to be held down while another is touched
they are shown thusly: [Shift-E] - which would create a capital E.
Note: The key with an arrow bent to the left, which is used to
inform the computer when you are ready to have it read what you've
typed is sometimes labeled Return and sometimes Enter. In this
manual it is referred to as: [Enter].
- Phrases which are quoted from PRINT-SAY itself or one of its
reports are presented in single quotes.
- Phrases which are presented as possible user responses to PRINT-
SAY are shown in double quotes.
ii. Files you should find on your distribution diskette or .arc file:
1. PRINTSAY.COM - the actual program
2. PRINTSAY.DOC - this manual
3. CUSTMIZE.DOC - its sister
4. CLIQUE.DBF - a fictitious dBASE database used in examples
5. CLIQNAME.NDX - the index for the above
6. REPORT.PRG - sample output file (used in examples)
7. ORDER - order form and catalog
iii. The names dBASE, dBASE III, and dBASE III Plus are registered
trademarks of Ashton-Tate.
SECTION 1
- Introduction -
1.1. PURPOSE:
As with the dBASE LIST TO PRINT command, the purpose of PRINT-SAY
is to allow you to list fields from a database in order to create a
basic report.
PRINT-SAY is intended to fill a gap not met by either dBASE's
LIST command or its REPORT FORM command by providing a LIST which
uses the printer's resources adequately enough to make a presentable
report. This, in itself, makes it a useful tool for the normal bus-
iness user. PRINT-SAY especially shines, however, for the programmer,
since PRINT-SAY generates dBASE code which is available as a good,
labour-saving, starting point for more elaborate printer reports, to
include in larger programs.
PRINT-SAY works with dot-matrix printers: Epsons and true compat-
ibles. Sorry: some inexpensive printers will not perform the chores
PRINT-SAY demands.
1.2. WHAT IT DOES:
PRINT-SAY starts by asking you a series of questions; from your
answers it then performs a multitude of calculations; finally it
creates a file containing dBASE program code. This code IN TURN
generates a report on the contents of a database. In other words:
PRINT-SAY is a program which writes a program (such programs are
called code-generators; APPSGEN provided with dBASE III Plus is an-
other dBASE code-generator).
The result is a report, which you may use and re-use, which lists
only those fields you specify, only those records which match the
conditions you provide, and with a bolded and centered header and
field titles of your choice.
1.3. WHO SHOULD USE IT?
dBASE users fall into three categories: ASSISTants, dot-prompters,
and programmers. To make comfortable use of PRINT-SAY you should
be moderately proficient with dot-prompt command entry. If you can
work with USE <dbf>, LIST <fields>, DISPLAY ALL, etc., then you can
also use the commands RUN PRINT-SAY and DO <prg>, which are all that
are necessary to use PRINT-SAY.
PRINT-SAY has been optimised to the needs of light-weight dot-
prompters and to heavy-weight programmers, since, strangely, their
needs are the much the same. PRINT-SAY performs all the functions
a non-programmer is likely to ask of it. Since it generates dBASE
code, the advanced user will know how to add lines and change lines
to create exactly the report he needs.
Further, PRINTSAY.DOC is provided to use PRINT-SAY's .PRG output
as a very effective means to teaching a non-programmer the rudiments
of dBASE programming. By working with PRINT-SAY, the non-programmer
can also learn how to customize PRINT-SAY programs.
1.4. ADVANTAGES:
The biggest advantage of PRINT-SAYing over REPORTing is that it
automatically takes advantage of the three standard print pitches -
pica, elite, and compressed - to allow you to put more fields of
information on the same width of paper. REPORT only works with the
widest pitch, pica.
Because REPORT does not generate dBASE .PRG code, you cannot mod-
ify its output to take advantage of more advanced printer features
like elite, compressed, emphasized, and bolding. PRINT-SAY's output
is in dBASE code and is therefore available for your modifications
and improvements.
The use of modified and unmodified PRINT-SAY reports has another
advantage in a business environment of providing a consistency of
report formats. Not only does this make for an appearance of pro-
fessionalism: it provides an instant message to the eye: this is an
in-house report.
Furthermore, unlike list, PRINT-SAY provides you the option of
reporting sub-totals at the bottom of each page.
The biggest advantage of all is PRINT-SAY's enormous labour-saving
and time-saving potential in the hands of a dBASE programmer. A
programmer should never have to waste his time with tedious or re-
petitive routines, and creating printer reports contains some of the
most tedious and repetitive there are!
1.5. DISADVANTAGES:
The disadvantage of PRINT-SAY over REPORT is that PRINT-SAY cannot
handle memo fields! (The solution? Don't use memo fields! Memos
are messy to handle and can usually be replaced by a full-screen
field or two, in any case. Full-screen fields offer the advantage
of being accessible to normal data-entry routines, as well as being
normally reportable.)
PRINT-SAY also does not generate totals-summaries. But this is
trivial given that the simple dBASE command TOTAL ON <Key-Field> gen-
erates a totals database which PRINT-SAY can then report on. When
combined with the sub-totals option in PRINT-SAY, you will find that
most of your reporting needs are covered without customization.
SECTION 2
- General Instructions -
2.1. INSTALLATION:
Hard-disk users should copy PRINTSAY.COM to the sub-directory con-
taining DBASE.EXE and DBASE.OVL, etc. or any special utility sub-dir-
ectory. Floppy users should copy it to the second dBASE system disk,
if room exists, or to their data disk, otherwise.
2.2. HOW TO USE:
(If you are a dBASE ASSIST user, first press the [Esc] key to exit
ASSIST.)
You will need a list of the fields in your database, including
their sizes. Type USE <Database> then LIST STRU TO PRINT with
your printer on. (If you are familiar with SideKick (tm), you can
capture a LIST STRU to its note-pad.)
To use PRINT-SAY simply type RUN PRINTSAY from the dBASE dot-
prompt and answer each question as it asks them. Once you have an-
swered all its questions PRINT-SAY will automatically write a dBASE
.PRG file to your diskette or current hard-disk sub-directory.
To use this file enter DO <FileName> at the dBASE dot-prompt -
where <filename> is the name you gave for the .PRG file in Question
8 (see below).
For example, (if I may jump ahead for a second) if you answered
Question 8 with "PAYREPRT.PRG", then enter DO <PayReprt> at the
dot-prompt.
To summarize these steps:
1. USE <database> ; LIST STRU TO PRINT.
2. In BASE RUN PRINTSAY (- in DOS simply PRINTSAY )
3. Answer all questions
4. Revise answers if necessary
5. If in DOS enter dBASE
6. At dot-prompt type DO <filename> ,
- where <filename> is your answer to Question 8.
2.3 HOW TO PROCEED:
At this stage you could take any of three paths to learn your
way through PRINT-SAY. One, if you're even a moderately experi-
enced user, you may want to simply plunge in, trying it out for
yourself, knowing that there's no harm you can do and that you
can back-out at any time with a simple [Ctrl-C].
Secondly, you could try it out - perhaps creating a fictitious
report - by reading along with the following Crib Sheet Section,
and bearing in mind that any question you don't understand the
import of can most likely be answered by simply pressing the
[Enter] key to accept the default value.
Finally, you could skip past the Crib Sheet Section and take
the Guided Tour.
After a fair amount of normal use of PRINT-SAY, you may finally
want to proceed to Section 5 to learn how to tailor the dBASE
code PRINT-SAY generates to create specialized reports or to
modify the appearance of its reports to suit your personal pre-
ference.
SECTION 3
- A Crib Sheet -
The following information should answer your questions about each
of the questions PRINT-SAY asks. Section 3 is the basic reference
material of this manual, which you may want to print it for daily
reference. You may also want to skip it upon first reading and pro-
ceed to Section 4: A Guided Tour.
3.1. INITIAL QUESTIONS SECTION:
The distinction between Re-usables and Throw-aways will be ex-
plained in 3.3. If you haven't experimented with PRINT-SAY yet it
will ask the Re-usables first then go on to the Throw-aways. If you
have used it, it will report your previous answers and go on to the
Throw-aways.
- RE-USABLES -
3.1.1. LOGO HEADING:
Each page of print-out will have a banner in bolded type-face.
Besides reporting the page number and date, it will have a title
for the particular report you are creating, and at the very top it
will have an over-all title, which would usually be the name of
the company or division which owns the report. You may enter up
to seventy characters for this heading; when you reach the right-
hand edge of the entry box the cursor automatically wraps to the
next line.
3.1.2. YOUR NAME:
You may, of course, enter anything you want here. The only use
PRINT-SAY makes of your entry is to include your name as the author
of the .PRG file it creates. (This does not appear on the report
itself.)
3.1.3. ABSOLUTE OR RELATIVE COLUMN-ADDRESSING:
This is a technical question, which need only be understood by
a programmer who intends to customize the .PRG output file which
PRINT-SAY is creating. If you are not a programmer you need only
press the [Enter] key and accept the default answer.
(Default means that if you simply press the [Enter] key without
having typed in an answer, PRINT-SAY will use the answer offered
in the DEFAULT window. Default has nothing to do with fault, as
in blame!)
dBASE provides two ways of sending the printer's print-head to
a particular place (address) on the paper. Absolute addressing
code says: put such-and-such a line on column five, row ten of the
paper. Relative addressing say: put the next line one column down
and two rows over from the last line. There are advantages to
both sorts of addressing when it comes to modifying a printer pro-
gram; the programmer will need to consider which form of addressing
will be easiest to customize in any given report situation.
3.1.4. ALLOW COMPRESSED PITCH:
Once you have finished answering PRINT-SAY's questions and it
therefore knows how many fields you want, how wide they will be,
and what width paper you will be using, PRINT-SAY attempts to
reconcile all these numbers.
For example, if you will be using regular letter-sized paper,
which is 8.5" wide, this allows you to show your data in up to
80 characters across the page. . . IF pica pitch is used. 80
characters isn't that much, considering how many fields the aver-
age database contains! If you need to display more the 80 chars.
across, you could switch to using wider paper. But - unlike the
Report Generator in dBASE - PRINT-SAY allows you the alternative
of using the narrower elite pitch, which permits 96 characters to
show across the letter-sized page.
That is a bit more of a margin but not nearly enough for many
Jobs. The vast majority of printers support an even narrower
pitch called compressed which allows 137 chars. across an 8.5"
page. Whether you wish to use this pitch is ultimately an aesthetic
judgement and is therefore left up to you to decide. That is the
purpose of this question: to allow you to choose whether PRINT-SAY
will drop down to compressed pitch when you need it.
Of course, a little thought reveals a further possibility this
opens the door to: With wider paper AND elite or compressed pitch
one can really begin to get a good look at one's database in one
report.
3.1.5. WIDTH OF PAPER:
There are three common widths of paper: letter (8.5"), legal (11"),
and legal inserted side-ways (14"). For your convenience, the 8.5
or letter paper has been abbreviated to 8 and is the default (no type)
answer as well.
3.1.6. LENGTH OF PAPER:
Ditto WIDTH - the default is the normal 11".
3.1.7. SEPARATORS:
Your report will be a series of columns, each one being a field
from your database. The separator is the number of blanks you
want to separate these columns on the page. Two is the default
answer.
3.1.8. BAR CHARACTER:
Each report you create has some header lines at the top of the
page followed by the main body of columns of data. To separate the
two PRINT-SAY draws a line across each page. The character you en-
ter here is repeated as many times as necessary to get across the
page. The default is an equal sign (=), you may enter any other
single character you choose to take it's place.
Advanced users: you may want to use an upper ASCII character from
the box-drawing set, such as (decimal) #196 or #205. You would en-
ter this using [Num Lock] plus [Alt] plus the appropriate digits, or
whatever variation is appropriate on your computer.
- THROW-AWAYS -
3.1.9. OUT-PUT FILE NAME:
PRINT-SAY creates a file containing a dBASE .PRG program when
it has finished asking its twenty questions. Each file it creates
must have a name. Each file name must be acceptable to MS-DOS.
See your DOS manual if that puzzles you. The name you enter here
may be a full drive and path name if it suits your purposes, such
as
\DBASE\WINIFRED\REPORT1.PRG
or
C:\ACCOUNTS\AUDIT\TRAIL\AR.PRG
- but will usually be only 1 to 8 characters followed by the
.PRG ending. In other words this file name follows the same rules
used when creating a database file or an index, except the
ending is .PRG. (If the above path examples are Greek to you -
relax! - that means you don't need to use them!)
The .PRG ending is not necessary but traditional for informing
the programmer which files contain his code. PRINT-SAY will add
the .PRG ending if it finds no period in your answer.
The DEFAULT file name is PRNTCODE.PRG;
However, whatever name you use, keep in mind that
----------------------------------------------------------
| ONLY ONE FILE WITH THAT NAME CAN EXIST AT THE SAME TIME! |
----------------------------------------------------------
on your diskette or hard disk sub-directory.
So if you use PRNTCODE.PRG, for example, more than once on the
same disk (or hard disk) the previous file will be over-written (and
therefore destroyed) by the new file. This is why PRINT-SAY will
check with you before using the same name a second time.
3.1.10. REPORT TITLE:
This is a descriptive phrase which you enter to head your re-
port. It should not be more than fifty-five characters long if
you are using 8 1/2" wide paper, or seventy characters long if
you are using 11" or 14" wide paper.
If you enter no report title: no problem - that header will
simply show a blank between the date and the page number.
3.1.11. DATABASE:
You know what this question wants, I'm sure. However, if you
press [Enter] without typing in a name PRINT-SAY simply leaves out
the USE SUCH&SUCH command from the file it is making. Program-
mers will occasionally do this.
3.1.12. INDEXES:
Ditto the above comments under DATABASE. In some cases you may
wish to list more than one index (separated by commas), even though
only the first one will affect the database and the printer report.
Multiple indexes are used in tasks like EDIT and APPEND and DELETE,
which modify a database, in order to keep all indexes current.
3.1.13. CONDITIONAL IF STATEMENT:
This is a more advanced feature - beginners should skip. An
"if" condition chooses which records will be listed (pass through
the filter) and which will not. A sample if filter is:
IF (TAKEHOME > 569) .OR. (TAKEHOME < 1100)
- which would allow only those records with a value for the field
TAKEHOME between $569 and $1100 to be printed in this report.
3.1.14. NUMBER OF FIELDS:
When you list a database you want to see a certain number of
its fields across the page; that's the number needed here. It
would be too dangerous and rarely useful to provide a default here,
so PRINT-SAY will not let you continue until you type in a digit
or two.
- FIELD-BY-FIELD -
3.2. FIELD QUESTIONS:
Once you have completed the fourteen questions asked by the Initial
Questions mode of PRINT-SAY, it enters the Field-by-Field mode. Field-
by-Field mode is a round-robin in which PRINT-SAY will ask you the same
small group of questions over and over again.
For each of the number of fields you entered in Question 14, you
will be asked the following questions:
3.2.1. FIELD TITLE:
Over each field, or column, in your print-out you may have a
descriptive heading title. With the dBASE LIST command you are
forced to accept the name of the field, itself. Here, you have a
choice; however, it is best to keep the title from being signifi-
cantly longer than the width of the column it heads when possible.
3.2.2. FIELD CONTENT:
This is the actual field name you assigned to the field when you
created the database. It is usually helpful to LIST STRUCTURE TO
PRINT before running PRINT-SAY to refresh your memory for these
field titles and their sizes (next question). Advanced dBASE
users may want to enter some tricky phrases here like
TRIM(SURNAME) + ', " + TRIM(FIRSTNAME)
or
SUBSTR(CREDITLINE,1,6)
or
B->M_EMPL_DATE
which allow the raw field contents to be modified accordingly.
If the field title you entered in the previous question is the
same as the actual field name in the database, you may press
[Enter] to default to your last answer.
One disappointment: MEMO fields cannot be printed with PRINT-
SAY. Sorry!
3.2.3. IS FIELD NUMERIC:
This question is needed so PRINT-SAY can determine whether or
not to ask questions 5 and 6. Answer yes for any field that shows
an "N" in the "Type" column of the LIST STRU printout; answer no
for all other field types: character, date, logical.
3.2.4. FIELD SIZE:
This is the width of the field in question as shown in the LIST
STRUCTURE of the database. Or, for tricky users, it may be some
number smaller than the full amount if the answer to the previous
question was also tricky.
Because this number is so vital to PRINT-SAY, it will not let
you continue until you've entered one or two digits and pressed
[Enter].
3.2.5. NUMBER OF DECIMALS:
This question and the next are only asked for a field to which
you answered "yes" to Question 3 (Numeric). Enter the number of
decimals shown in the "Dec" column from the LIST STRU printout.
3.2.6. SUB-TOTALS:
If you want your report to show a running total of this field
at the bottom of each page, answer with a "T".
A note on sub-totals: PRINT-SAY gives the sub-total two extra
digits to allow for the fact that adding up the contents of fifty
numbers in a given column may create a larger number than is pro-
vided for in the structure of the database for that field.
Once you have answered all questions to its satisfaction, PRINT-SAY
will write the .PRG file to disk for you to use or modify, as you
would any other .PRG file.
3.3. PRINTSAY.DAT AND RE-USABLES:
PRINT-SAY also creates a second file, PRINTSAY.DAT, which contains
your answers to the first eight (Re-Usable) questions. Thereafter,
each time you use PRINT-SAY it will read your answers to the first
eight questions from this file and offer them as the answers for these
eight questions - while allowing you a chance to revise them if you
desire.
Each time you use PRINT-SAY it will ask if you wish to save the
RE-USABLES answers you provided. If you have made any changes during
this session with PRINT-SAY which you will probably use the next time
then answer with an "s" to save; otherwise enter an "f" to forget the
changes. If you answer "s", PRINTSAY.DAT is updated to match your
current RE-USABLES.
PRINTSAY.DAT is for PRINT-SAY's use: you need not worry about it.
(Nor in sharing PRINT-SAY with another user do you need to include it
on his diskette.) If PRINTSAY.DAT is missing PRINT-SAY simply proceeds
to make a new one.
Hard-disk users: PRINT-SAY attempts to find PRINTSAY.DAT in the cur-
ent working directory and to update or create it there, as well. Keeping
PRINTSAY.DAT with your work in a sub-directory has the advantages of al-
lowing you to have different sets of Re-Usable answers for different
projects and of allowing more than one user of PRINT-SAY on the same
machine. On the other hand, if you wish to keep PRINTSAY.DAT in some
other sub-directory, not finding a copy in the current directory,
PRINT-SAY will ask you for the path to the directory you are keeping
it in. (If you don't have a copy in this other sub-directory, you must
put one there before starting PRINT-SAY.)
SECTION 4
- Clique.dbf: Taking a Guided Tour -
4.1. GETTING STARTED:
The best way to get a handle on something new is to follow an
example case from beginning to end. On your distribution diskette
you will find a dummy database called Clique. To get started, USE
CLIQUE and BROWSE or EDIT a bit to take a look around, then
LIST STRU TO PRINT to get a printout of its field structure like
this:
. use clique
. display structure
Structure for database: B:clique.dbf
Number of data records: 17
Date of last update : 03/24/87
Field Field Name Type Width Dec
1 SURNAME Character 20
2 FIRST Character 15
3 TITLE Character 4
4 STREET Character 30
5 CITY Character 20
6 PROV Character 15
7 ZIP Character 7
8 PHONE Character 8
9 DUES_PAID Numeric 6 2
10 DATE_PAID Date 8
** Total ** 134
Type RUN PRINTSAY (or simply PRINTSAY , if you must work from
the DOS prompt). The screen will fill up with turquoise boxes
(if you have a colour monitor, that is). If you have used PRINT-SAY
before you will be asked for the answer to Question 8; if this is
your first time through it will naturally ask for the answer to
Question 1 - for simplicity let's start with Question 1. So if
your have used PRINT-SAY before and you want to follow through
with this tour, enter the command RUN DEL PRINTSAY.DAT at your
dot-prompt (or the same command without the RUN at the DOS prompt).
This will clear away the "Re-Usable Answers" stored from your
previous run - no great loss, since they're so easy to re-enter.
4.2. THE RE-USABLE QUESTIONS:
Press the [Caps Lock] key then type in the following: "MOOSE FALLS
CLUB OF VERY IMPORTANT PERSONS" then press [Enter] to let PRINT-SAY
know when you've finished. (You needn't type the quotes - they're
only there to mark off the answer.) As you type your text appears
in the bottom window labeled YOUR ANSWER.
As soon as you press the [Enter] key your MOOSE FALLS entry popped
into the big window and the QUESTION and DEFAULT prompts changed to
present Question 2, which asks for your name. This may seem nosy
of PRINT-SAY, but all it wants to do is to give you credit as the
programmer in the .PRG file it is creating as we go. Type in your
name and press the [Enter] key again. Question 3 appears.
Let's practice laziness and get rid of Question 3's irritating
technicality in one stroke - tap a finger on the [Enter] key. This
is technically known as accepting the default, which means that the
answer offered up in the DEFAULT window is transferred to the LIST
OF RESPONSES window and PRINT-SAY swallows the answer "Absolute",
just as if you knew what the heck you were talking about.
Now the fourth question appears - let's be lazy here, too: zap in
the default "Yes" answer. Probably you can do the same thing for
the next two questions as well, unless you've got wide paper in
your printer right now and are too lazy to change it to normal 8.5"
width paper for this exercise. Given the power of the path of least
resistance, let's change the default for Question 7 to accept a
separator width of "3". (Don't know what that means? See Section
3.1.7.) Then let's accept the default for Question 8.
Now we've finished the Re-Usable Answers Section. Your responses
to these first eight questions will be saved in a file and recalled
each time PRINT-SAY is re-started from the directory you are now in.
(Nothing is forced on you, however: you will be offered a chance to
revise the answer to each and every question in PRINT-SAY before it
goes on to do its work.)
4.3. THROW-AWAYS:
For Question 9 you COULD accept the default, as well: but it's a
bad habit to get into, given the casual way DOS destroys files by
writing over them whenever a new file is created with the same name
and path. Therefore, type in "REPORT-A" and press [Enter]. Notice
PRINT-SAY has added the .PRG extension for you.
Question 10: type in "STATEMENT OF BALANCE OF DUES" and press
[Enter]. Question 11: answer "CLIQUE", which is the name of the
.DBF file we're using for this exercise. For Question 12 answer
CLIQNAME, which is the index provided, which is keyed to the SURNAME
and FIRST fields. (Of course, if we wanted to keep more than one
index open we would type their names with the active one first and
the rest separated by commas.)
For the second-last question press [Enter] again to accept the
default answer of NONE. For the last question type in the numeral
"8" and press [Enter]. Now the right half of your screen should
look like this:
--LIST OF RESPONSES:-------------------
| |
| <- Re-Usable Answers -> |
| |
| 1.Logo Header->MOOSE FALLS CLUB OF V|
| 2.Your Name--->A. PROGRAMMER |
| 3.Absl/Rel.--->Absolute |
| 4.Compress OK->Yes |
| 5.Page Width-->8 |
| 6.Page Length->11 |
| 7.Separators-->3 |
| 8.Bar Chrcter->= |
| |
| <- Throw-Aways -> |
| |
| 9.Output File->REPORT-A.PRG |
| 10.Job Title-->STATEMENT OF BALANCE |
| 11.Database--->CLIQUE |
| 12.Indexes---->CLIQNAME |
| 13.Filter----->None |
| 14.# of Fields>8 |
| |
---------------------------------------
4.4. REVISIONS:
Voila! The box titles turned green and the QUESTION box indicates
the PRINT-SAY is now accepting offers to change previous answers.
For practice let's try this out: type in "7" and press [Enter]. Enter
the number "2". Since it responds by offering to accept another
change, enter a "9". Too lazy to think of a new title? - No prob-
lem: simply press [Enter] before you type anything else and the old
answer is preserved. O.K. let's back out of REVISION MODE by press-
ing [Enter] one more time.
4.5. FIELD QUESTIONS:
Now the box titles turn yellow and the QUESTION box wants the first
field title. (This is NOT the same as the field NAMES you get from
LIST STRU printout. PRINT-SAY calls those `field contents'.) In-
stead, what is wanted here is the phrase you want to appear over the
first column of data in the report we are making. We're going to be
creating a report which lists the title, last name, first name, street
address, phone number, dues paid, dues owing, and date of payment for
each club member. Thus, the first field will need a name indicating
that it will contain each member's "title", I can't think of anything
better than that in this case so type in "Title".
PRINT-SAY responds by changing the question to `Enter field #1
contents:'. Now PRINT-SAY wants to know the actual field name, which
our LIST STRU printout says is also TITLE, so in this case we can be
lazy again and press the [Enter] key to accept the default offering
to use the field title as the field contents name.
The LIST STRU shows a "C" under the "Type" column for this field
so we will answer the new question 'Is field #1 numeric [T/F]?'
with an "F" (or just an [Enter] key-press). It may also be worth-
while to note here that the answer to the numeric question comes from
the "N" in the LIST STRU print-out. Some fields may contain numbers,
for example in an address or phone number, yet be declared as char-
acter fields to prevent dBASE performing arithmetic on them.
The printout shows the size of the TITLE field to be 4, so enter a
"4" as the answer to the next question.
4.6. REPEATING THE PROCESS:
That takes us once through the FIELD-BY-FIELD loop. Essentially,
now we need to repeat this process for the next four fields. This
will take much longer to read about than to do, so let me simplify
things by presenting the answers in a table:
|-LIST OF RESPONSES:------------------|
| |
| 1a.Title->Title |
| 1b.Data-->TITLE |
| 1c.Size-->4 |
| |
| 2a.Title->Last Name |
| 2b.Data-->SURNAME |
| 2c.Size-->20 |
| |
| 3a.Title->First Name |
| 3b.Data-->FIRST |
| 3c.Size-->15 |
| |
| 4a.Title->Street Address |
| 4b.Data-->STREET |
| 4c.Size-->30 |
| |
| 5a.Title->Phone No |
| 5b.Data-->PHONE |
| 5c.Size-->8 |
|-------------------------------------|
So far you will have answered "F" each time the question 'Is field
#1 numeric [T/F]?' is asked.
4.7. HANDLING NUMERIC FIELDS:
The next two fields are a little different in that we are going
to answer "True" to the numeric question. So for the first quest-
ion (field title) answer "Dues Paid"; for the next (field contents)
answer "Dues_Paid"; for the next enter "T" to indicate that the
field is in fact numeric; for the size enter "6". Now, because
we finally did admit to having a numeric field, PRINT-SAY asks two
new questions. For the number of decimals enter "2"; for whether
or not we want sub-totals answer "T" again.
The title for field #7 will be "Dues Owing" - fine; but for its
contents let's do something a little different: enter:
"100 - Dues_Paid". The annual dues for the V.I.P. Club are $100,
so, if anyone's Dues_Paid field contains a number less than 100,
this formula will show the difference, which is of course the amount
of dues that member still is owing. For the rest of #7's questions
answer the same as for #6, above.
|-LIST OF RESPONSES:------------------|
| |
| 6a.Title->Dues Paid |
| 6b.Data-->DUES_PAID |
| 6c.Size-->6N 2Decs Sub-Totals |
| |
| 7a.Title->Dues Owing |
| 7b.Data-->100 - DUES_PAID |
| 7c.Size-->6N 2Decs Sub-Totals |
| |
| 8a.Title->Date Rec'd |
| 8b.Data-->DATE_PAID |
| 8c.Size-->8 |
| |
Field #8 - the last - is not numeric and follows the pattern of
the first five questions.
4.8. FIELD-BY-FIELD REVISIONS:
Now, technically, you've answered all questions and are done.
However, PRINT-SAY has switched back to answer-revision mode in
case you have any second thoughts about your field-by-field entries.
Let's experiment with this just as a learning experience.
Enter a "1" to revise the first field. You are taken through
the whole question-cycle again for this field; however, we don't
want to change anything about this field except its size. Press
[Enter] thrice, therefore, to by-pass changing the first three an-
swers. Now PRINT-SAY is asking 'And field #1 size [1-99]:' again;
this time enter 99! PRINT-SAY responds by accepting this with a
error warning where it displays the accumulated width and pitch and
asks if there is anything else you would like to change. Press [Enter]
to accept the exit default - now we've really got an ERROR message!
That's why we entered 99 above: to test out this safety feature in
PRINT-SAY.
What PRINT-SAY is upset about is that, even when it tried using
the smallest, compressed pitch, it still couldn't stuff a 99-width
field together with the two 6-width and the one 8-width fields across
one 8.5" wide sheet of paper. Compressed allows 137 characters across,
minus a small safety margin leaving 134; we're asking for 144, which
leaves 10 characters out in the cold, off to the right of the page.
We are here offered a chance to change any or all of the three fac-
tors which affect this problem: the page-width, the field column-
width, and the separator-width. Let's choose "F" to go back into
answer revision mode. Follow the procedure in the last paragraph
to revise the first field and reduce its field size back to 44.
Press [Enter] to exit revision mode and - voila! PRINT-SAY is happy.
Press the "E" key to exit the error-correction module; PRINT-SAY
makes all its calculations and first writes a file to disk called
PRINTSAY.DAT, which stores your answers to the first six (re-usable)
questions, then writes a file with the name we've assigned:
REPORT-A.PRG, to disk and exits, returning us to the dull, ordinary
world of the dot prompt.
4.9. RUNNING THE REPORT:
And that is that! You've created a full-fledged official dBASE
.PRG file. Want to see it? - at the dot prompt type MODI COMM
REPORT-A and [Enter]. This puts you into dBASE's built-in primitive
text editor, where we can see the .PRG file's dBASE code. Use the
[PgDn] and [PgUp] keys to browse through this file, then press the
[Esc] key to exit when done looking.
To run the .PRG file type DO REPORT-A , now, at the dot-prompt.
The screen is re-written with a header and a set of instructions
prompting the user to turn on and adjust the printer then press
any key to start printing. (To back out press the [Esc] key again.)
4.10. WHERE TO GO FROM HERE:
If you're not already a dBASE programmer your next step is to
make use of the knowledge you've gained so far. After you've used
PRINT-SAY for a week or three go on to read the second half of this
manual, PRINTSAY.DOC, and take a step-by-step tour through the pro-
cess of making modifications to a .PRG file.
* PRINTSAY.COM, PRINTSAY.DOC and CUSTMIZE.DOC are (c) Copyright
1988, by Dale Cotton, Toronto, Canada.
All Rights Reserved.