
              STARTING
  Here's how to handle databases by using Q&A versions 3 and 4 
for DOS.

          Prepare yourself
  Before using Q&A to handle databases, practice using Q&A to 
handle word processing, by reading pages 172-182. For example, I 
assume you've followed the instructions on page 172 about how to 
``Make Q&A act better''.

            The main menu
  By following the instructions on page 172 about how to ``Run 
Q&A'', make the computer display this Q&A main menu:
Q&A MAIN MENU
F - File
R - Report
W - Write
A - Assistant
U - Utilities
X - Exit Q&A
  If you're using version 4 and have a mouse, you'll see a small 
red rectangle in the middle of the screen. Move that rectangle 
out of the way ___ to the screen's top right corner ___ by 
rolling the mouse toward your desk's back right corner.

            The file menu
  To make Q&A handle databases, choose ``F - File'' from the main 
menu by pressing the F key. (That works if you followed the 
instructions on page 172 about how to ``Make Q&A act better''. If 
you did not follow those instructions, you must press ENTER after 
pressing F ___ and you must press ENTER after choosing any item 
from any menu.)
  The screen shows the file menu. In version 4, it looks like 
this:
Ŀ
               FILE MENU             
Ĵ
 D - Design file    R - Remove      
 A - Add data       M - Mass update 
 S - Search/update  T - Post        
 P - Print          U - Utilities   
 C - Copy                           

(Version 3 lacks ``T - Post'' and ``U - Utilities''. You see ``B 
- Backup'' instead.)
  Whenever you're done filing, you should return to the main menu 
by pressing the Esc key several times. Then you can exit by 
pressing X. That's the only correct way to stop using Q&A's 
database. Do not just turn off the power! If you turn off the 
power without pressing X first, you might wreck the data files 
you created.
                                                  Field commands
                                         While using the filing 
part of Q&A, you can give these field commands:
Field command                                      Keys to press
Add new records                                    Ctrl F6

Calculate                                          F8
Calculate mode                                     Shift F8
Customize file                                     Shift F9

Date                                               Ctrl F5
Delete field/line                                  Shift F4
Delete field/line end                              Ctrl F4
Delete record                                      F3
Delete word                                        F4
Ditto field                                        F5
Ditto record                                       Shift F5

Edit field                                         F6

File menu                                          Shift F10

Help                                               F1

Macro                                              Shift F2
Macro run                                          Alt F2just in 
version 4
Mask override                                      Alt F4just in 
version 4

Next record                                        F10

Previous record                                    F9
Print record                                       F2
Print remaining records                            Ctrl F2

Reset @NUMBER                                      Ctrl F8
Retrieve spec                                      Alt F8just in 
version 4

Search for records                                 F7
Search options                                     Ctrl F7

Table                                              Alt F6
Table definition                                   Shift F6
Time                                               Alt F5

Undo edit                                          Shift F7just 
in version 4

Values permitted                                   Alt F7just in 
version 4
Put that chart (or a photocopy of it) next to the computer.
                                         The rest of this chapter 
explains how to use the file menu and the field commands.

             DESIGN FILE
  Here's how to design a new file. From the file menu, choose ``D 
- Design file'' (by pressing D).
  That makes the computer show the design menu. In version 4, it 
looks like this:
DESIGN MENU
D - Design a new file
R - Redesign a file
C - Customize a file
P - Program a file
S - Secure a file
A - Customize application
(In version 3, the bottom three choices are missing.)
  Look back on page 148, at the sample file of students in the 
School of Life. Let's create that file and call it STUDENTS. To 
do that, press the D key (which chooses ``D -Design a new file'' 
from the menu), type ``students'', then press ENTER.

            Type the form
  Most of the screen will become blank. On the blank screen, type 
a form, which you'll fill in later. For example, if you want to 
store each student's last name, first name, age, and class, plus 
comments, type this form:
Last name:                              First name:
Age:                Class:
Comments:
Here's how. Type the word ``Last'', then a space, then the word 
``name'', then a colon. Move to the right (by holding down the 
right-arrow key or space bar or TAB key), then type the phrase 
``First name'', then a colon. Press the ENTER key, and type the 
lines underneath.
  That form creates five fields: last name, first name, age, 
class, and comments. Each field name ends with a colon.
  When you've finished typing the form, copy it onto the hard 
disk, by pressing the F10 key.

        Examine the T screen
  On the screen, you'll see the form you typed. The computer 
automatically puts a T in each field, so your screen looks like 
this:
Last name: T                            First name: T
Age: T              Class: T
Comments: T

                                                  Move the cursor
                                         The cursor's at the 
first T. To move the cursor around the screen, you can use the 
arrow keys.
                                         To move the cursor 
faster, use the TAB key (which is next to the Q key). When you 
press the TAB key, the cursor moves to the next field.
                                         For example, if the 
cursor's at the T for ``Last name'', and you press the TAB key, 
the cursor will move to the T for ``First name''. If you press 
the TAB key again, the cursor will move to the T for ``Age''.
                                         Experiment! Try moving 
the cursor around the screen by using the TAB key.
                                         Unfortunately, the TAB 
key is hard for your fingers to reach. To move the cursor more 
easily, tap the ENTER key instead. (While you're manipulating a 
form, the ENTER key imitates the TAB key.)
                                         So to move the cursor 
ahead to the next field, tap TAB or ENTER. To move back to the 
previous field, tap TAB (not ENTER) while holding down the Shift 
key.

                                                   Change T to N
                                         Each T on the screen is 
a format code; it stands for ``Text''. If you want a field to 
contain a number instead of text, change that field's T to an N.
                                         For example, since you 
want the person's ``Age'' to be a number, you must change Age's T 
to N. To do that, move the cursor to the Age's T (by pressing the 
TAB key), then type N.
                                         You can type either N or 
n. The computer doesn't care about capitalization.
                                         Also change Class's T to 
N, so your screen looks like this:
Last name: T                            First name: T
Age: N              Class: N
Comments: T
That tells the computer that the person's age and class are 
Numbers, and everything else about the person consists of words 
and other general Text.
                                         Use the N code just for 
numbers that are simple (such as 0, 7, 2150, .2, .09, and -31.8).
                                         Use the T code for 
numbers that contain dashes (such as phone numbers) and for long 
numbers that can begin with 0 (such as ZIP codes). Use the T code 
for social security numbers, since they contain dashes and can 
begin with 0.

                                                      Finish
                                         Press the F10 key. The 
computer will say GLOBAL FORMAT OPTIONS.
                                         Press F10 again. You'll 
see the file menu again.
                                         Congratulations! You've 
created a STUDENTS database on your hard disk! That database 
consists of two files (STUDENTS.DTF and STUDENTS.IDX) in the QA 
subdirectory.

                    ADD DATA
  You've seen how to make the computer put a file called STUDENTS 
onto the disk. Although the file is organized so that each record 
will consist of five fields, the file doesn't contain any records 
yet, since it doesn't yet contain the names and data about any 
specific students.
  To add the names of specific students and the data about them, 
choose ``A - Add data'' from the file menu (by pressing A). Press 
ENTER.
  The screen will show the form you designed:
Last name:                              First name:
Age:                Class:
Comments:
Then fill in the blanks.
  For example, suppose one of the students is Suzy Smith. Fill in 
the form to look like this:
Last name: Smith                        First name: Suzy
Age: 4              Class: 12
Comments: Though just 4 years old, she finished high school 
because she's fast.
Here's how. Type Smith, then move the cursor to the next field by 
pressing ENTER (or TAB). Type Suzy, then press ENTER. Type 4, 
then ENTER. Type 12, then ENTER. Type the commentary sentence.
  When you've finished filling in Suzy Smith's form, say ``Next 
record'' (by pressing F10). Then the computer will show a blank 
form again:
Last name:                              First name:
Age:                Class:
Comments:
Fill in the blanks again, for the next student (Clara Bell).
  Repeat that process for each student. As you type the students' 
records, the computer automatically copies them to the 
STUDENTS.DTF file (which is in your hard disk's QA subdirectory).

                 Move the cursor
  To move the cursor a short distance, use the arrow keys. Here's 
how to move the cursor farther:
Keys you pressWhere the cursor will move
TAB         the next field
Shift with TABthe previous field

HOME        the beginning of the field
END         the end of the field

HOME HOME   the first field on the screen
END END     the last field on the screen

F10         the next record
F9          the previous record

Ctrl with HOMEthe first record you added during this session
Ctrl with ENDthe last record you added during this session

                     Delete
  If you make a mistake, point at it (by moving the cursor 
there), then tell the computer how much to delete.
  To delete just one character, press the Del key. To delete a 
whole word, say ``Delete word'' (by pressing F4). To delete 
everything you typed in the field, say ``Delete field/line'' (by 
pressing Shift with F4). To delete everything you typed in the 
whole record, say ``Delete record'' (by pressing F3); when the 
computer asks ``Are you sure?'', press Y.

                      Ditto
  If you move the cursor to a field and then say ``Ditto field'' 
(by pressing F5), the computer will make the data in that field 
be a copy of the previous student's. To make the entire record be 
a copy of the previous student's, say ``Ditto record'' (by 
pressing Shift with F5).
                                                   Edit (just in version 4)
                                                     If you have 
version 4, try this trick: while you're typing words in a field, 
say ``Edit field'' (by pressing F6).
                                                     A gigantic 
box will appear at the bottom of the screen. The words you typed 
appear in that box. Since the box is big, it can hold lots of 
words. Type as many as you wish! You can even type a long essay 
about the student! When you type near the box's bottom, the text 
in the box automatically moves out of the way, so you can type 
even more! You can type many pages! While you're typing them, 
you're using Q&A's word processor, so you can use all the 
word-processing tricks you learned: press ENTER at the end of 
each paragraph, press TAB to indent a paragraph, and use page 
154's table to give advanced word-processing commands (such as 
``Spell'' and ``Thesaurus'').
                                                     When you 
finish typing in the box, press the F10 key.
                                                     In the 
future, whenever you want to see or edit that boxed essay again, 
move the cursor to that field and say ``Edit field'' (F6) again.

                                                            Finish
                                                     When you 
finish typing the last student's record, and you still see that 
record on the screen, say ``File menu'' by pressing Shift with 
F10 (instead of saying ``Next record''). Then the screen will 
display the file menu again (instead of waiting for you to type 
another record).

                  SEARCH/UPDATE
  To search through the file to find a particular student, choose 
``S - Search/update'' from the file menu (by pressing S). Press 
ENTER.
  The screen will show the form you designed again:
Last name:                              First name:
Age:                Class:
Comments:
If you fill in a few of the blanks, the computer will fill in the 
rest. For example, if you fill in just the last name (Smith) and 
press F10, the computer will find everybody whose last name is 
Smith. It will show you each Smith's record, one at a time.
  Whenever the computer finds a Smith's record, the computer 
pauses to let you look at the record and edit it. (Editing is 
also called updating.) To edit the record, move the cursor to the 
field you want to revise (by pressing TAB, ENTER, or arrow keys), 
then retype that field. (To hop to the screen's bottom field, 
press END twice; to hop back up to the screen's top field, press 
HOME twice.)
  When you finish examining and revising the record, choose one 
of these actions:
What you want to do nextWhat to say
see the next Smith  ``Next record'' (by pressing F10)
see the previous Smith``Previous record'' (by pressing F9)

see the first Smith Ctrl with HOME
see the final Smith Ctrl with END

see the file menu   ``File menu'' (by pressing Shift with F10)

delete this Smith & see the next Smith``Delete record'' (F3) then 
Y

undo the revisions  ``Undo edit'' (Shift F7, just in version 4)
undo the revisions & see the file menupress Esc, then usually Y

search for other records (not Smiths)``Search for records'' (by 
pressing F7)
create other records & add them to file``Add new records'' (by 
pressing Ctrl with F6)
  If the computer can't find who you're searching for (because 
there aren't any Smiths or there isn't any ``next Smith'' or 
``previous Smith''), the computer will say ``No forms'' or ``No 
more forms'' or ``No previous form''. Press the Esc key, which 
makes the computer show the file menu.

             Fancy search techniques
  If you tell the computer to search for ``smith'' instead of 
``Smith'', the computer will still find all the Smiths, since the 
computer doesn't care about capitalization.
  If you tell the computer to search for ``S..'' instead of 
``Smith'' (by putting ``S..'' in the last name field), the 
computer will get everybody whose last name begins with ``S''. 
Saying ``..th'' gets names ending with ``th''. Saying ``..m..'' 
gets names containing an ``m''. Saying ``S..h'' gets every name 
that begins with S and ends with h. Saying ``S????'' gets every 
name that contains an S followed by exactly 4 more letters.
  Not The symbol for ``not'' is ``/''. For example, saying 
``/Smith'' gets everybody whose name is not Smith. Saying 
``/..m..'' gets every name not containing an m.
  Or The symbol for ``or'' is ``;''. For example, saying 
``Smith;Bell'' gets everybody named Smith or Bell.
  Unsure of the spelling? Suppose you want to find Kosinski's 
record, but you can't remember how he spells his name. You don't 
remember whether it's ``Kosinski'', ``Cosinski'', ``Kozinski'', 
``Kosinscki'', or ``Kosinsky''; you remember merely that it 
includes the letters ``in''. If you put ``..in..'' into the last 
name field, the computer will find everybody whose name contains 
``in'' ___ and it will find Kosinski's record.
  Suppose somebody phones to ask you about a student; but the 
phone connection is poor (with lots of static) and the person 
also mumbles. You think he's asking about somebody named 
``Cuzomskuh'', but you're not sure. Tell the computer to find all 
the students that sound like ``Cuzomskuh''. To do that, put 
``~Cuzomskuh'' in the last name field. The symbol ~ means 
``sounds like''. (On the original IBM keyboard, it's next to the 
ENTER key; on the new IBM keyboard, it's next to the 1 key; on 
the Leading Edge keyboard, it's next to the BACKSPACE key. While 
typing it, you must hold down the Shift key.) The computer will 
find Kosinski and any other students that sound like 
``Cuzomskuh''.
                                                     Search on 
age If you fill in just the age, the computer will find everybody 
that age. For example, to find everybody who's 10 years old, put 
``10'' in the age field.
                                                     To find 
everybody who's less than 10 years old, say ``<10''. For greater 
than 10, say ``>10''. For greater than or equal to 10, say 
``>=10''. For greater than 10 but less than 18, say ``>10..<18''.
                                                     To find the 
oldest student, say ``max''. To find the youngest, say ``min''.
                                                     To find the 
3 oldest students, say ``max3''. The computer will show you the 
oldest student, then the next oldest, then the 3rd oldest.
                                                     In the age 
field, if you say just ``='' (instead of ``=10''), the computer 
will find everybody whose age is equal to nothing: it will find 
everybody whose age was left blank. To find everybody whose age 
is not blank, ask for ``/=''.
                                                     Alphabetical 
order The computer understands alphabetical order ___ the order 
in which words and names would appear in a dictionary.
                                                     For example, 
if you ask for the names that are ``<Smith'' (by putting 
``<Smith'' in the last name field), the computer will find all 
names ``less than Smith'', which means all names that come before 
Smith in the dictionary. Asking for ``>Smith'' gets you all names 
that come after Smith in the dictionary.
                                                     Search 
through comments If you search for ``..slow..'' in the comments 
field, the computer will find everybody whose comment mentions 
``slow''. It will find Clara Bell (who's ``Super-slow!'') and 
also find Heinz Ketchopf (``the slowest Ketchopf in the West'').
                                                     Unrestricted 
search If you leave all the fields blank so that you're not 
telling the computer to search for anything particular, the 
computer will show you all the records in the file, without any 
restrictions.
                                                     Expand a 
field If a field is too narrow to hold your search request, type 
as much of the request as fits in the field, then say ``Edit 
field'' (by pressing F6).
                                                     The computer 
will let you type the rest of the request at the bottom of the 
screen; do so. When you finish typing the request, move on to the 
next field (by pressing ENTER) or make the computer start 
searching (by pressing F10).
   Multi-field search
  Suppose you want to find everybody who's old and stupid. 
Specifically, suppose you want to find everybody whose age is 
over 40 and who still hasn't finished the second grade. Put 
``>40'' in the age field, and put ``<3'' in the class field.
  The computer will find Heinz Ketchopf (who's 57 years old and 
in the first grade) and Russy-poo Walter (who's 44 years old and 
whose class is 0). They're the students who are old and stupid.
  Suppose you want to find the students who are old or stupid. To 
do that, put ``>40'' in the age field, put ``<3'' in the class 
field, then say ``Search options'' (by pressing Ctrl with F7). 
Move the cursor down, then across to the word ANY. Press F10. The 
computer will find Buffalo Bob Smith, Heinz Ketchopf, Tricky Dick 
Nixon, and Russy-poo Walter, because each of them is either old 
or stupid.

          Sort
  When you've told the computer which records to search for, you 
normally press F10, which makes the computer start searching.
  Instead of just pressing F10, try doing the following: say 
``Calculate'' (by pressing F8), then type ``1a'' in the field 
that interests you most, then finally press F10.
  That makes the computer display the records in alphabetical or 
numerical order. For example, if you put ``1a'' in the last name 
field, the computer will display the records in alphabetical 
order, by last name. If you put ``1a'' in the age field instead, 
the computer will display the student records in order of age, 
starting with the youngest student.
  Putting the records into alphabetical or numerical order is 
called sorting.
  The usual kind of sorting is called ascending. When you type 
``1a'', the ``a'' stands for ``ascending''.
  If you type ``1d'' instead, you get the opposite kind of 
sorting, which is called descending. For example, if you put 
``1d'' in the last name field, the computer will display the 
records in reverse alphabetical order, beginning with any Z names 
and ending with A. If you put ``1d'' in the age field, the 
computer will display the student records in order of decreasing 
age, starting with the oldest student and ending with the 
youngest.
                             Suppose you put ``1a'' in the last 
name field and ``2a'' in the age field. The ``1a'' makes the 
computer sort by last name. If several students have the same 
last name (such as the Smiths), the age field's ``2a'' makes the 
computer ``break the tie'' by using the age: the computer will 
show you the Smiths from youngest to oldest. In that situation, 
the last name field is called the primary sort field; the age 
field (which is used only for breaking a tie) is called the 
secondary sort field. The ``1a'' means ``primary ascending''; the 
``2a'' means ``secondary ascending''.

                                                 Table
                             Suppose you search for youngsters 
(by saying ``Age: <18'' and then pressing F10). When the computer 
shows you the first youngster's record, say ``Table'' (by 
pressing Alt with F6). The computer will display this table, 
which shows the records of all youngsters simultaneously:

Ŀ
   Last name     First name         Age           Class        
Comments   

Ĵ
Smith          Suzy                         4             
12Though just 4
Smith          Buffalo Bob                  7              
2Boringly norm
Kosinski       Stanislaw                   16             
11He dislikes P


                             In that table, each row is a record. 
The top row is Suzy Smith's record. The bottom row is Stanislaw 
Kosinski's record.
                             Each column is a field. The left 
column is the ``Last name'' field. The last column is the 
``Comments'' field.
                             Since the screen is narrow, it shows 
just 5 thin columns. Look at Stanislaw Kosinski's ``Comments'' 
field. Since the column's too thin to show his entire Comments 
field (``He dislikes Polish jokes''), the column shows just the 
first few characters (``He dislikes P'') and a right-arrow (which 
tells you that the field contains more characters). Version 3 
doesn't bother to show the right-arrow.
                             If you're using version 4, you can 
edit the table while you stare at it. Just move the cursor down 
to the row you want to edit (by pressing the down-arrow key), and 
move the cursor across to the field you want to edit (by pressing 
the TAB key). Here's what to do next:
If you want to retype the field's info completely (and it's 
short), go ahead: retype it!
If you want to edit the field's info slightly (and it's short), 
just press F5 and then edit.
If the field's info is long (so you see ``''), do this: press 
F6, then edit, then press F10.
                             If a file contains more than 5 
fields, the table usually shows just the first 5 fields. If 
you're using version 4, you can see the other fields by pressing 
the TAB key several times.
                             Here's another way to see 5 
different fields (in both versions 3 and 4). Say ``Table 
definition'' (by pressing Shift with F6). In the five fields you 
want to see, type the numbers 1, 2, 3, 4, and 5. Make sure those 
numbers aren't in any other fields. Then press F10.
                             The screen's tall enough to show 17 
rows of the table. To see other rows of a long table, press the 
PgDn key.
                             After viewing the table, move the 
cursor to the row that interests you most, then press F10. The 
screen will show all details of that row's record.

                PRINT
  Whenever the screen shows a student's record, you can print 
that record on paper. Just say ``Print record'' (by pressing F2), 
then press F10.
  To have more fun instead, say ``Print remaining records'' (by 
pressing Ctrl with F2), then press F10. The computer will print 
the record, then print all subsequent records in the bunch you 
were examining or adding.

           The print menu
  To do fancier printing, get the file menu onto the screen, then 
choose ``P - Print'' (by pressing P). Press ENTER.
  The screen will show the print menu. From that menu, choose ``D 
- Design/redesign a spec''.
  Invent a name for the printout you'll create. The name can be 
up to 31 characters long, and it can even contain blank spaces. 
Type the name, then press F10.
  The computer will show a blank form. Fill in the blanks to tell 
the computer which records to print. For example, to print all 
the Smiths, put ``Smith'' in the ``Last name'' field; then press 
F10.
  The computer will show another blank form. Choose one of these 
three strategies. . . . 
Strategy 1: leave the form blank. That tells the computer you 
want standard printing. The computer will print all the record's 
fields, in the same positions that they appear on the screen.

Strategy 2: give coordinates. For example, if you type ``2,10'' 
in the last name field, the computer will print the student's 
last name on paper, 2 lines down from the top margin, and 
starting in the 10th space from the left margin. If you omit a 
field's coordinates, that field will be unprinted.

Strategy 3: use + and x. For example, if you type a ``+'' in the 
last name field, the computer will print the last name. If you 
type an ``x'' in the last name field, the computer will print the 
last name and then automatically do a carriage return, so the 
next field it prints will appear underneath. Any field you leave 
blank will be unprinted.
  When you've chosen one of those three strategies (and filled in 
the form appropriately), press F10.
  The computer will say ``FILE PRINT OPTIONS''. If you want the 
computer to print the field labels (so that the computer will 
print ``Last name: Smith'' instead of printing just ``Smith''), 
move the cursor down to ``Print field labels?'', then move left 
to ``Yes''.
  Press F10 again, then ENTER. The computer will print the 
records you requested, then show you the print menu again.
  If you want to repeat the printing, choose ``P - Print 
records'' from that menu. (In version 3, choose ``P - Print 
forms''.) Move the cursor to your printout's name. Press F10 then 
ENTER. The computer will repeat the printing and show you the 
print menu again.
  When you don't want to do any more printing, press Esc. you'll 
see the file menu again.
                                                      Report
                                         To print a fancy report, 
get the Q&A main menu. (To do that, get the file menu, then press 
Esc.) From the Q&A main menu, choose ``R - Report''. The screen 
will show a report menu. From that menu, choose ``D - 
Design/redesign a report'' (by pressing D). Press ENTER.
                                         Invent a name for the 
report you'll create. The name can be up to 31 characters long, 
and it can even contain blank spaces. Type the name, then press 
F10. (If you're using version 4, then choose ``C - Columnar 
report'' by pressing C.)
                                         The computer will show a 
blank form. Fill in the blanks, to tell the computer who to 
report on. For example, if you want to report on just the Smiths, 
put ``Smith'' in the ``Last name'' field. To report on everybody 
(which is what I suggest), leave the form blank.
                                         Press F10. The computer 
will show another blank form. This report will consist of several 
columns. Put 1 in the field that you want to be the leftmost 
column, 2 in the field that you want to be the next column, etc. 
For example, if you want the person's last name to be the 
leftmost column, the first name to be the next column, and the 
age to be the third column, type this:
Last name: 1                            First name: 2
Age: 3              Class:
Comments:
                                         Better yet, put an 
``as'' in the last name field, and put an ``a'' in the age field, 
like this:
Last name: 1,as                         First name: 2
Age: 3,a            Class:
Comments:
In the last name field, the ``as'' stands for ``ascending sort''; 
it forces the computer to print the last names in alphabetical 
order. In the age field, the ``a'' stands for ``average'': it 
makes the computer print the average age.
                                         When you finish filling 
in that form, press F10 twice, then ENTER. The computer will 
print this report:
Last name     First name       Age
---------     -----------     -----
Bell          Clara           21.00

Ketchopf      Heinz           57.00

Kosinski      Stanislaw       16.00

Nixon         Tricky Dick     78.00

Smith         Suzy             4.00
              Buffalo Bob      7.00

Walter        Russy-poo       44.00

=========     ===========     =====
Average:                      32.43
                                         Notice that the computer 
alphabetizes the left column, clumps the two Smiths together, and 
prints the average age. The computer automatically makes each 
column wide enough to fit even the longest names and numbers.
                                         When the computer 
finishes printing the report, it shows the report menu again.
                                         If you want to print the 
report again, choose ``P - Print a report'' from that menu (by 
pressing P). Press ENTER. Move the cursor to your report's name. 
Press F10 then ENTER. The computer will reprint the report and 
show you the report menu again.
                                         When you don't want to 
print any more reports, press Esc. You'll see the main menu 
again.
  Fancy codes Instead of saying ``as'' (for ascending sort), you 
can say ``ds'' (which gets you a descending sort).
  Besides telling you the column's average (for which the code is 
``a''), Q&A can also tell you the column's total (``t''), count 
(``c''), largest number (``max''), smallest number (``min''), and 
all subtotals (``st''). To make Q&A do so, just put those codes 
in the blanks.

             Mail merge
  Suppose you want to write a personalized letter to each 
student, so that Suzy Smith's letter will say ___ 
Dear Suzy,
Come to the party for grade 12 on Saturday.
and Clara Bell's letter will say ___ 
Dear Clara,
Come to the party for grade 10 on Saturday.
  Here's how. . . . 
  First, get into the word processor. (To do that, get to the 
file menu, then get to the main menu by pressing Esc, then choose 
``W - Write'' from the menu, then choose ``T - Type/edit'' from 
the next menu.)
  Type this form letter:
Dear *First name*,
Come to the party for grade *Class* on Saturday.
  To type it, begin by typing the word ``Dear'', then tap the 
space bar once.
  To create the ``*First name*'', do the following. Say ``Field'' 
(by pressing Alt with F7). The computer will ask you for the name 
of the file; type ``students'' then ENTER. The computer will 
display this list:
FIELD NAMES
Age
Class
Comments
First name
Last name
Move the cursor to ``First name'', then ENTER. The computer will 
automatically type ``*First name*'' in the middle of your memo.
  Then type the rest of the form letter. Remember to type the 
comma after *First name*, and remember that you can make the 
computer automatically type *Class* for you, by pressing Alt with 
F7.
  When you finish typing the form letter, say ``Print'' (by 
pressing F2). Then press F10.
  You'll see a blank form. Use it to say which students will get 
the letter. (For example, to send the letter to just the Smiths, 
put ``Smith'' in the last name field. To send the letter to all 
the students, leave the fields blank.) Press F10 then ENTER.
  The computer will print the letters to all the students you 
requested. That massive printing is called a mail merge, because 
the computer does it by merging the form letter with the mailing 
list of students.
  When the computer finishes, you'll be using Q&A's word 
processor again. To leave the word processor, press Esc twice; if 
the computer asks ``Are you SURE?'', press Y. You'll see the Q&A 
main menu.


       MASS MOVES
  Here's how to manipulate many records at once. . . . 

       Mass update
  Suppose Mr. Smith ___ the father of Suzy Smith and Buffalo Bob 
Smith ___ dies. His wife, Mrs. Smith, remarries and changes her 
name to Mrs. Finkelstein. She also changes the names of her kids, 
so that ``Suzy Smith'' becomes ``Suzy Finkelstein'', and 
``Buffalo Bob Smith'' becomes ``Buffalo Bob Finkelstein''.
  We must tell the computer to turn the Smiths into Finkelsteins. 
Since Suzy and Buffalo Bob are such wonderful kids, we'll also 
move them into super-advanced classes that are ten times their 
ages: we'll move Suzy (who is 6) into class 60, and move Buffalo 
Bob (who is 7) into class 70. Here's how to do all that. . . . 
  From the file menu, choose ``M - Mass update'' (by pressing M). 
Press ENTER. You'll see a blank form.
  Tell the computer who to search for. Since you want the 
computer to search for all the Smiths, type ``Smith'' in the last 
name field, then press F10.
                             You'll see another blank form. Tell 
the computer how to change the Smiths' records, by typing this:
Last name: #1="Finkelstein"             First name:
Age: #2             Class: #3=10*#2
Comments:
Notice you must put #1, #2, and #3 in the three fields involved 
(Last name, Age, and Class). To make field #1 (which is Last 
name) become Finkelstein, say #1=``Finkelstein''. To make field 
#3 (which is Class) become 10 times field #2 (Age), say #3=10*#2.
                             When you finish typing all that, 
press F10 then N. The computer will change the Smiths to 
Finkelsteins and make their classes become 10 times their ages. 
Then you'll see the file menu again.
                             How to make the whole school skip 
Suppose all the school's students are doing so well that you want 
to skip them ahead 5 years. (You'll move all the first graders to 
the 6th grade, all the second graders to the 7th grade, all the 
third graders to the 8th grade, etc.) Here's how. . . . 
                             From the file menu, choose ``M - 
Mass update''. Press ENTER. You'll see a blank form. Without 
typing any restrictions, just press F10 (since you want to update 
all students).
                             You'll see another blank form. Since 
you want to increase each student's class by 5, you should make 
the class be called ``field #1'' and add 5 to it. To do that, say 
``Class: #1=5+#1'', which means ``the Class is field #1; and 
field #1 will become equal to 5 more than what it had been.'' 
Then press F10.
                             The computer will increase each 
student's class by 5. Then you'll see the file menu.

                                                Remove
                             Suppose all the Finkelsteins are 
murdered. Let's remove them from the file.
                             To remove the Finkelsteins, choose 
``R - Remove'' from the file menu by pressing R. Press ENTER. (If 
you're using version 4, then choose ``S - Selected records'' by 
pressing S.)
                             You'll see a blank form. In the last 
name field, type ``Finkelstein''.
                             Press F10 then Y. The computer will 
delete all the Finkelstein records. Then you'll see the file menu 
again.

                                                Backup
                             Here's how to make the second copy 
of STUDENTS.
                             If you're using version 3, choose 
``B - Backup'' from the file menu by pressing B. If you're using 
version 4, choose ``U -Utilities'' from the file menu by pressing 
U, then choose ``B - Backup database'' by pressing B.
                             Press ENTER.
                             The computer will say ``Backup 
to:''. To copy STUDENTS to the disk in drive A, put a blank 
formatted disk into drive A, say ``Delete line'' (Shift F4), type 
``a:students'', then press ENTER. The computer will copy STUDENTS 
from the hard disk to drive A.
                             If you're using version 4, press Esc 
to see the file menu again.

                                                 Copy
                             Let's create a DOGS file about a 
dog-obedience school. We want the DOGS file to contain the same 
design that we used in the STUDENTS file, so a sample DOGS record 
will look like this:
Last name: McGregor                     First name: Lassie
Age: 2              Class: 12
Comments: She's a brilliant collie. Named after her grandma, a TV 
star!
                             Here's how to create the DOGS file, 
so it uses the same design as the STUDENTS file but doesn't 
contain the names of humans.
                             From the file menu, choose ``C - 
Copy'' (by pressing C). Press ENTER.
                             You'll see a copy menu. Tap the D 
key (for ``D - Copy design only''). Type the name of the new file 
you're creating (``dogs''), then ENTER.
                             The computer will create file called 
DOGS, having the same design as STUDENTS but without any data in 
it.
                             You'll see the copy menu again. 
Press Esc, to see the file menu again.

                    CUSTOMIZE
  You can customize Q&A to meet your personal needs.
  For example, let's create a database of all your friends and 
customers around the world. Let's store each person's address and 
phone number (to replace your phone book and Rolodex and create a 
mailing list). Let's also store comments about each person and 
date the comments, to make the file act as a diary.
  Suppose some of those people occasionally send you money. Let's 
record how much each person sends and make Q&A compute the 
totals, so Q&A does your accounting.
  Suppose you're in Massachusetts, and some of the money you 
receive is for goods you sell. Let's make Q&A compute the 5% 
sales tax, so Q&A does your taxes.
  Here's how to make Q&A do all that. . . . 

                  Type the form
  From Q&A's file menu, choose ``D - Design file'' (by pressing 
D). When you see the design menu, tap the D key (to choose ``D - 
Design a new file''), type ``friends'' (which will be the name 
for the file), and press ENTER.
  On the blank screen, type this form:

Ŀ
First name:                           Last name:                              

Department:                                          >                        

Company:                                             >                        

Address:                                             >                        

City:                       State:    Zip:           > Country:               



 Phone numbers:                                       >
                                                       
Ŀ
                                                       Price:                 

 Sales tax code (T=Taxable, R=Resale, N=Nonprofit):    Sales 
tax:             
                                                       Total:                 

                                                       

 Comments< 





                                                                               
>
                                        Group code:     Date:                  
>
  Boxes Notice that the form includes two boxes. The top box 
contains the fields for the mailing label. The bottom box 
contains the money fields.
  Here's how to draw a box. Place the cursor where you want the 
box's upper-left corner. Give the word-processing command for 
``Draw''. (To do that in version 3, press F8 then D. To do that 
in version 4, press F8 then L then D.) Move the cursor towards 
the right; as you move it, you'll be drawing the box's top line. 
Draw the box's other three lines by moving the cursor down, then 
left, then up until you've returned to the upper-left corner. 
Then press F10.
  The computer doesn't care whether you draw the box. The box's 
purpose is just to beautify the life of your data-entry operator 
(the person who'll be staring at the screen for many hours while 
entering your data).
  Six parts Like most good forms, that form consists of 6 parts 
in this order:
a box containing the mailing label's fields, in the order they'll 
appear on the label

other fields that the operator must fill in (phone numbers, 
price, and sales tax code)

fields that the operator will skip because they'll be filled in 
by computer (sales tax and total)

a big space where the operator can jot comments (such as ``this 
guy is a jerk'' or ``treat her nicer next time'' or ``oops ___ we 
goofed'' or ``discuss this tough order with the boss'' or other 
comments that are more specific)

a field for inserting a GROUP CODE, which is a code to generate 
selective mailings; for example, you can browse through all the 
records, put ``p'' in the ones that look interesting, and then 
tell the computer to send mail to each person whose group code is 
``p''

a field to hold the date (we'll make the computer insert the date 
automatically, but we'll also let the operator change the date to 
handle special situations)

                                                     Shortened 
fields Look at the ``Department'' field. It begins with the word 
``Department'', then comes a colon, then 42 blank spaces, then 
the symbol ``>''.
                                                     Later, when 
the data-entry operator adds new records to the file by typing in 
data, the computer will permit the operator to ``fill in the 42 
blanks'' by filling in 42 characters. The computer will prevent 
the operator from typing on or past the ``>''.
                                                     That 
prevents the operator from being too long-winded and typing too 
much to fit on tiny mailing labels.
                                                     Multi-line 
fields Look at the ``Comments'' field. It begins with the word 
``Comments'', then comes the symbol ``<'' (instead of a colon), 
then several blank lines. At the end of the last blank line, 
you'll see the symbol ``>''.
                                                     The symbols 
``<'' and ``>'' surround the area in which the operator can type 
comments. If you omit the symbol ``>'', the computer will 
restrict the operator to just one line of comments.
                                                     When you 
create a multi-line field, Q&A prohibits you from having other 
symbols nearby. Specifically, you can't put a multi-line field in 
a box, and you can't put two multi-line fields side-by-side.
                                                     Final step 
When you finish typing that form, press F10.
             Change the format codes
  You'll see the form you typed (except that the symbols ``<'' 
and ``>'' are hidden). The computer automatically puts format 
code T in each field, but you must change some of those T's to 
other codes instead. To do so, move the cursor to each T (by 
pressing TAB, ENTER, or arrow keys), then edit some of the T's, 
to make your screen look like this:

Ŀ
First name: T                         Last name: T                            

Department: T                                        >                        

Company: T                                           >                        

Address: T                                           >                        

City: T                     State: TU Zip: TU        > Country: 
TU            


 Phone numbers: T                                     >
                                                       
Ŀ
                                                       Price: MC 
JR           
 Sales tax code (T=Taxable, R=Resale, N=Nonprofit): TU Sales 
tax: MC JR       
                                                       Total: MC 
JR           
                                                       

 Comments T





                                                                               
>
                                        Group code: TU  Date: D                
>
  Here's why.
  Uppercase The state's format code should be TU instead of just 
T. The U means ``Uppercase''. It makes the computer automatically 
capitalize what the data-entry operator types.
  The format code for Zip should be TU because some of the 
customers are in Canada, where Zip codes have capital letters in 
them.
  Use T for phone numbers The format code for phone numbers is T 
(not N), so that the phone number field can contain more than 
just numbers. T lets you include phrases such as ``home number'', 
``work number'', ``extension'', and ``call after 4:30PM''. T also 
lets you include parentheses and dashes, like this: (617) 
666-2666.
  Money For money, the best format code is ``MC JR'', which means 
``Money with Commas and Justified Right''. For example, suppose 
the operator types this price: ``42831.7''. When the operator 
finishes typing it and moves to the next field (by pressing TAB 
or ENTER), the ``MC'' code makes the computer automatically 
insert a dollar sign and comma and put 2 digits after the decimal 
point, so the screen shows ``$42,831.70'' instead of just 
``42831.7''. Then the computer slides the $42,831.70 toward the 
right edge of the screen (because of the ``JR'' code), so that 
the decimal point is directly above the decimal points of numbers 
underneath.
  If you like all that but want the computer to omit the dollar 
sign, replace the ``M'' by ``N2'' (which means ``number with 2 
digits after the decimal point'').
  Time The format code for date is D. (A similar format code is 
H, which means ``hours and time of day''.)
  Finish When you've finished typing the format codes, press F10. 
If the computer says GLOBAL FORMAT OPTIONS, press F10 again. Then 
you'll see the file menu.

   The customize menu
  From the file menu, choose ``D - Design file'' again. From the 
next menu, choose ``C - Customize a file'' (by pressing C). Press 
ENTER.
  You'll see the customize menu:
CUSTOMIZE MENU
F - Format values
R - Restrict values
T - Field template
I - Set initial values
S - Speed up searches
D - Define custom help
C - Change palette
(Instead of ``T - Field template'', version 3 has ``P - Program 
form'', ``E - Edit lookup table'', and ``A - Assign access 
rights''.)
  Let's see how to use the most popular choices.
  Change palette To change the screen's colors, choose ``C - 
Change palette''. You'll see a blank form.
  Fill in a few fields, notice the screen's color scheme, and 
then press F8. The colors on the screen will change. (If you have 
a monochrome monitor, the underlines will disappear.)
  Each time you press F8, the colors, underlines, boldfacing, 
etc. will change again. When you finally see a color scheme you 
like, press F10, to return to the customize menu.
  The color schemes are called palettes. Many of the palettes are 
humorously wild.
  The bottom of the screen shows the palette's number. The most 
practical palettes are #2 and #3. They're the only palettes that 
show clearly which field you're editing.
  If your monitor is monochrome, choose palette #3. If your 
monitor is CGA color, choose palette #2. If your monitor is EGA 
or VGA color, choose either palette #3 (whose high contrast is 
the easiest to read) or palette #2 (whose soft blues will make 
you fall in love).
  Initial values To let your data-entry operator fill in the 
forms faster, choose ``I - Set initial values''.
  You'll see a blank form. If you fill in some of the fields now, 
the operator won't have to fill them in later.
  For example, if most of your customers are in San Francisco, 
California (because you grew up there and still advertise there), 
put ``San Francisco'' in the city field and ``CA'' in the state 
field. Put ``@date'' in the date field. Then press F10.
                             Later, when your data-entry operator 
adds new records, the computer will automatically fill in some of 
the fields by typing San Francisco, CA, and the correct date. The 
operator can edit what the computer typed, when the operator 
needs to deal with a customer that's not in San Francisco or not 
in California or whose record must be postdated.
                             Restrict values To protect yourself 
from data-entry errors, choose ``R - Restrict values''. You'll 
see a blank form.
                             Type in any restrictions you want to 
put on the data. For example, to restrict the price to under 
$50,000, type ``<50000'' in the price field. To restrict the 
sales tax code to T, R, or N, type ``T;R;N'' in the sales tax 
code field (after widening the field by pressing F6). When you 
finish typing the restrictions, press F10.
                             Later, if the data-entry operator 
tries to bypass a restriction (by typing a huge price or typing a 
wrong sales tax code), the computer will type this warning:
Value not in specified range.  Please verify before continuing.
Although the computer types that warning, the computer permits 
the operator to keep that unusual data in the file (so that the 
operator can handle unusual customers). The warning just alerts 
the operator that the value typed was nonstandard. That warning 
helps the operator notice typographical and clerical errors.
                             Speedy fields To make Q&A run 
faster, choose ``S - Speed up searches''. You'll see a blank 
form.
                             Type an S in each field that you 
often use for searching. For example, since you often look up a 
customer's record by using the customer's last name, type an S in 
the last name field. I recommend that you type an S in the last 
name field, company field, Zip field, and data field.
                             Putting an S in a field makes the 
computer create an index for that field. The index helps the 
computer search on that field more quickly. A field containing an 
S is called a speedy field or an index field.
                             Although the S makes the computer 
search faster, the S has two drawbacks: its index consumes a lot 
of space on the disk, and the computer must pause to update the 
index whenever you add a new record.
                             Because of those drawbacks, do not 
put an S in every field! Put an S in just the three or four 
fields that you search on most often.
                             When you finish typing the S's, 
press F10.

                                                Program
                             To get total control over the 
computer, program it!
                             If you're using version 4, choose 
``P - Program a file'' from the design menu, then press ENTER, 
then choose ``P - Program form''. If you're using version 3, 
choose ``P - Program form'' from the customize menu.
                             You'll see a blank form.
                             Let's make the computer 
automatically compute the Sales tax and Total. The computation 
involves four fields: the Price (which we'll call field #1), 
Sales tax code (#2), Sales tax (#3), and Total (#4).
Make the Price be field #1, by typing ``#1'' in the Price's 
blank.

Make the Sales tax code be field #2, by typing ``#2'' in the 
Sales tax code blank.

Make the Total be field #4 and also be the Price plus the Sales 
tax, by typing this in the Total blank: ``#4=#1+#3''.

In Massachusetts, which has a ``5% sales tax'', how much money 
should the Sales tax be? If a sale is taxable (because the Sales 
tax code is T), the Sales tax should be 5% of the Price. That 
means field #3 (which is the Sales tax) should equal .05 times 
field #1 (which is the Price). If the sale is not taxable, the 
Sales tax should be 0 instead. To explain all that to the 
computer, type this in the Sales tax blank (after pressing F6 to 
widen the field):
#3: if #2="T" then #3=.05*#1 else #3=0
When you type that line, make sure you type quotation marks 
around the ``T''. That line tells the computer that for this 
field (field #3), do the following computation: if field #2 (the 
Sales tax code) equals ``T'', then make field #3 equal .05 times 
field #1; otherwise, make field #3 equal 0.
                             After filling in the blanks that 
way, press F10. Later, when the data-entry operator enters a 
customer's record, the operator can fill in just the Price and 
Sales Tax code and then say ``Calculate'' (by pressing F8), which 
makes the computer obey your programming and automatically fill 
in the Sales tax and Total.