SPECIMEN DATABASES IN RESEARCH AND COLLECTION MANAGEMENT:

A PRACTICAL MANUAL FOR DBASE® AND WORDPERFECT® USERS


Nancy Hensold
Tropical Collections Specialist
Department of Botany
The Field Museum
Roosevelt Rd. at Lakeshore Drive
Chicago, IL 606052596

Contact: hensold@fmnh.org

Copyright Notice: “Specimen Databases in Research and Collection Management: A Practical Manual for dBase® and WordPerfect® Users” is copyright © 1995.

I, Nancy Hensold, grant you, the reader, permission to redistribute this document and to quote it in whole or in part, provided (1) that you make no charge for the copy OR for any document including the copy, and (2) that you include an attribution containing my name, address, and email address, the version date, and a network address from which a current version can be retrieved.


CONTENTS


Preface

Introduction

A. Database Design
A-1. General Considerations
A-2. The Field Museum’s Northern Peru Database - Explanation of Field Structure

B. Data Entry Protocol

C. Viewing dBase Files

D. Indexes and Information Retrieval
D-1. Creating an index from the menu
D-2. Using indexes
    D-2.1. Setting a database to indexed order
    D-2.2. Searching indexed files
    D-2.3. dBase settings which affect the SEEK command
    D-2.4. Notes on editing indexed files
D-3. Locating records without an index
    D-3.1. From the Menu: “Search”
    D-3.2. From the Command Line: “Locate”
E. Updating Database Files
E-1. Adding Determinations
E-2. Global editting and the REPLACE command
E-3. Proofreading
E-4. Database structure changes
E-4.1. Suggestions for splitting one field into two

F. Simple Statistics
F-1. COUNTing records which meet a condition
F-2. Using the command line for computations
F-3. The CALCULATE command

G. Creating Reports
G-1. The LIST command
G-2. The Report Generator (dBase IV)
    G-2.1. Designing a Report
    G-2.1.1. Basic procedure
    G-2.1.2. Notes on arranging field templates
    G-2.1.3. Using Group Bands
    G-2.2. Printing from an existing Report Form
G-3. Exporting ASCII text files to WordPerfect
G-3.1. Exporting data to WordPerfect Merge files (WP 5.1)
G-3.2. Exporting data to WordPerfect Data files (WP 6.0)
    G-3.2.1. Importing databases directly (custom installation required)
    G-3.2.2. Importing ASCII delimited text files
    G-3.3. Primary Merge (Form) files
    G-3.3.1. Designing a Primary Merge file (WP 5.1)
    G-3.3.2. Designing a Form file (WP 6.0)

H. Specialized Reports
H-1. Specimen Labels
    H-1.1. A dBase Labels Program for Data conversion
    H-1.2. WordPerfect Labels Format
    H-1.2.1. How Labels Format works
    H-1.2.2. Creating a Label Format file
    H-2. Annotation Labels
    H-3. Determination Lists
    H-4. Project Checklists

Acknowledgments

Literature Cited


Appendix 1. Using dBase Commands
1a. Scope & Condition Statements
1b. Index of Selected dBase Commands
Appendix 2. A Data Conversion Program for Specimen Labels
2a. LABELS.PRG
2b. Labels Program Auxiliary File Structures

FIGURES:
Figure 1. DETBASE File structure and Sample Record

Figure 2. Primary Merge (Form) Files - Examples
Fig. 2a. Specimen Label
Fig. 2b. Annotation Label


Preface

This manual was originally prepared for a workshop given at the "Simposio: Estrategias para Bioconservacion en el Norte del Peru," organized by the Universidad Antenor Orrego in Trujillo, Peru, July 27, 1995. A Spanish version will be published with the Symposium Proceedings in 1996.

These database structures and protocols evolved out of our own needs in handling incoming floristic project material. At no point was any attempt made to design an optimum herbarium computerization “system.” What this manual attempts to do is (1) to allow a beginner with limited resources to “hit the ground running,” realizing at the outset what options are available, and which design decisions are most critical; and (2) to reduce the amount of time spent crawling through software manuals. The best system, for any particular herbarium or research group depends on many local factors, including the volume of material being processed, the frequency with which various operations will be needed, and the skill level, turnover rate, and number of personnel involved with data entry and database maintenance.

In our case, I was the principal data entry person, and the limitation of our work to floristic project material limited the number of collector names, localities, etc., to be mastered. Therefore, we had little concern with spelling inconsistencies. In most cases and in the long term, the use of linked authority files for taxon, collector, and author names is desirable to reduce error and to save time in data entry. I have not yet tackled this problem in dBase but would be happy to hear from someone who has. I also appreciate any other helpful input on streamlining or refining any of the procedures described herein.

INTRODUCTION

Specimen databases are an invaluable tool for taxonomists, which have gained wide acceptance and accessibility in recent years. Databases not only facilitate research and information-sharing, but can greatly increase the efficiency of standard herbarium operations such as the generation of specimen labels, annotation labels, and determination lists. At the Field Museum, we have been databasing our incoming Peruvian material for several years using an IBM PC, and dBase® (Version IV for DOS or V for WINDOWS) database software in tandem with WordPerfect® (Version 5.1 for DOS or 6 for WINDOWS). This database, called “DETBASE,” serves the following functions:

1. Quick querying of northern Peruvian specimen data.
2. Generation of accession lists.
3. Generation of herbarium specimen labels (in conjunction with WordPerfect).
4. Generation of annotation labels.
5. Efficient generation of determination lists to send to the collectors, and (unlike the chit method) an easy way of sending multiple determination updates.
6. Tracking of duplicates.
7. Tracking special project collections.
8. Generating species checklists, for special project areas, political regions, or elevational ranges.
9. Generating exsiccatae lists and indexes to exsiccatae, for taxonomic treatments.
10. Calculating simple statistics.

This database is a simple “flat file” with a field structure comparable to that of other large mainframe databases. Field structure compatibility allows data-sharing with other institutions via “delimited” ASCII text files, regardless of the software in use.

A PC-based system offers great flexibility and accessibility to the individual investigator. However, it does require familiarity with software capabilities and command language, which can be tedious for a layman to acquire from documentation geared to commercial use. Therefore a manual of practical suggestions and protocols for using dBase in herbaria is presented here, with examples from our database, DETBASE.

These structures and protocols evolved out of our own needs in handling floristic project material, and not through an attempt to design an optimum herbarium computerization “system.” What this manual attempts to do is to allow a computer amateur to begin working with a database program, realizing at the outset what options are available, and which design decisions are critical.

This manual assumes a minimal familiarity with dBase, and the use of the command line, or “dot prompt”. Readers familiar with only the “Menu System” may find Appendix 1 helpful. Keystroke shortcuts referred to in the text apply to dBase IV for DOS.


A. DATABASE DESIGN

A-1. General considerations

The ideal specimen database is designed to allow: 1) ease of sorting specimen records into desirable categories or sequences; 2) efficient search, retrieval, and calculation of desired information; 3) efficient proofreading, editting, and updating; 4) data sharing with other institutions and individuals; and 5) efficient use of disk space.

As a general rule, it is best to parse the data into the smallest practical units. It is easier to combine data fields later than to separate them. The more data fields are recognized, the more ways it is possible to sort and index the specimens, and the easier it is to perform searches and queries. It is also easier to proofread and edit data for consistency when the fields are small.

Data entered in fields which are likely to be used for sorting or indexing the database should be monitored and held to a uniform format and spelling. For example, since you may frequently want to order database records or create reports which are sorted by the first collector’s name and number, it is important that the spelling of first collectors’ names be standardized. If the spelling is consistent, it can easily be modified later, if necessary, with a global replace command.

It is also best, when disk space is limited, to use standard abbreviations where practical, and to avoid repetitive words or phrases, such as “Depto.” or “Elevacion.” Simple protocols can be used to convert abbreviations or add repetitive verbiage when desired, either to the database directly or to a printed report. (For examples see Sections E-2 and H-1.)

In most database programs, the amount of space used is a direct function of the number of records times the sum of the maximum field lengths. Fields which are filled with information use as much space as empty fields. Therefore it is important not to make fields longer than necessary, and it is usually practical not to use fields which will only rarely contain information, such as a field for “Chromosome number.” Such information can be kept in a miscellaneous “notes” field if necessary.

The dBase software recognizes several field “types,” including Numeric, Character, Logical, and Date fields. A field is best designated as numeric when: a) only numbers will be entered in the field, and b) it is desirable to sort, index or perform calculations on the field. Numeric fields automatically right-justify their contents, whereas character fields left-justify and therefore do not sort numbers in true numeric order.

It is possible to reduce space usage by using several linked databases. For example, a list of unique taxon names can be stored in one database, and linked to specimen records kept in another database, through a unique reference number. This is a common practice for large databases, and it is possible to do so using dBase. However, it may not be necessary in a smaller database, which can be converted from a “flat file” to a relational design later, if necessary.


A-2. The Field Museum’s Northern Peru Database

Our Northern Peruvian vascular plant collections are entered as they arrive in a dBase IV (or V) file called DETBASE. The file structure of DETBASE, and a sample record is displayed in Figure 1. An explanation of the field contents follows.

1. CLASE - This field allows sorting of the major groups of taxa (PTEridophytes, GYMnosperms, MONocotyledons, DICotyledons) for floristic checklists. We currently use three-letter abbreviations. However, it may be more practical to use abbreviations (or numbers) which will sort the major groups in the order in which they normally appear in checklists.

2. FAMILIA - Use 3-letter family abbreviations as in Weber (1982).

3. GENERO - Genus name

4., 7. ESPECIES, SUBESPECIE - Specific and infraspecific epithets, respectively.

5., 8. AUTOR, AUTOR2 - Author(s) (including basionym author in parentheses) of species, and subspecific taxon, respectively. If possible, use standard abbreviations, as in Brummitt & Powell, 1992.

6. VAR_SSP - Rank of subspecific taxon (f., ssp., or var.)

9. AFF_CF - This field is for abbreviated comments, or “qualifiers” on the determination. It is usually not important that these follow a rigid spelling or format, but likely entries to the field include the following:
cf. [”comparable to”]
aff. [affinis, “related to”]
vel aff. [or a close relative]
s.s. [sensu stricto, in the narrow sense]
s.l. [sensu lato, in the broad sense]
hybrid
ex (or e) descr [identification based on a published description only; other specimens were not available for comparison.]
* - We use an asterisk in this field to indicate that more extensive comments by a specialist on the determination, such as subgenus name, or most closely related taxon, etc. can be found in the NOTAS field.

10. DEPTO [1st order political division; most users will want a COUNTRY field also, I presume]
Peruvian departmental abbreviations used in Cat. Fl. Peru (Brako & Zarucchi, 1993).

11. SITIO - This field may be used for project code numbers or letters, to be determined by the individual user. It allows the collection data associated with any particular project to be quickly accessed for use in reports, counts, checklists, and statistics.

12. PROV - Province name [or 2nd order political division]

13. LOCAL - All other locality information.

14. HABITAT - Habitat information, associated species.

15. OBSERV - Information pertaining to individual plant habit, ecological information, etc.

16. COLECTOR - First collector's name.

17. COL_AD - Names of all other additional collectors, separated by commas.

18. NUMERO - Collection number. This field accepts numeric data only.

19. SUFFIX - This field used for suffixes, such as "a" and "b", or “-93" on the collection number. (You may find that a “prefix” field is also necessary; simply add it to the database structure as needed.)

20. HERBARIO - Acronym for herbarium where specimen resides. May also include herbaria in which duplicates are known to reside, separated by commas.

21. DUPL - This field can be used: a) to sort specimen labels for printing, so that labels requiring the same number of copies are printed on the same sheet, and paper is saved; b) to indicate how many unmounted duplicates are available for distribution; and c) to sort annotation labels for printing, if desired.
As yet, we have no program for automatically printing the desired number of duplicates.

22-24. DIA, MES, ANO - Date information. NOTE: Many databases have special date fields. We have not adopted this here, since it makes printing labels more complicated. We abbreviate the month with letters and not numbers to avoid confusion between the month and the date fields.

25-26. ELEVACION, ELEV2 - These fields will accept 4 digits of numeric data, and assume measurement in meters. If only one elevation is given, enter it in the ELEVACION field. If an elevational range is cited, as 2800-3200 m, enter the lower number in ELEVACION and the higher in ELEV2.

26-27. CORDLAT, CORDLON - These fields will only accept 4 digits of numeric data. Our database assumes latitude S, and longitude W. If necessary, add single-character fields after CORDLAT and CORDLON to differentiate North-South and East-West.

28. NOTAS - Any additional notes of any kind.

29. DETERMIN - Name of the determiner followed by a comma and the date.

30. ENVIOS - Indicates whether the most recent determination of the record has been sent to the collector, or to whomever determination lists are being sent. See “Determination Lists”. We use “NO” and “YES.” Normally, “NO” will be entered in the ENVIOS field any time a new determination is entered.

31. ANNOT - Indicates whether annotation labels are ready to print, or have already been printed. We use “A” and “D,” respectively, for “annotated” and “done.” Normally, “A” is entered in the ANNOT field when a determination is entered. Exceptions might be when the determination is uncertain or incomplete, or when there are no unmounted duplicates which require annotation.

B. DATA ENTRY PROTOCOL


It is easiest and most efficient to enter specimen data as soon as specimens are accessioned into the herbarium, in fieldbook sequence if possible. This is due to the ability of databases to ditto-copy repetitive locality and collector data. Of course, it is particularly true when the database is used to generate specimen labels (as outlined below).

1. In general, it is best to enter incoming specimen data into a new file which can be proofread and printed, and later appended to the main data file. To create an empty file with an identical structure to the main data file (e.g., “DETBASE”), do the following:

.use detbase
.copy structure to <newfile>
.use <newfile>
.append

2. Choose one of the following commands to allow automatic copying of repetitive data. Note that when field values change, you need only type over or delete any undesired data which has been carried over.

SET CARRY ON/OFF This command will cause the entire contents of the last record to be automatically entered in the new appended record below it, which can then be editted.

SET CARRY TO <fieldlist> This command copies the contents of specified fields only.

Example (recommended for specimen data entry):
.set carry to depto,prov,local,habitat,colector,col_ad,herbario,dia,mes,ano,elevacion

Shift-F8
Pressing these 2 keys together will cause data entered in the field above the cursor location to be duplicated in the field below. It will only copy one field at a time. If the active field already contains data, it will be erased and overwritten. This key is also handy for making quick corrections when proofreading. (NOT available in dBase V for Windows).

3. WARNING: a. Do NOT use double quotation marks (“) in the database (as when quoting common names). Double quotes are used as field delimiters in ASCII files, and can cause unpredictable field breakage if you attempt to transfer your file to a wordprocessor. You may substitute an apostrophe (‘) instead. This is particularly critical because (“)’s can NOT be removed by a search and replace routine once in place. They must be deleted manually. b. Do NOT enter commas between numerical characters, as in “3,000" or “1,6". This can also “break” fields. Commas used within normal character text do not seem to cause a problem. [These problems may have been solved by WP 6.0; I haven’t tested it out. Even in WP 5.1 they occur unpredictably so exercise caution.]

4. After data entry of a group of specimens is complete, you may want to proofread, edit, or sort the file, print a hard copy of selected fields (see Creating Reports), or make other changes. When this is complete, you may append the temporary file to the main database, using the following commands.

.use detbase
.append from <newfile>


Then, you may:

.erase <newfile.dbf> which will completely erase the temporary file
OR
.use <newfile> which will remove all records from the file, but will preserve the .zap structure for future data entry.

C. VIEWING dBASE FILES


Database records in dBase IV or V can be entered and updated in either the Edit (“form”) or Browse (“column”) mode. If you press F10 from the dot prompt, you will enter the Edit mode. You may then toggle back and forth between Edit and Browse modes by pressing F2.
If you wish to view or update only certain specified fields, or records meeting a certain condition, you may use the following commands:

SET FIELDS TO <fieldlist> Causes only the selected fields to be displayed, in the order specified.
Example:
.set fields to colector, numero, suffix, familia, genero, especies, autor, var_ssp, subespecie, autor2, aff_cf, notas, determin, envios, annot

The above example could be used to save time when entering new determinations.

SET FILTER TO <condition> Allows display of only those records which meet the condition.
Examples:
.set filter to colector=”Sanchez” .set filter to elevacion>3000

To return to viewing the entire database:
.set fields to
and/or
.set filter to

D. INDEXES AND INFORMATION RETRIEVAL

The great utility of databases is due to their capacity to be sorted quickly many different ways, and editted, printed, copied, or exported in any order.

The principal tool for sorting a database is the index. The index is, like the index of a book, an auxiliary file associated with the database which contains information for rapidly sorting the file in a particular order determined by the user. With an index in use, the database file may be editted, printed (as a list or report), copied or exported, and all these operations will be performed following the current index order. Multiple indexes may be defined for any given database, and index specifications are named with a “tag” by which they can be called at any time. Indexes automatically update themselves as the file is editted, and are saved when the program is exitted. Searching for particular records in a large database, or on a slow computer, can be time-consuming, but in an indexed database, searches (using the SEEK command) on the indexed field(s) are very fast.

Creating indexes can be done either through the menu or from the dot prompt (command line).

D-1. Creating an index from the menu
1. From EDIT or BROWSE mode, select ORGANIZE menu.
2. Select CREATE NEW INDEX.
3. On each line of the submenu that appears, you must press ENTER first, before entering your selection.
4. INDEX NAME (or “tag”): This is the name used to call the index from the command line, so make it easy to remember. For a simple index, you may give it the same name as the index field.
5. After all selections are made, press CTRL-END.
6. The database will appear in the new indexed order, until you close it or change the index order.

Examples:
NOTE: Unless specified otherwise below, assume default values for: FOR clause => [none], the Order of index => [Ascending]; Display first duplicate key only => [NO].

Records sorted by collection number:
Index name NUMERO (or any desired name)
Index expression NUMERO

Records sorted by collector and number.
NOTE: In this example, you must use STR() to convert NUMERO to Character data; if you don’t you’ll get the error message “Data type mismatch.”
Index name COLECCION
Index expression COLECTOR+STR(NUMERO)

Sagástegui collections only, sorted by number
Index name SAGAST
Index expression NUMERO
FOR clause COLECTOR=”Sagástegui”

Records sorted by family, genus, and species.
Index name TAXON
Index expression FAMILIA+GENERO+ESPECIES

A UNIQUE list of all the species found in the database, sorted by family and species, with each species listed only once.
Index name UNITAXON
Index expression FAMILIA+GENERO+ESPECIES
Display first duplicate key only YES

D-2. Using indexes
Once created, all indexes for a given database <FILENAME>.DBF are automatically stored in a single file called <FILENAME>.MDX. This file is automatically updated each time database records are changed or added.

D-2.1. Setting a database to indexed order.
From the MENU:
1. In BROWSE or EDIT mode, go to the ORGANIZE menu, and select Order records by index. NOTE: Once an index is created, reordering the database by the index is extremely fast.
2. Select the index name from the popup menu. Selecting Natural Order will return the database to the original, nonindexed order.

From the dot prompt:
.use <filename> order <name of index>
e.g., .use detbase order taxon

OR, if file is already in use:
.set order to taxon
To return database to nonindexed order:
.set order to

D-2.2. Searching indexed files
Indexed files can be used to perform very rapid searches on an indexed field. To perform a search on an indexed field, use the seek command from the dot prompt. The seek command only searches in indexed fields, in the order in which they appear in the index expression.

Examples:
To locate the first record with collection number 8347 in DETBASE
.use detbase order numero
.seek 8347
[NOTE: Data in numeric fields must not be enclosed in quotes]
.edit

To locate the first record of Lamiaceae in the TAXON index of DETBASE
.use detbase order taxon
.seek “LAM”
[NOTE: Data in character fields must be enclosed in quotes]
.edit

To locate the first record of Salvia in the TAXON index
.use detbase order taxon
.seek “LAMSalvia”
.edit

D-2.3. dBase settings which affect the SEEK command


SET EXACT ON/OFF This setting determines how dBase executes searches and processes “condition” statements. With EXACT ON, the contents of the field must exactly match the string given in the search or condition statement. With EXACT OFF, additional characters may appear in the field beyond the character string matched. For example, with EXACT ON, a search for “Leiva” in the collector field, will not find any records of “Leiva, S.” With EXACT OFF, a search for “Leiva” will turn up records of “Leiva”, “Leiva, S.” and “Leiva, P.” without discrimination.

SET NEAR ON/OFF This setting determines how dBase responds if it does not locate any records matching the specified string. With NEAR ON, the record pointer will be set to the record with the value closest to value specified. With NEAR OFF, the record pointer will go to the end of the file, and the message “Value not found” will appear.

D-2.4. Notes on editing indexed files
Virtually any operation can be performed on files while in an index order, but a few precautionary notes are in order.
1. If data are changed in the indexed field, the record may move to a new position as soon as you leave it, and the screen will follow the record to its new position. If you do not want the record pointer to follow the editted record, go to the Records menu, and toggle Follow record to new position to no.
2. Global file operations, i.e., where dBase has to search through the whole file for certain records, run much more quickly on files in natural order, than on files where an index is in use. Before performing such operations, return the database to natural order. Examples of such operations are: SEARCHes on non-indexed fields, SORTs, COUNTs, and the REPLACE command (if global).
3. Delete index tags you do not need. This can be done through the Organize Menu. Indexes require space, and also time, since they are constantly updated as the file is changed. Also every time you change file structure, or “pack” the database, the indexes are automatically regenerated from nothing, and this requires time.
4. Do not attempt to modify the database structure while an index is in use.
5. Very rarely, you may have problems with “losing” the bottom half of the database as you browse through it. The records show in the status line but not on the screen. If this happens, go to the Organize Menu and give the command to Reindex. This usually solves the problem.
6. If you copy an indexed database file to another disk, but do not copy the index (MDX) file, you will get an error message the first time you use the copied file. Production.MDX file not found. You may select Proceed which is followed by the message Production index file reference deleted.

D-3. Locating records without an index
The quickest way to locate a particular record is through the use of an Index, as described above. However you may also need to search for a record on a field which is not indexed. SEARCHing in a non-indexed field is much slower than SEEKing in an indexed field. The advantage is that searches can locate character strings located anywhere within a field, whereas SEEK can only find character strings at the beginning of fields.
You may perform searches on non-indexed fields from the Menu or from the command line (dot prompt). Note that the command line allows more complex searches.
D-3.1. From the Menu: “Search”
Place the cursor in the field you want to search. Use the Search option on the Go To Menu. If the character string you are looking for is NOT expected to be at the beginning of the field, use the wildcard character * on either side of the character string.
For example, to locate records with the word “Cachil” embedded in the LOCAL field, search for *Cachil*.
D-3.2. From the Command Line: “Locate”
The command LOCATE FOR <condition> will start a search at the beginning of the file and locate the first record to meet the condition. The search can be continued with the CONTINUE command. As with the SEEK command, the LOCATE command is affected by the “EXACT” and “NEAR” settings.

Examples:
To find a record with “Wurdack” as the first word in the DETERMIN field
.locate for determin=”Wurdack”

To find a record with “Cachil” anywhere in the LOCAL field.
.locate for “Cachil”$local

To find a record with collector Sanchez, from an elevation less than 3500 m, and the word “jalca” contained in the habitat field.
.locate for colector=”Sanchez”.and.elevacion<3500.and.”jalca”$habitat

To continue the search through the file for the character string specified by the last LOCATE command:
.continue (or cont)

E. UPDATING DATABASE FILES


Typically, databases are subject to constant updates and corrections, sometimes by many different individuals. Some recommendations for expediting the more common specimen database update and maintenance procedures are discussed here.


Adding new species determinations to a specimen database is typically the most common and important change which will be made to the file. If multiple determinations are to be added, it can be done most quickly by using an index on the NUMERO field, and then using the SEEK command to locate the record. You may also wish to set fields as suggested above.
(NOTE: It may seem more logical to index on COLECTOR+STR(NUMERO), but this would mean that in order to seek the record, you would have to type in the entire contents of the COLECTOR field, plus blank spaces, in addition to the NUMERO. Usually there are only a few records in the database with the same NUMERO, so once you find the first one, you can quickly locate the one you need. Or if you are entering many determinations for the same collector, you can set filter to COLECTOR=”<...>”, while simultaneously using the index.)
It is necessary to toggle between the command line and the database display to execute the seek. To avoid losing data just entered, take care to use Ctrl-End to return to the command line, and not the Escape Key, or new data in the current record will not be saved.
Notice that by changing the entry in the ENVIOS field to “no” each time you change the determination (even if the determination is not final), you make it possible to periodically send updated determinations to the collector, or if desired, to all herbaria listed in the HERBARIO field, for each change that is made.


There are many occasions in which large-scale, or “global” editting may be needed in a database. For example, efficient sorting and information retrieval in a database depends on consistencies in the spelling of personal names, place names, species names, and so forth. Yet, in practice, especially with many persons adding to the same database, inconsistencies and errors will accumulate over time. Also new research, data retrieval, or specimen processing needs may develop. The replace command is a powerful tool for database editting. The proper syntax and options for the command are as follows:

NOTE: Before you execute a global replace, it may be necessary to SET EXACT ON to avoid errors.

REPLACE <fieldname> WITH <expression> Replaces the contents of field with a selected
SCOPE statement expression. In the absence of a SCOPE,
FOR condition FOR, or WHILE statement (see Appendix
WHILE condition 1), only one record will be replaced.

Examples:
To replace data in the COLECTOR field of the current record only with “Sánchez Vega, I.”
.replace colector with “Sánchez Vega, I.”

To replace data in the COLECTOR field of all records with “Sánchez Vega, I.”
.replace colector with “Sánchez Vega, I.” all

To replace with “I. Sánchez Vega” the COLECTOR field of all records in which the first item is currently “Sanchez”.
.replace colector with “I. Sánchez Vega” for colector=”Sanchez”

To replace the CLASE field with “MON” for all records containing “POA” in the FAMILIA field.
.replace clase with “MON” for familia=”POA”

To enter “3" in the SITIO field of all records containing the word “Cachil” anywhere in the LOCAL field.
.replace sitio with “3" for “Cachil”$local

The replace command may also be used with much more complex expressions, such as the following examples, adapted from our specimen labels program. NOTE: If you add characters to a field, such as is done here, the field should usually be lengthened first, and the field type changed to “Character” if necessary.


.replace determin with “det. by ” + rtrim(determin) all
This inserts the characters “det. by “ at the beginning of the DETERMIN field. The function rtrim() trims the blank spaces off the right side of the original character string so that the new combination will fit.

.replace elevacion with “Alt. “ + ltrim(elevacion) + “ msnm.” for elevacion#” “
This checks the field ELEVACION to verify that it isn’t empty (elevacion#” “), and if it is not, trims the blank spaces off the left side of the field, inserts “Alt. “ before the field contents and “ msnm.” after, to give “Alt. [ELEVACION] msnm,” as the final contents of the field. Thus “3500" becomes “Alt. 3500 msnm.”

.replace observ with stuff(observ(AT(“rojo”,observ),4,”amarillo”) for “rojo”$observ
The STUFF() and AT() functions can be used with the REPLACE command to execute a “search and replace” action. The example above will replace the word “rojo” with the word “amarillo”, wherever it occurs in the OBSERV field. The command here tells dBase to: start at the position where the word “rojo”occurs in the OBSERV field [AT(“rojo”,observ)]; remove 4 letters; and substitute the word “amarillo”.

The replace command can also perform mathematical calculations, as in the following example, which converts feet to meters in the ELEVACION field, by multiplying the field value by .305.
.replace elevacion with elevacion*.305

For more help constructing complex expressions, see the functions SUBSTR(), STUFF(), and AT() in the dBase language reference. For calculated expressions, see Section F below.


In order to maintain the database as an efficient information retrieval tool, it is frequently necessary to proofread individual fields, especially indexed fields, for consistency in spelling and usage, particularly of personal names, place names, and species names.
In a small database, simply index on the field to be checked and scan through it. In a larger database it may be better to use a UNIQUE index so that each spelling variant is listed only once.
For example, to proofread for consistency in the COLECTOR field: 1) create a UNIQUE index on COLECTOR. 2) LIST COLECTOR TO PRINT. [See LIST command, Sect. G-1.] You will get a list something like this:

A. Sagastegui
A. Sagastegui A.
A. Sagástegui
Dillon
Dillon, M.
Dillon, M.O.
Dillon, M. O.
I. Sánchez V.
I. Sánchez Vega
J. Sanchez
J.Sanchez
M. Dillon
Sagastegui
Sagástegui
Sanchez [for I. Sánchez Vega]
Sanchez, J.
Sanchez V., I.
Sánchez Vega, I.



Once the desired spelling is selected, you may change all other versions of the name, using a replace command. For example, you may choose the spelling Sánchez Vega, I. for that collector. To correct all other versions of the name:

.set order to [Return the database to non-indexed order, or process will be slow]
.set exact on [to avoid accidentally changing Sanchez, J. to Sánchez Vega, I.]
.replace for colector=”I. Sánchez V.”.or.colector=”I. Sánchez Vega”.or.colector=”Sanchez” .or.colector=”Sanchez V., I.” colector with “Sánchez Vega, I.”

As your work with the database evolves, you may need to change the structure of the database. For example, you may wish to lengthen the NOTAS field, or add extra fields for additional project or specimen processing codes. The structure of an existing database may be changed at any time, using the modify structure command. However, a few cautionary notes are in order.
1. Make a back-up file before you begin any structure changes.
2. After making the back-up, check to make sure you have adequate disk space to make the change. You will need as much free disk space as the existing database, and more, if you are lengthening or adding fields.
3. If you change a field from Type C (Character) to Type N (Numeric), all character data, and any data following, will be lost. For example, “B127" in a Character field, will appear as “0" in the resulting Numeric field, whereas “127B” will translate as “127".
4. You may change the names of existing fields, but NEVER at the same time that you make any other changes in the structure.
5. You may add new fields, and change the length or type (but NOT the name) of existing fields at the same time.

E-4.1. Suggestions on splitting one field into two
Frequently, as our needs for the database have changed, we have found it necessary to split fields more finely. For example, you may start with an elevation field which includes a range of values (e.g., “300-500 m”) or you may initially include the entire taxon name in one field and then find you wish to split this information into separate fields. If the field contains a unique “marker” character, such as the hyphen in the elevational range, or if you wish to break the field after the first word (i.e. where the first “space” occurs), you may be able to speed up the process with complex REPLACE commands or short programs. I have included here some routines we have used in the past for such jobs.

EXAMPLE 1:
To split a field containing elevational range into two numeric fields
ELEV ELEV1 ELEV2
[2700-3500 m.] =====> [2700] [3500]
(12 characters) (4 Num) (4 Num)

1. Add ELEV2 field - 4 Characters
2. Remove character data from the ELEV field, as follows:
.replace elev with substr(elev,1,at(“m”,elev)-1) for “m”$elev
[removes terminal m’s and “m.”s.]
.replace elev with stuff(elev,at(“,”,elev),1,”“) for “,”$elev
[removes any comma’s between numbers, as in “3,500"]
3. Write data into new ELEV2 field, and edit old ELEV field
.replace elev2 with substr(elev,at(“-”,elev)+1) for “-”$elev
[puts high end value of elevational range into field elev2]
.replace elev with substr(elev,1,at(“-”,elev)-1) for “-”$elev
[rewrites elev field so it contains only low end value]
4. Change ELEV and ELEV2 to numeric fields; change ELEV to a 4-digit field.
5. Rename ELEV field ELEV1.

EXAMPLE 2:
To split an author field into basionym author and combination author
AUTHOR BASIAUT COMBAUT
[(Lewis) Swaggart ] [Lewis ] [Swaggart ]
(20 characters) (10 Char.) (10 Char.)

1. Add BASIAUT & COMBAUT fields
2. .replace basiaut with substr(author,2,at(“)”,author)-1) for “)”$author
3. .replace combaut with substr(author,at(“)”,author)+2) for “)”$author
4. .replace combaut with author for author#”(“
5. Scan file for irregularities.
6. Remove AUTHOR field.

F. SIMPLE STATISTICS



This section summarizes the commands which may be used to get simple numerical and statistical information from the database.

F-1. COUNTing records which meet a given condition

COUNT Counts records which meet a specified condition
SCOPE statement
FOR condition
WHILE condition

Examples:

How many specimens collected by Sagástegui are in the database?
.count for colector=”Sagástegui”

How many specimens in the database are undetermined to genus?
.count for genero=” “

How many specimens of Piptochaetium have been collected by Sanchez?
.count for colector=”Sanchez”.and.genero=”Piptochaetium”

How many specimen determinations have been made by Leiva in 1995?
.count for “Leiva”$determin.and.”95"$determin

How many specimens of Palicourea have been collected from Bosque Cachil?
.count for “Cachil”$local.and.genero=”Palicourea”

How many species of Palicourea are reported from Bosque Cachil? (Assume “3" is the project code for Cachil)
First, create a UNIQUE index on GENERO+ESPECIES+SITIO.
.count for genero=”Palicourea”.and. especies#” “.and.sitio=”3"

How many genera are represented in the database?
First, create a UNIQUE index on GENERO.
.count all

F-2. Using the command line for computations

You can get dBase to act as a calculator for simple mathematical operations, using +, -, *, and /, for addition, subtraction, multiplication, and division, respectively.

Example: At the dot prompt, enter
.?3*4
12

What percentage of the specimens in the database are Asteraceae?
.count for familia=”AST”
312
.?312/reccount()
[where reccount() = the number of records in the current database]
0.18

F-3. The CALCULATE command
This command seems to have limited utility for our purposes, but its functions are summarized below.

CALCULATE <option list> Performs calculations on data in fields
SCOPE statement
FOR condition
WHILE condition

where “option list” may be one of the following
AVG(exp) average value of a field (or expression)
MAX(exp) finds largest number in a field
MIN(exp) finds smallest number in a field
SUM(exp) sum of values in a field

Examples:

How many duplicates are available for distribution?
.calculate sum(dupl)

What is the lowest Sagástegui collection number in the database?
.calculate min(numero) for colector=”Sagástegui”

What is the average elevation from which specimens in the database are collected?
.calculate avg(elevacion)

What is the maximum size needed for the OBSERV field? (i.e., what is the longest character string currently appearing in that field?) NOTE that LEN(exp) gives the string length.
.calculate max(len(observ))

G. CREATING REPORTS


From databases it is possible to generate a great variety of printed reports, useful for purposes ranging from specimen processing to research.
Using dBase IV and WordPerfect 5.1, printed reports can be generated by three methods: 1) the list command; 2) the report form generator; 3) exporting delimited ASCII text files to WordPerfect.
We have recently upgraded to dBase V and WordPerfect 6.0 for Windows, which have significantly different capabilities for report generation. WordPerfect 6.0 can import database files directly (whether dBase IV or V), with the proper custom installation. The dBase V report generator (Crystal Reports) differs from that in dBase IV, and we do not have experience with it, since the capabilities of WordPerfect 6.0 (except for the “Group Band” function) essentially replace it.


This command, available from the dot prompt, is the quickest, and often the best for generating working lists, e.g., lists for checking data. Using the various options available with the command, as well as any available indexes, the data can be arranged and filtered in many possible ways. The weakness of this method is that it allows only limited formatting of output, and is not suitable for generating publishable copy.
Fields are formatted into columns, with the fieldname at the top. However, if the total width of the selected data in each record exceeds the page width, the printer will either truncate or wrap the line. In the latter case, the column layout is disrupted and difficult to interpret. In any case, the list command is often impractical for reports containing relatively large amounts of data per record.

LIST Displays contents of file in columnar list to screen
FIELDS <fieldlist> Lists only specified fields, in order shown
SCOPE statement
FOR condition
WHILE condition
TO PRINTER/TO FILE Also sends list to printer or to a file
OFF Prevents record numbers from printing (saves space)
Example:
.list fields colector,numero,genero,especies for ano>1992 to printer off


This program resides in dBase IV and can be used to generate custom formatted reports of publishable or nearly publishable quality. Reports generated in this way can also be written to text files and exported to a word processor for further editting. This is a more practical method of printing reports when the data per record exceed the width of the paper. The report is generated by arranging field templates on a report design screen. This design may be saved to a permanent file (with an .FRM extension) for later use.

G-2.1. Designing a Report

G-2.1.1. Basic Procedure

1. Open the database file to which the report will apply.
2. On the command line, enter: .create report <report form filename> You may use any name for the report form file. A report design screen will appear.
3'. Option 1. From the Layout Menu, you may select Quick Layout, and then Column or Form. The design screen will automatically format the report, containing all the fields in the database, arranged in either Column (Browse Mode) or Form (Edit Mode) Layout, with headings provided. Unwanted fields can be removed, and other changes made. However, these layouts tend to use a lot of space in printing, so that a custom layout (Option 2) is usually preferable for our purposes.
3". Option 2. Enter the report title under Report Intro Band [Introducción]. The Page Header Band is normally used for column headings, when the report is printed in column layout. In custom layouts, it is rarely useful, and may be left empty.
4. The “field templates” are arranged in the Detail Band [Cuerpo], as follows:
a) Position cursor where you want the first field to start printing.
b) Press F5 for a fields list.
c) Highlight a field, e.g., COLECTOR, and ENTER.
d) You will be shown a dialog box with display variables to verify. Press CTRL- END.
e) The field template (a line of XXX’s for character fields, 999's for numeric fields) will appear in the Detail Band. NOTE: The fieldname will NOT appear, unless you enter it; however as you design the report you can identify the field templates you have added by highlighting them with the cursor; the fieldname will show in the Status Bar at the bottom of the screen.
f) Select all the fields you want, arranging in columns, rows, or paragraphs as you desire.
5. From the Report Form Design Screen, you may View Report on Screen, from the Print Menu. If satisfactory, you may print the report directly from the print menu.
6. If you have problems with the page length setting, you can designate a page length, and save to a permanent print form (.PF file), using the Print Menu.
7. To save the report form for use later, Save changes and exit.

G-2.1.2. Notes on arranging field templates
1. If you connect the field templates with a hard space (which will show as a darkened box), all but one empty space between the fields will be trimmed. This is important because it allows you to concatenate data from different fields, rather than printing it in column format, e.g.,

Chionanthus wurdackii Stahl
Schrebera americana (Zahlbruckner) Gilg


NOT

Chionanthus wurdackii Stahl
Schrebera americana (Zahlbruckner) Gilg

2. To determine the number of fields that can be accommodated on one line usually requires some experimentation. The default line length in the Design Screen is 254. It is possible to set the right and left margins using the Words Menu, before you have begun entering field templates. However, with the right margin set at (for example) 60, the Design screen will not allow you to put more fields on one line than have total length adding to 60 characters. And if you are trimming the blank spaces out of the fields, as above, the actual printed line lengths will generally be much shorter than the total field lengths. It is also possible to set Word Wrap on, if you expect lines too long for the page, but in my experience not all printers respond to this setting, and some will wrap the lines even with Word Wrap off.
3. Any characters or punctuation marks you type in between the field templates, such as “: ”, “det. por “, or “NOTAS: “ will also print at that position in the report. However if the field associated with this text is empty, the text will print anyway.

G-2.1.3. Using group bands
If you will be printing from a sorted or indexed file, you may want the records divided into groups on the basis of the index or sort expression. For example, if the file is sorted by FAMILIA + GENERO + ESPECIES, you can use Group Bands to achieve the following result:

Without a Group Band:

ACA Aphelandra acanthifolia Hook.
ACA Aphelandra formosa (H. & B.) Nees
ACA Beloperone sessilifolia Lindau
ACA Thunbergia alata Bojer
ACT Saurauia bullosa Wawra
ACT Saurauia loeseneriana Busc.
ACT Saurauia peruviana Busc.





With FAMILIA as a Group Band:

ACA
Aphelandra acanthifolia Hook.
Aphelandra formosa (H. & B.) Nees
Beloperone sessilifolia Lindau
Thunbergia alata Bojer
ACT
Saurauia bullosa Wawra
Saurauia loeseneriana Busc.
Saurauia peruviana Busc.


To add Group Band(s):
1. Position cursor in the Report Intro band, below any title information you have entered.
2. Choose Add a group band from the Bands Menu.
3. Select Field Value from the menu.
4. Select the field you want to group on.
5. Enter the field template where you want it to print in the Report Intro Band. Use F5 (as in 4b above). If you want it to be indented, as shown in the Examples, you must indent the template.
6. Enter any additional “sub-group band(s)” on the line(s) below. For example, you could also group genera, within the family groups.

Example:
A diagram of a report form used for sending determination lists
(In an actual report form, the fields display as XXX’s and 999's, not as fieldnames as shown):

Report Intro Band -------------------------------------------------------------------------------------
Determination List for CPUN, June 1995
Group Band --------------------------------------------------------------------------------------------
[COLECTOR]
Detail Band ---------------------------------------------------------------------------------------------
[NUMERO][SUFFIX] - [FAMILIA]: [GENERO][ESPECIES][AUTOR][VAR_SSP]....(*)
det. por [DETERMIN]; NOTAS: [NOTAS]
[BLANK LINE]

(*) First line continues [SUBESPECIE][AUTOR2][AFF_CF]

G-2.2. Printing a report
To print a report from an existing report form file:
1. use the database file with which the report is associated.
2. If you use a custom print form, enter
._pform=”<print form filename>”
3. To view the report form structure, and to make any necessary modifications, such as changing the title, enter
.modify report <report form filename>
You may then print from the print menu.
4. Alternatively, you may print directly from the command line by entering
.report form <report form filename> to print
5. OR you may export the report to an ASCII text file, readable by a wordprocessor:
.report form <report form filename> to file <newfile>.txt


Data, both unformatted and with some preliminary formatting, may be exported for editting and printing to a word processor such as WordPerfect, by a number of routes.
1. The data may be pre-formatted by the LIST command (LIST to FILE option, Section G-1). This file can be read directly by WordPerfect.
2. The data may be more extensively pre-formatted by a Report Form (REPORT FORM to FILE option, Section G-2). This option may be preferable to Option 3 when Group Bands are desired.
3. The data may be written to a WordPerfect Secondary Merge file (or “Data File”, in WP 6.0), and formatted by merging with a user-designed Primary Merge file (“Form file” in WP 6.0). This option allows the most extensive formatting. The procedures differ for WP5.1 and WP 6.0, and are as follows:

G-3.1. Exporting data to WordPerfect Merge files (WordPerfect 5.1)
1. .use <filename>
2. Order the records with an index, if desired (.set order to....).
3. .copy to <newfile> delimited [At this point, you may select which records you desire, with a “FOR clause”. See COPY command for options, Appendix 1b.] This will cause an ASCII file to be created, with a TXT extension, unless specified otherwise. ASCII delimited text files look like this when read by WordPerfect:

“ACA”,”Aphelandra”,”acanthifolia”,”Hook.”,”“,”“,”“,”LL”,”“,”Bolivar”,”El tambo, cerca a la ciudad de Bolivar”,”Ladera de arbustos y arboles.”,”Arbusto, pubescente. Flores anaranjadas”,”I. Sanchez Vega”,”“,”5034",”“,”CPUN,F,OS”,”“,”28",”Ago”,”1989",”3100",”“,”“,”“,”“,”D. Wasshausen, 1993",”no”,”“
“ACA”,”Aphelandra”,”formosa”,”(H. & B.) Nees”, . . . . . .

To convert an ASCII text file of this type to a Secondary Merge File:

4. Quit dBase. At the DOS prompt, type CONVERT

Name of input file? DBASE\FILES\<filename>.txt
Name of output file? WP\FILES\<filename>.sf
Select Mailmerge to WordPerfect Secondary Merge
Enter field delimiter characters , [ENTER]
Enter record delimiter characters {13}{10} [ENTER]
Enter character to be stripped from file [ENTER]

The new “secondary merge file” will look like this:

ACAENDFIELD
AphelandraENDFIELD
acanthifoliaENDFIELD
Hook.ENDFIELD
ENDFIELD
ENDFIELD
. . . . .
ENDFIELD

D. Wasshausen, 1993ENDFIELD
noENDFIELD
ENDFIELD
ENDRECORD

ACAENDFIELD
AphelandraENDFIELD
formosaENDFIELD
(H. & B.) NeesENDFIELD . . . . . .

5. At this point, you have a second chance to sort the records on selected fields (with Merge/Sort), if this was not done in dBase.

G-3.2. Exporting data to WordPerfect Data files - WordPerfect 6.0
WordPerfect 6.0 has powerful capabilities for reading and importing database files. With the appropriate custom installation, it is unnecessary to copy the database to an ASCII text file. It is also possible to select desired fields, and to filter, or “query” the records as they are being imported. Once imported, they can be easily sorted. Thus it is usually unnecessary to pre-format data using the list command or the report generator. (The “Group Bands” function, however, is not available.)
It is also possible to import ASCII delimited text files, directly from WordPerfect. The CONVERT utility no longer exists.

G-3.2.1. Importing database records directly (custom installation required)
1. Enter the WordPerfect document screen.
2. Choose Spreadsheet/Database from the Insert menu.
3. Choose Import.
4. From the Data Type bar, select dBase. [If you haven’t yet customized your installation, you will be prompted to do so.]
5. Enter the dBase filename and directory path.
6. A list of fields will appear. Select fields desired for import.
7. If desired, select Query to define selection conditions. Example: To import only those records with annot=”a”, select field ANNOT and type a in the space below.
8. The data will be imported in the form of a secondary merge file, described above.
9. You may then sort the records as desired. [Note that WordPerfect cannot perform a “Unique” sort, analogous to that provided by the dBase “UNIQUE” index option. To obtain this result, order the database records by the UNIQUE index desired, and then copy to a temporary file for import by WordPerfect.]
a) Select Sort from the Tools menu.
b) Select User-defined sort and New...
c) Enter the Field number you wish to sort on. WordPerfect will sort on the first word in the field. If you wish to sort on more than one field, select Add Key.
10. Save the imported data to a file, as <filename>.DAT.

G-3.2.2. Importing ASCII Text files
1. Follow steps 1 & 2 as for WordPerfect 5.1.
2. Quit dBase, and enter WordPerfect.
3. Choose Spreadsheet/Database from the Insert Menu.
4. Choose Import.
5. From the DataType bar, select ASCII Text File.
6. Enter the TXT filename and directory path.
7. The data will be imported in the form of a secondary merge file.
8. Follow steps 9 & 10 above.

G-3.3. Primary Merge (Form) files
A primary merge file (=form file in WP 6.0) instructs WordPerfect how to format the data you have just imported. (See Figure 2 for examples of primary merge files). To create this file:

G-3.3.1. Designing a Primary Merge file (WP 5.1)
1. Make a numbered list of the fields in your secondary merge file.
2. Open a new document.
3. Select main font.
4. Insert numbered “merge codes” in the document, where you want fields of the same number to appear. Do so by pressing SHIFT-F9,1,<number> at the desired place on the page.You may also insert any other text you desire.
5. Insert the merge code “PAGE OFF” at the bottom by pressing SHIFT-F9,4, or the printer will advance a page for each record.
6. Save the file.
7. Merge the files by entering Ctrl-F9,1,and the names of primary and secondary files as prompted.

G-3.3.2. Designing a Form file (WP 6.0)
1. Select Merge from the Tools Menu.
2. Select Create a Form File.
3. When prompted to Associate a Data File, enter the name of the data file you just created.
4. Design the Form file (Primary Merge file) as described for WordPerfect 5.1. However, if you imported the file directly, when you select Insert Field, you will be given a list of fieldnames to select, and will not need to use field numbers. These fieldnames will also appear in the file.

H. SPECIALIZED REPORTS

This section contains suggested guidelines for generating specimen labels, determination lists, annotation labels, and species checklists. Other valuable uses not detailed here, but easily obtainable are exsiccatae lists and indexes to exsiccatae for taxonomic treatments. For the production of high quality specimen labels, we use two techniques not discussed above: a dBase program for translating abbreviations and adding repetitive verbiage, such as “Depto.” and “det. by”; and a custom “label” definition in WordPerfect. These techniques are applicable to other purposes as well, but their use is detailed here, under “Specimen Labels”.

H-1.1. A dBase labels program for data conversion
The program we use to convert database records for label production is found in Appendix 2a, and its functioning explained below.
Lines 1-3: The data entry file ETIQUETA is copied into a new file structure named ETIQUET2. The new file contains only those fields necessary for label production. In addition, several fields are longer and of a different type, in order to accommodate the transformations of field contents accomplished by the program. (See Appendix 2b for the ETIQUET2 file structure).
Lines 4-14: Several fields are modified to be more readable. For example,
PROV Cutervo => Prov. Cutervo.
ELEVACION 3500 => Alt. 3500 m.
CORDLAT 548 => [5 48'S;79 22'W]
CORDLON 7922
NUMERO 15320 => 15320 (left-justified)
NOTE: The program will distinguish fields which are empty and will not add additional data (e.g., “Prov. “ ”Alt. “ or “det.”) to them, producing a cleaner label than in most programs.
Lines 15-16: “FAMILY” and “DEPTO” are subroutines which translate the family and departamento abbreviations. This is done by using auxiliary files (FAMILIA.DBF, DEPTO.DBF; structures in Appendix 2b) which contain the abbreviations and the full spelling. The files are indexed on the fields containing the abbreviated spelling, i.e., FAMILIA and DEPTO, with index tags “FAMABB” and “DEPTABB”, respectively. Additions can be made to these auxiliary files at any time as necessary, and more than one abbreviation can be used for any family or Departamento. The “FAMILY” subroutine is also useful when generating checklists for publication, and can be used independently for this purpose.
ASC => ASCLEPIADACEAE
CA => Depto. Cajamarca:
Line 17: Writes an ASCII text file from the converted database.
Lines 18-20: Removes all records from the file ETIQUET2 and closes all databases.
Lines 21-24: Writes a screen message telling the user what the new ASCII text file has been named.

H-1.2. WordPerfect Labels Format

H-1.2.1. How Labels Format works
“Labels” is a “Paper Type” option in WordPerfect. WordPerfect (depending on the Version) recognizes several different label sizes and formats. If your version does not provide a label definition which will work for your purposes, you may create one and save it to a file for future use.
The Label format code should not be entered in the Primary Merge (Form) File, or it will appear at the top of each label and cause the printer to advance a page for every label. Add it to the merged file after the Merge has been completed.
WordPerfect treats each Label as a page, the "pages" printing consecutively left to right, rather than up and down as in Column Format. Therefore if you want to test print one sheet of 6 labels, you must request printing of Pages 1-6. If you request 3 pages, it will print 3 labels on a sheet of paper (starting at top left) and leave 3 blank.

H-1.2.2. Creating a label format file
1'. In WordPerfect 5.1:
Enter: Shift-F8, Page (2), Paper Size (7), Add (2), Labels (4), Labels (8), yes
1". In WordPerfect 6.0:
Select Format Menu, Labels, Create.
2. Enter format specifications on the design screen. For specimen labels, we use 8.5 x 11" paper, 6 labels to a page, with specifications in inches as follows: Width 3.75" - Height 3.33" - Columns 2 - Rows 3 - Top 0.25" - Left 0.25" - Distance between columns 0.5" - Distance between rows 0.25" - Label Margins All 0". The English (US) version of WordPerfect 6.0 has a large number of Avery brand label specifications, which may be adaptable. Avery 5164 and 5664 both print 2 x 3 labels to a page. Avery 5661 and 5261 print 2 x 10 labels to a page (and may work for annotation labels).


Annotation labels may be generated similar to the method for generating specimen labels. They may be generated not only for annotating duplicates, but also to send with determination lists. As noted in the explanation of DETBASE structure, a is entered in the ANNOT field whenever a determination is entered which is considered to be “final.” Below is an example of how data might be exported from dBase to WP5.1, to print annotation labels. (Again, modifications of procedure are necessary for WP6.0, but the logic remains the same.)
1. .use detbase order colecion [i.e., colector + str(numero)]

2. .copy fields genero,especies,autor,var_ssp,subespecie,autor2,aff_cf,colector,
numero,suffix,[notas,]determin for annot=”a” to annot delimited


3. Convert ANNOT.TXT to a WordPerfect Secondary Merge file.
4. Go to WordPerfect. Merge ANNOT.SF with a Primary Merge file, with the structure shown in Figure 2b.
5. Format the merged file with a custom label format. [For annotation labels, we use 8-½ x 11" paper, 20 labels to a page, with the following specifications: Width 4.18" - Height 1" - Columns 2 - Rows 10 - Top 0.12" - Left 0" - Distance between columns 0.14" - Distance between rows 0" - Left Margin 0.25" - Right Margin 0.25" - Top Margin 0.13" - Bottom Margin 0"; or “Avery 5261".]
6. Edit final document, removing and adding blank lines so that labels are positioned within the page breaks.
7. As soon as annotation labels are printed, return to the database and:
.replace for annot=”a” annot with “d”

H-4. Project Checklists
Unique species lists for particular project areas (or for the whole database) may be generated by using the UNIQUE index option in dBase (See Section D-1), with the appropriate “FOR clause” or filter setting. From here, various methods of report generation are available, depending on the software in use. The internal dBase report generator comes in handy because the Group Bands function can pull out family names as group headings. If importing directly from WP 6.0, you will need to copy the indexed file to a temporary file for import, since a “unique” sort is not available in WordPerfect.

Although we have not yet done so ourselves, you may want to select CLASE abbreviations which will sort the major taxonomic groups in the order they normally appear in checklists.

In addition the standardized 3-letter family abbreviations do not sort families alphabetically according to their actual spelling. To remedy this, the desired records and fields can be copied to an intermediate file, where the abbreviations can be translated (See Section H-1.1, “Lines 15-16"), and the file subsequently indexed.


Acknowledgments

Dr. Michael O. Dillon originated the DETBASE database for his floristic project work in northern Peru, and has provided help and encouragement in the development of these protocols, and in the writing of this manual. His vision and foresight have been instrumental in motivating the Field Museum to pursue Internet access and the rest of us to use it, and thus have made this electronic publication possible. Drs. Michael Huft and Charlotte Gyllenhaal gave generous assistance with the syntax of dBase programs, and with the development of the specimen labels program.


Literatura Citada

Brako, L. & J. Zarucchi, 1993. Catalogue of the Flowering Plants and Gymnosperms of Peru. Monogr. Syst. Bot. Missouri Bot. Gard. 45.

Brummitt & Powell, 1992. Authors of Plant Names. Royal Botanic Gardens, Kew.

Kubitzki, K., ed. 1990. The Families and Genera of Vascular Plants, Vol. 1: Pteridophytes and Gymnosperms, Vol. editors K. U. Kramer & P. S. Green. Springer-Verlag, Berlin Heidelberg.

Tryon, R. M. & R. Stolze, ed. 1989-1994. Pteridophyta of Peru, Parts I-VI, in Fieldiana, Bot. n.s. nos. 20: 1-145. (1989), 22: 1-128. (1989), 27: 1-176. (1991), 29: 1-80. (1992), 32: 1-190. (1993), 34: 1-123. (1994).

Weber, W. A. 1982. Mnemonic three-letter acronyms for the families of vascular plants: a device for more effective herbarium curation. Taxon 31: 74-88.


APPENDIX 1. USING DBASE COMMANDS


Many dBase operations can be executed through the Menu System. However, almost all Menu operations can be executed as well through commands, and many specialized operations can only be done using commands. Since the Menu System is relatively self-explanatory, we assume no discussion of it is needed here. Instead, we will summarize the dBase command language useful in the construction and maintenance of specimen and other types of databases. These commands are issued at the “dot prompt” or “command line,” which is obtained by ESCAPE-ing from the Main Menu. After that, to reach the Command Line from the Database Display, press CTRL-END. You may also use ESCAPE, but this will cause any new data entered in the current record to be lost. To return to the Data Display, press F10. To return to the Main Menu from the Command Line, press F2.

Appendix 1a. SCOPE AND CONDITION STATEMENTS
Many commands are used with conditions or scope statements, which are explained here first, and used in the examples below:

SCOPE statements
“Scope” statements are statements used with commands which limit the records affected.
They are:

ALL Scan whole file starting with first record
NEXT [n] Start with current record and scan n total records
REST Start with current record and proceed to end of file
RECORD [n] Command applies to record number n only

CONDITIONS (or “FOR clauses”)
When you use a condition statement with the word “for” dBase scans the whole database, starting at the top, searching for records that match the condition. Conditional clauses are built with operators, which are:

= equals > greater than
# not equal < less than
$ contained within >= greater than or equal to

.AND. Logical and
.OR. Logical or
.NOT. Logical not

Note: All these operators, including < and > can be used with both character and numeric data.

EXAMPLES OF CONDITION STATEMENTS
for COLECTOR=”Leiva” “Leiva” appears first in COLECTOR field

for COLECTOR#”Leiva” “Leiva” not first word in COLECTOR field

for “Cachil”$LOCAL “Cachil” appears anywhere in the LOCAL field

for DEPTO=”CA”.or.DEPTO=”PI” DEPTO field contains either CA or PI

for DEPTO=”CA”.and.GENERO=”Linum” All records of Linum from Cajamarca

for NUMERO>8347 All records with NUMERO greater than 8347

WHILE
conditions
The word WHILE can be substituted for the word FOR in a conditional clause. This causes dBase to begin scanning at the current record and continue down through the file until it finds a record which doesn’t meet the condition.
It is useful, for example, in speeding up a “REPLACE” operation while proofreading an indexed file.
WHILE and FOR conditions may also be used together.

Appendix 1b. Index of selected dBase Commands
The mandatory information in a command is shown on the first line. Optional statements are shown on indented lines.
You can abbreviate most commands to four letters and dBase will still recognize them.

APPEND Presents empty record for data entry at bottom of file.
APPEND FROM <filename> Copies file <filename> to end of current file.

BROWSE Displays records with fields in vertical columns

CALCULATE See Section F-3.

CONTINUE
See Section D-3.2.

COPY
TO <filename> Copies file in use to chosen filename.
DELIMITED Creates ASCII text file (for export)
FIELDS <fieldlist> Copies only the specified fields.
SCOPE statement
FOR condition
WHILE condition
Example:
.copy to leiva93 delimited fields genero,especies,colector,numero for ano>1992
[Copies to an ASCII file LEIVA93.TXT the listed fields, for all records collected after 1992.]

COUNT See Section F-1.

CREATE REPORT
<filename> See Section G-2.

DIR
Lists database files in current directory
DIR *.*
Lists all files in current directory
DIR A:*.* Lists all files on A drive

EDIT Displays records with fields in horizontal rows

ERASE <filename> Erases specified file (use whole filename)

GOTO [END, BOTTOM, <RECORD#>] Cursor goes to specified location in file

LOCATE FOR <Condition> See Section D-3.2.

LIST
See Section G-1.

PACK
Permanently deletes records marked for deletion.

REPLACE ... See Section E-2.

REPORT FORM
<report form filename> See Section G-2.

SEEK
<field value> See Section D-2.2 & 3

SET CARRY
ON/OFF See Section B.
SET CARRY TO <fieldlist>

SET DIRECTORY TO <directory name> Temporarily changes dBase default directory

SET EXACT ON/OFF See Section D-2.3.

SET FIELDS TO <fieldlist> See Section C.
SET FILTER TO
<condition>

SET NEAR ON/OFF See Section D-2.3.

SET ORDER TO
<index tag name> See Section D-2.1.
SORT
TO <filename> ON <fieldlist> Creates a new database file sorted on the selected SCOPE statement fields.
FOR condition
WHILE condition

ZAP Permanently deletes all records from file, preserving
structure only.



APPENDIX 2. A Data Conversion Program for Specimen Labels

Appendix 2a. LABELS PROGRAM (LABELS.PRG)

1 select 1
2 use etiquet2
3 append from etiqueta
4 replace prov with "Prov. "+rtrim(prov)+"." for prov#" "
5 replace elevacion with "Alt. "+ltrim(elevacion)+" m."
for len(ltrim(elevacion))>0.and.elev2=" "
6 replace elevacion with "Alt. "+ltrim(elevacion)+""+ltrim(elev2)+" m."
for len(ltrim(elevacion))>0.and.elev2#" "
7 replace cordlat with " " for cordlat=" 0"
8 replace cordlon with " " for cordlon=" 0"
9 replace cordlat with "["+ltrim(substr(cordlat,6,2))+" "+substr(cordlat,8)+"'S;"
for cordlat#" "
10 replace cordlon with " "+ltrim(substr(cordlon,6,2))+" "+substr(cordlon,8)+"'W]" for cordlon#” “
11 replace numero with ltrim(numero) all
12 replace determin with "det. "+rtrim(determin) for determin#" "
13 replace col_ad with "con "+rtrim(col_ad) for col_ad#" "
14 do family
15 do depto
16 copy to etiqueta delimited
17 delete all
18 pack
19 close databases
20 TEXT
21 ETIQUETA.TXT has been created in the current dBase directory and is ready
22 for conversion.
23 ENDTEXT
24 return
25
26 *translates 3letter family abbrev. to full name
27 PROCEDURE FAMILY
28 select 1
29 use etiquet2
30 select 3
31 use families order famabb
32 select 1
33 scan for familia#" "
34 store rtrim(familia) to mabb
35 select 3
36 if seek(mabb)
37 store famnames to mfull
38 select 1
39 replace familia with mfull
40 else
41 select 1
42 endif
43 endscan
44 return
45
46 *translates 4 letter dept. abbrev. to "Depto."+ full name
47 PROCEDURE DEPTO
48 select 1
49 use etiquet2
50 select 3
51 use depto order deptabb
52 select 1
53 scan for depto#" "
54 store rtrim(depto) to mabb
55 select 3
56 if seek(mabb)
57 store decode to mfull
58 select 1
59 replace depto with mfull
60 else
61 select 1
62 endif
63 endscan
64 return


Appendix 2b. Labels Program Auxiliary File Structures

ETIQUETA.DBF
- See DETBASE structure.

ETIQUET2.DBF
NOTE: Field numbers correspond to those recognized by the WordPerfect Form File.

Field Field Name Type Length

1 FAMILIA C 25
2 GENERO C 20
3 ESPECIES C 20
4 AUTOR C 40
5 VAR_SSP C 4
6 SUBESPECIE C 20
7 AUTOR2 C 40
8 DEPTO C 19
9 PROV C 27
10 LOCAL C 150
11 HABITAT C 100
12 OBSERV C 254
13 COLECTOR C 30
14 COL_AD C 55
15 NUMERO C 8
16 SUFFIX C 3
17 DIA C 2
18 MES C 3
19 ANO N 4
20 ELEVACION C 18
21 ELEV2 C 4
22 CORDLAT C 9
23 CORDLON C 9
24 DETERMIN C 30
___________________________________
Total Size 895

DEPTO.DBF

1 DEPTO C 2
2 DECODE C 19
FAMLIES.DBF

1 FAMILIA C 3
2 FAMNAMES C 25


Figure 1. DETBASE. DBF File Structure & Sample Record
1 CLASE C 3 MON
2 FAMILIA C 3 POA
3 GENERO C 20 Bromus
4 ESPECIES C 20 lanatus
5 AUTOR C 40 Kunth
6 VAR_SSP C 4 var.
7 SUBESPECIE C 20 ineditus
8 AUTOR2 C 40 Einstein
9 AFF_CF C 8 vel aff.
10 DEPTO C 2 CA
11 SITIO C 2 3
12 PROV C 20 Cajamarca
13 LOCAL C 150 Coymolache, ruta Cajamarca-Hualgayoc.
14 HABITAT C 100 Jalca graminosa.
15 OBSERV C 254 Perenne, láminas planas, panícula nutante.
16 COLECTOR C 30 I. Sánchez Vega
17 COL_AD C 50 W. Ruíz Vigo
18 NUMERO N 8 2049
19 SUFFIX C 3 a
20 HERBARIO C 18 CPUN,F,OS
21 DUPL N 2 3
22 DIA C 2 1
23 MES C 3 Jul
24 ANO N 4 1977
25 ELEVACION N 4 3850
26 ELEV2 N 4 4000
27 CORDLAT N 4 652
28 CORDLON N 4 7835
29 NOTAS C 40 primera coleccíon de Peru
30 DETERMIN C 25 I. Sánchez Vega, 1978
31 ENVIOS C 3 NO
32 ANNOT C 1 A
__________________________________
Total Size 892

* C = Character field; N = Numeric field.



Figure 2a
SPECIMEN LABELS
Primary Merge (Form) File - Sample
Note 1: Field numbers correspond to those in ETIQUET2.DBF; if using WP 6.0, fieldnames will appear instead of numbers.
Note 2: If reading this file in ASCII format, all formatting will have been erased.

PLANTAS DEL PERU
Universidad Nacional de Cajamarca
(CPUN)
FIELD~1

FIELD~2 FIELD~3 FIELD~4 FIELD~5 FIELD~6 FIELD~7

FIELD~24

FIELD~8 FIELD~9 FIELD~10 FIELD~11
FIELD~20 FIELD~22FIELD~23

FIELD~12

FIELD~17 FIELD~18 FIELD~19

FIELD~13 FIELD~15FIELD~16
FIELD~14

PAGEOFF


Figure 2b
ANNOTATION LABELS
Primary Merge (Form) File - Sample
NOTE: Field numbers 8-10 represent COLECTOR,NUMERO,SUFFIX

[Font 12 cpi][Font small][Center]Herbario Antenor Orrego (HAO)
FIELD 8 FIELD 9 FIELD 10[Font small off]

FIELD 1 FIELD 2 FIELD 3 FIELD 4 FIELD 5 FIELD 6 FIELD 7

det. por FIELD 11
{PAGE OFF}



[Environments] [Plant Families] [Publications]
[J. Francis Macbride & Flora of Peru Series] [Project Staff & Collaborators]