You are on page 1of 100

Quick

Reference
Guide

VERSION

2.0

Borland
dBASE I V
for DOS
dBASE IV®

Version 2 .0

Quick Reference

BORLAND INTERNATIONAL, INC .


1800 GREEN HILLS ROAD
P .O . BOX 660001, SCOTTS VALLEY, CA 95067-0001
Copyright © 1984, 1993 by Borland
International . All Rights Reserved . All Borland
products are trademarks or registered
trademarks of Borland International, Inc . Other
brand and product names are trademarks or
registered trademarks of their respective
holders .

PRINTED I N THE USA .


10987654321
Contents

Paradigm Terms and Symbols 3

Commands 17

SET Commands 43

Functions 55

System Memory Variables 71

SQL Commands and Functions 79

Cursor Movement Keys 87


11

2 Quick Reference

Paradigm Terms
and Symbols

This section explains the meaning and usage of


special terms, abbreviations, and symbols used in
the syntax paradigms of dBASE IV commands
and functions .

[1
Square brackets indicate an optional item,
keyword, or clause in a command or function . Do
not enter the square brackets in the command line .
Square brackets are also used to specify an
element's position within an array. This applies to
the APPEND, COPY TO ARRAY, DECLARE,
and STORE commands .

Do not confuse square brackets, meaning an


optional item, with square brackets used as a
character delimiter .

An ellipsis indicates that you may specify one or


more elements of the type listed .

A forward slash indicates you can use one option


or the other, but not both. If there are many
options, you can use only one .
<>
Angle brackets indicate you must substitute an
item of the type requested inside the brackets . Do
not enter the angle brackets in the command line .
12
The ? is also called the query clause . If you enter
the ? in place of a filename, dBASE IV prompts
you to choose a file from the current catalog, if a
catalog is open, or from a list of files on disk, if a
catalog is not open .

Chapter 1, Paradigm Terms and Symbols 3


Do not confuse the ? query clause with the ?


command, or with the ? wildcard character of
a skeleton .

See skeleton .
alias
dBASE IV allows up to 40 database files to be
open simultaneously by allotting each open file its
own unique work area . Internally, dBASE IV
keeps track of the open database files by their
aliases . An alias can be an alias name (which may
be the same as its filename), a work area letter, or a
work area number.

If you provide an alias name with the ALIAS


option of the USE command, you may use this
alias name as an abbreviation in place of the
database filename when referencing the work area.
If you don't assign an alias name with the ALIAS
option of the USE command, dBASE IV uses the
filename as the default alias name .

Work area letters are the letters from A to J or


a to j . Work area A is the first work area ; J is the
tenth work area. For work areas greater than 10,
specify the work area by number or alias . Work
area numbers are from 1 to 40 . In earlier versions
of the dBASE® product, you could use work area
numbers only in the SELECT command . In
dBASE IV, you can use a work area number in any
command that accepts an alias .

application
A customized program written in the dBASE
programming language .
array
A structure containing a group of items, called
elements, stored in RAM . Each element may
contain data of any valid type, and each can be
identified by its position in the array.

array element
One variable, or data item, contained in an array .
Each element can be referred to by its unique
name, which is composed of the array name and
the element's position within the array.

4 Quick Reference

attribute
The underlining, color, intensity, or blinking of a
region on the screen, or a code used to represent
them . You use these codes in certain commands to
control the screen's colors and intensity, or to
make characters or regions of the screen blink .
background
The attributes of a screen region against which the
foreground characters display.
See attribute, foreground .
.BIN file
An assembly language program that can be loaded
into memory and called from within dBASE IV.
Usually, the assembly program performs special
tasks that dBASE IV cannot . The assembly
program may return values that dBASE IV can
subsequently process .
binary file
A file containing data that is represented in binary
notation . This notation uses a numbering system
with a radix of two. Binary digits appear as either
off (0) or on (1) bits .
border definition string
A list of characters or ASCII decimal codes that
defines the borders of boxes, windows, and lines .
If you specify the ASCII decimal codes, do not use
character string delimiters .

col or column
A horizontal screen coordinate, numbered from the
left of the screen to the right . In text mode, the
coordinate on the far left of the screen is column 0 .
Most monitors display 80 columns across the
screen, although some can display more .
columns
An array element's x-axis coordinates . The data in
each array can be viewed as a two-dimensional
matrix containing rows and columns . An element
is referenced by its row and column position .
condition
An expression that evaluates to a logical true (T.)
or false ( .F.) .

Chapter 1, Paradigm Terms and Symbols 5


delimiter
A character that bounds a string . Delimiters notify
dBASE IV that the text enclosed between the
delimiters should be treated as a character string .
dBASE IV assigned delimiters are : the single
quote ('), the double quote ("), square brackets ([ ] )
and curly braces (11) . Curly braces are used only
for dates . In addition, the APPEND FROM and
COPY commands allow you to declare your own
delimiters .

element
See array element.

enhanced
The foreground and background attributes of
certain commands that output to the screen, such
as EDIT. Usually, the output of commands that
allow you to modify data is in enhanced (also
called inverse) video .
See attribute, background, foreground,
standard.

expC
An expression that evaluates to a character string .
expD
An expression that evaluates to a date .
expN
An expression that evaluates to a number .

expression
Any combination of data from fields, memory
variables, elements, or constants, joined by
operators or functions, that evaluates to one data
type . Expressions may evaluate to character, date,
logical, or numeric type .
extended structure file
A database file created with the COPY
STRUCTURE EXTENDED command .
field
One variable, or item of information, contained in
a record of a database file .

6 Quick Reference

file type

A keyword indicating the format of an input or

output file . File types are :

• DBASEII dBASE III database file

• DELIMITED Variable length ASCII text

file with character fields enclosed within

double quotes (")

• DELIMITED WITH BLANK Variable

length ASCII text file with no delimiters

enclosing character fields

• DELIMITED WITH <delimiter>

Variable length ASCII text file with charac-

ter fields enclosed by the specified delimiter

• DIF VisiCalc DIF file

• FW2 Framework III database file

(sometimes, a Framework spreadsheet file)

• FW3 Framework III® file

• FW4 Framework IV® file

• RPD RapidFile® data file

• SDF System Data Format file (fixed

length ASCII text file)

• SYLK MultiPlan spreadsheet file

• WKS Lotus 1-2-3 spreadsheet file,

Release 1 A

• WK 1 Lotus 1-2-3 spreadsheet file,

Release 2 .x

filename

A valid DOS filename, or an indirect file

reference . Chapter 1, "Essentials," of Language

Reference, discusses indirect file references .

flows

A series of signed periodic cash flows .

foreground

The attributes of characters that display against the

background regions of a screen .

See attribute, background .

Chapter 1, Paradigm Terms and Symbols 7


function
One of a set of formatting rules that apply to all
characters of data displayed by either the SAY
option or the GET option of the @ command .
These formatting symbols also apply to the ? or ??
command .
The functions are ! ^ $(AB CDEIJLMR
S<n> T X and Z .
high
A number or date that you stipulate as the highest
(or, for a date, the latest) entry allowable by a user .
index
A file furnishing the physical address of each
record in the database .
initial
The value of the initial investment.

key expression
A special type of expression used to build an
index. The expression must not exceed 220
characters, and must evaluate to one data type . The
evaluated expression must not be longer than 100
characters .
key field
An INDEX or SORT key composed of one
field only.

keyword
A word used in the dBASE IV language as part
of a command, function, or Config .db file setting .
Keywords are shown in all uppercase letters .
list
A group of like items (such as fields or
expressions) separated by commas .
literal
An item of information that is not a symbolic
representation of that data .
literal key
A constant that may be a key in an index .

8 Quick Reference

look-for exp
The look-for expression is any valid dBASE IV
expression whose value in the active database file
matches the value of the look-in field . This applies
to the LOOKUP() function .
look-in field
A look-in field is the name of a field in the
database file that you are searching . This applies to
the LOOKUP() function .
low
A number or date that you stipulate as the lowest
(or, for a date, the earliest) entry allowable by
a user.

.mdx file
A multiple index file, which may contain up
to 47 tags . Each mdx file is associated with a
database file . Each tag in the mdx file may
impose an index order on the database file . When
you open an mdx file, you have access to all
tags contained in the file .
memo field
Variable-length fields used to hold large blocks
of text such as memos and short documents .
Memo field data is not written in the database
( .dbf) file, but in a separate .dbt file associated
with the .dbf file .
memory variable
A variable, or data item, stored in RAM, but not
part of a database unless you specifically write it to
a database file .
memvar
An abbreviation for "memory variable ."
menu
A menu, or list of choices, defined with the
DEFINE MENU command .
n
An integer.
.ndx file
An index file . Each ndx file may impose an index
order on the database file, and is similar to a tag
contained in an mdx file .

Chapter 1, Paradigm Terms and Symbols 9


parameter
A value supplied to a program or procedure .
path
The path of directories and subdirectories that
should be searched for files .
pattern
A character string containing wildcard symbols .
Two wildcard characters are allowed in the pattern
string : the asterisk (*) and the question mark (?) .
The asterisk stands for any number of characters,
and the question mark stands for a single character.
Both wildcard characters may be used anywhere
and more than once in the pattern .
payment
A numeric expression representing a constant
regular payment . It can be positive or negative .
perimeter
The region composed of the top, bottom, left, and
right of the screen, against which characters (the
foreground) cannot be displayed . The perimeter
frames the screen's display area .

periods
A numeric expression that represents the number
of payments . Each period is the equal time interval
between payments . This number is expressed as an
integer.

picture
An option used to restrict the type of data that may
be entered into a variable, or to format the result of
an expression . The clause may consist of a
function, template, or character expression
containing variables corresponding to function and
template symbols .
popup
A pop-up menu defined with the DEFINE POPUP
command. You may define it to "pop up"
anywhere on the screen .
principal
The principal balance of the loan expressed as a
numeric expression . It can be positive or negative.
print column
A horizontal coordinate on the printed page, from
the left of the page to the right .

10 Quick Reference

print line
The position of a line on the printed page, counting
from the top of the page .

prompt
A character expression you provide that shows up
on the screen and prompts the user for input .
rate
A discount rate, which is an interest rate usually
expressed as a percent .
record number
Each record in a database file has an associated
record number. The first record in the file is
record 1 . Record numbers are reassigned if you
DELETE and PACK some records, or INSERT
records into a database file .
return exp
The value returned from the look-in field . This
evaluates to any valid dBASE IV expression . This
applies to the LOOKUP() function .
row
A vertical screen coordinate, numbered from the
top of the screen to the bottom . The coordinate at
the top of the screen is row 0 .
rows
An array element's y-axis coordinates . The data in
each array can be viewed as containing rows and
columns . An element is referenced by its row and
column position.
scope
The range of records in a database file that you
direct a command to process .
Valid ranges are :
• ALL All the records in the database file

• NEXT <expN> The next <expN> records


in the file, beginning with the current record

• RECORD <expN> One record whose


record number is <expN>
• REST the rest of the records in the
database file, from the current record to the
end of the file

Chapter 1, Paradigm Terms and Symbols 11


skeleton
A pattern of letters and wildcard symbols that a
file or variable name must match . The two
wildcard symbols are the question mark (?), which
indicates any one character, and the asterisk (*),
which indicates any contiguous combination of
characters .
standard
The foreground and background attributes of most
commands that output to the screen, such as the ?
command. Usually, the output of commands that
display data on the screen, but do not allow you to
modify that data, is in standard video.
See attribute, background, enhanced,
foreground .
system memory variable
A predefined memory variable which stores
various print settings that can be queried and
manipulated by the user. System memory variable
names start with an underline (_) character.
tag
An index contained in a multiple index ( .mdx)
file. An mdx file may contain up to 47 tags, each
of which may impose an index order on the
database file.

template
One of a set of formatting symbols used with the
PICTURE keyword . These symbols apply to
single characters of data displayed by either the
SAY option or the GET option of the @
command . These formatting symbols also apply to
the ? or ?? command .

The templates are ! # $ * , . 9 A L N S and X .


variable
A data item, which may be a memory variable,
field (either input or calculated), array element, or
expression .
window
A window defined with the DEFINE WINDOW
command to have special border and screen
attributes .

12 Quick Reference

work area number


A number from 1 to 40 that represents one of the
40 work areas . You may have one database file
open in each work area, and thereby have 40
database files open simultaneously .

Chapter 1, Paradigm Terms and Symbols 13


14 Quick Reference

16 Quick Reference

Commands

These are covered in detail in Chapter 2 of


Language Reference .
?/?? [<expression 1 >
[PICTURE <expC>]
[FUNCTION <function list>]
[AT <expN>]
[STYLE <font number>]]
[,<expression 2> . . .] [,]
Evaluates and displays the value of one or more
expressions with optional formatting, styling, and
positioning . Output can go to the console, the
printer, or to a file, exclusively or in combinations .
??? <expC>
Sends output directly to the printer, bypassing the
installed printer driver.

@ <row>, <col>
[SAY <expression>
[PICTURE <expC>]
[FUNCTION<function list>]]
[GET <variable>
[[OPEN] WINDOW <window name>]
[PICTURE <expC>]
[FUNCTION <function list>]
[RANGE [REQUIRED] [<low>] [,<high>]]
[VALID [REQUIRED] <condition>
[ERROR <expC>]]
[WHEN <condition>]
[DEFAULT <expression>]
[MESSAGE <expC>]]
[COLOR [<standard>]
[,<enhanced>]]
Used to create custom forms for data input and
output . It displays or accepts information in a spec-
ified format at a given set of screen coordinates .

Chapter 2, Commands 17

• <rowl >,<col l >


CLEAR [TO <row2>,<col2>]
Clears a portion of the screen or of the active
window.

• <rowl>,<coll>
FILL TO <row2>,<coI2>
[COLOR <color attribute>]
Changes the colors of a specific rectangular region
on your screen or active window .

• <rowl >,<coll >


TO <row2>,<col2> SCROLL
[UP/DOWN/LEFT/RIGHT][BY <expN>]
[WRAP]
Shifts the contents of a specified region of the
screen up or down, or to the left or right .

• <rowl>,<coll>
TO <row2>,<col2>
[DOUBLE/PANEL
/<border definition string>]
[COLOR <color attribute>]
Draws a box on the screen or active window with
single lines, double lines, or specified characters .

ACCEPT [<prompt>] TO <memvar>


Used primarily in command files to prompt a user
for keyboard entry. It creates a character memory
variable in which it stores the keyboard entry.
Terminate data entry with a ~ J .

ACTIVATE MENU <menu name>


[PAD <pad name>]
Activates an existing bar menu and displays it
for use .

ACTIVATE POPUP <popup name>


Activates a previously defined pop-up menu
for use .
ACTIVATE SCREEN
Restores access to the entire CRT screen, rather
than the limits of the recently active window .

ACTIVATE WINDOW
<window name Iist>/ALL
Activates and displays a defined window from
memory and directs all screen output to that
window.

18 Quick Reference

APPEND [BLANK]/[NOORGANIZE]
Adds new records to the end of the active database
file . BLANK adds a blank record at the end of the
database file . NOORGANIZE brings up a menu
bar without the Organize menu .
APPEND FROM <filename>/?
[[TYPE] <file type>][REINDEX]
[FOR <condition>]
Copies records from an existing file to the end of
the active database file . The FROM file does not
have to be a dBASE IV file . The types of files
you can use in <file type> are DBASEII,
DELIMITED, FW2, FW3, FW4, RPD, DI .)
SYLK, WKS, and SDF. REINDEX rebuilds any
open non-controlling indexes after all new records
are added to the database file .
APPEND FROM ARRAY <array name>
[REINDEX][FOR <condition>]
Adds records to a database file from information in
an array.
APPEND MEMO <memo field name>
FROM <filename>
[OVERWRITE]
Imports a file into a named memo field in the
current record .

ASSIST
Gives you access to the dBASE IV Control Center.
AVERAGE [<expN list>]
[<scope>][FOR <condition>]
[WHILE <condition>]
[TO <memvar list>/TO ARRAY
<array name>]
Computes the arithmetic mean of numeric
expressions .

BEGIN TRANSACTION [<path name>]


<transaction commands>
END TRANSACTION
BEGIN TRANSACTION and END
TRANSACTION define a transaction a series
of commands treated as a single unit of work .
Transaction processing ensures that either all or
none of the commands that affect database file
contents are processed .

Chapter 2, Commands 19

BLANK [FIELDS <field list>/LIKE <skeleton>/


EXCEPT <skelton>]
[REINDEX][<scope>]
[FOR <condition>]
[WHILE <condition>]
Fills fields and records with blanks .

BROWSE
[NOINIT]
[NOFOLLOW]
NOAPPEND]
[NOMENU]
[NOORGANIZE]
[NOEDIT]
[NODELETE]
[NOCLEAR]
[COMPRESS]
[FORMAT]
[LOCK <expN>]
[WIDTH <expN>]
[FREEZE <field name>]
[WINDOW <window name>]
[FIELDS <field name 1 > [/R]
[/<column width>]
/<calculated field name 1>_
<expression 1>
[,<field name 2> [/R]
[/<column width>]
/<calculated field name 2>-
<expression 2>] . . .]
A full-screen, menu-assisted command for editing
and appending records in database ( .dbf) files and
views .

20 Quick Reference

CALCULATE [scope] <option list>


[FOR <condition>]
[WHILE <condition>]
[TO <memvar list>
/TO ARRAY <array name>]
Where <option list> can be any one of the
following functions :

AVG(<expN>)
CNTO
MAX(<exp>)
MIN(<exp>)
NPV(<rate>,<flows>,<initial>)
STD(<expN>)
SUM(<expN>)
VAR(<expN>)

Computes financial and statistical functions with


your data.
CALL <module name>
[WITH <expression list>]
Calls binary file program modules loaded in
memory. You must have first loaded the binary
program files in memory using the LOAD
command.
CANCEL
Stops the execution of a command file, closes all
open command files, and returns dBASE IV to the
dot prompt . CANCEL does not close procedure
files .
CHANGE
[NOINIT]
[NOFOLLOW]
[NOAPPEND]
[NOMENU]
[NOORGANIZE]
[NOEDIT]
[NODELETE]
[NOCLEAR]
[<record number>]
[FIELDS <field list>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
An alternate syntax for EDIT, which is a full-
screen command to display or change the contents
of a record in the active database file or view .

Chapter 2, Commands 21

CLEAR
[ALL/FIELDS/GETS
/MEMORY/MENUS/POPUPS/SCREENS
/TYPEAHEAD/WINDOWS]
Erases the screen, repositions the cursor to the
lower left-hand corner of the screen, and releases
all pending GETs created with the @ command.
Can also close database and low-level files ; release
memory variables, field lists, windows, popups,
and menus ; and empty the type-ahead buffer .
CLOSE
ALL/ALTERNATE/DATABASES
/FORMAT/INDEXES/PRINTER
/PROCEDURE
Closes alternate files, database files, format files,
index ( .ndx and mdx) files, procedure files, and
low-level files . CLOSE PRINTER closes a file
opened with SET PRINTER TO <filename> .
COMPILE <filename> [RUNTIME]
Reads a file containing dBASE IV source code
( .prg file), and creates an executable object code
( .dbo) file .

CONTINUE
Searches for the next record in the active database
file that meets the condition specified by the most
recent LOCATE command .
CONVERT [TO <expN>]
Adds a field to a database file's structure that holds
information required for multi-user lock detection .
COPY TO <filename>
[[TYPE]<file type>]
/[[WITH] PRODUCTION]
[FIELDS<field list>]
[<scope>]
[FOR<condition>]
[WHILE<condition>]
Duplicates all or part of an active database file,
creating a new file . COPY is also the primary
command used to export data to non-dBASE
programs . The types of files you can use in <file
type> are DBASEII, DELIMITED, DBMEMO3,
FW2, RPD, DIF, SYLK, WKS, and SDF .
COPY FILE <filename> TO <filename>
Creates a duplicate of any file.

22 Quick Reference

COPY INDEXES < .ndx file list>


[TO < .mdx filename>]
Converts a list of index ( .ndx) files into file tags in
a single multiple index ( .mdx) file.
COPY MEMO <memo field name>
TO <filename> [ADDITIVE]
Copies the information from a single memo field
to an external file .
COPY STRUCTURE TO <filename>
[FIELDS <field list>]
[[WITH] PRODUCTION]
Copies the structure of the active database file to
a new file, but does not copy any records .
COPY TO <filename>
STRUCTURE EXTENDED
Creates a new database file whose records contain
the structure of the current file .
COPY TAG <tag name>
[OF mdx filename]
TO< .ndx filename>
Converts multiple index ( .mdx) file tags into index
( .ndx) files .

COPY TO ARRAY <array name>


[FIELDS <fields list>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Fills an existing array with the contents of one or
more records from the active database file .

COUNT
[TO <memvar>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Tallies the number of records in the active
database file that match specified conditions .

Chapter 2, Commands 23

CREATE <filename>
or
MODIFY STRUCTURE
Gives you access to the database file design
screen . Use CREATE to build a structure for a new
database file . Use MODIFY STRUCTURE to
modify the structure of a previously created
database file . Both commands provide the same
screen for designing the file structure .
CREATE <filename>
FROM <structure extended file>
Forms a new database file from the extended
structure file created with the COPY
STRUCTURE EXTENDED command .
CREATE/MODIFY APPLICATION
<filename>/?
Gives you access to the dBASE IV Applications
Generator, which generates the code needed to tie
objects together, such as database files, index files,
queries, reports, forms, menus, and lists, in one
application .

CREATE/MODIFY LABEL <filename>/?


Gives you access to the label designer . Use the
label designer to create label form ( .lbl) files using
the fields specified in the current database file or in
other related database files .
CREATE/MODIFY QUERY <filename>/?
or
CREATE/MODIFY VIEW <filename>/?
Gives you access to the query design screen,
which allows you to create query ( .qbe) files that
extract records matching specified conditions, or
to create update query ( .upd) files that can modify
records in the database file .
CREATE/MODIFY REPORT <filename>/?
Gives you access to the report designer, which you
use to create report form ( .frm) files using the
fields specified in the current database file or in
other related database files .

24 Quick Reference

CREATE/MODIFY SCREEN <filename>/?


Gives you access to the forms design screen,
which you use to create custom screen forms .
These screen forms determine the way fields and
other data appear on the screen when you use a
full-screen editing command, such as EDIT or
APPEND .
CREATE VIEW < .vue filename>/?
FROM ENVIRONMENT
Builds a view (.vue) file that contains information
about the current selection of work areas ; open
database, format, and index files ; relations ; field
lists ; and filter conditions . The SET VIEW
command activates the environment saved in the
view file.
DEACTIVATE MENU
Deactivates the active bar menu and erases it from
the screen while leaving it in memory . It is used in
ON SELECTION statements or in procedures
called by ON SELECTION statements .

DEACTIVATE POPUP
Erases the active pop-up menu from the screen
while leaving it intact in memory .
DEACTIVATE WINDOW
<window name list>/ALL
Deactivates specified windows and removes them
from the screen, without releasing them from
memory.
DEBUG <filename>/<procedure name>
[WITH <parameter list>]
Gives you access to the dBASE IV program
debugger.
DECLARE <array name 1 >
[{<number of rows>,}
<number of columns>]
{<array name 2>
[{<number of rows>,}
<number of columns>] . . .}
(In this paradigm, the curly braces indicate
optional items . The square brackets are a required
part of the DECLARE command syntax .)
Creates one- or two-dimensional arrays of
memory variables .

Chapter 2, Commands 25

DEFINE BAR <line number>


OF <popup name>
PROMPT <expC>
[MESSAGE <expC>]
[SKIP [FOR <condition>]]
Defines a single option in a pop-up menu .
DEFINE BOX
FROM <print column>
TO <print column>
HEIGHT <expN>
[AT LINE <print line>]
[SINGLE/DOUBLE
/<border definition string>]
Defines a box to be printed around lines of text .
DEFINE MENU <menu name>
[MESSAGE <expC>]
Used in conjunction with the DEFINE PAD
command to define a menu .

DEFINE PAD <pad name>


OF <menu name>
PROMPT <expC>
[AT <row>,<coI>]
[MESSAGE <expC>]
Defines a single pad in a bar menu .
DEFINE POPUP <popup name>
FROM <rowl>,<coll>
[TO <row2>,<col2>]
[PROMPT FIELD <field name>
/PROMPT FILES
[LIKE <skeleton>]
/PROMPT STRUCTURE]
[MESSAGE <expC>]
Defines a pop-up window's name, location,
border, prompts, and message line .
DEFINE WINDOW <window name>
FROM <rowl>,<coll>
TO <row2>,<coI2>
[DOUBLE/PANEL/NONE
/<border definition string>]
[COLOR [<standard>]
[,<enhanced>] [,<frame>]]
Defines windows, including the borders and
screen colors .

26 Quick Reference

DELETE
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Marks records in the active database file for
deletion.
DELETE TAG <tag name 1>
[OF < .mdx filename>]
[,<tag name 2>
[OF < .mdx filename>] . . .]
Deletes the indicated tags from a multiple index
( .mdx) file if tag names are specified .

DEXPORT SCREEN/REPORT/LABEL
<filename>
[TO <BNL filename>]
Creates a Binary Named List (BNL) file from a
screen, report, or label design file .
DIRECTORY/DIR
[[ON] <drive> :]
[[LIKE] [<path>] <skeleton>]
Displays a list of the database files in the current
directory.
(For DISPLAY commands, see LIST)
DO <program filename>
/<procedure name>
[WITH <parameter list>]
Executes a dBASE command file or procedure . If
the command file or procedure file has not been
COMPILEd, it is first parsed, then compiled and
saved as an object file with a .dbo extension ; then,
the .dbo file is executed.

Chapter 2, Commands 27

DO CASE
CASE <condition>
<commands>
[CASE <condition>
<commands>]

[OTHERWISE
<commands>]
ENDCASE
A structured programming command that selects
only one course of action from a set of
alternatives .
DO WHILE <condition>
<commands>
[LOOP]
[EXIT]
ENDDO
A structured programming command that allows
command statements between it and its associated
ENDDO to be repeated as long as the specified
condition is true.
EDIT
[NOINIT]
[NOFOLLOW]
[NOAPPEND]
[NOMENU]
[NOORGANIZE]
[NOEDIT]
[NODELETE]
[NOCLEAR]
[<record number>]
[FIELDS <field list>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
A full-screen command to display or change the
contents of a record in the active database file
or view.
EJECT
Causes the printer to advance the paper to the top
of the next page .

28 Quick Reference

EJECT PAGE
Either advances the streaming output to the
defined ON PAGE handler on the current page, or
to the beginning of the next page .
ERASE <filename>/?
or
DELETE FILE <filename>/?
Removes a file from the disk directory .
EXPORT TO <filename>
[TYPE] PFS/DBASEII/FW2/FW3/FW4/RPD
/W KS/W K1
[FIELD <field list>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Copies the open database file to a file format
usable by PFS :FILE, dBASE II, Framework II,
Framework III, Framework IV, RapidFile, or
Lotus 1-2-3 (either .wks or .wk l ) .

FIND <literal key>


Searches an indexed database file for the first
record with an index key that matches the
specified character string or number . FIND
conducts a very rapid record search .
FUNCTION < UDF name>
[PARAMETERS]

.<other dBASE commands>

RETURN <expression>
Defines a user-defined function .
GO/GOTO BOTTOM/TOP [IN <alias >]
or
GO/GOTO [RECORD] <record number>
[IN <alias >]
or
<record number> [IN <alias>]
Positions the record pointer to a specified record
in the active database file .
HELP [<dBASE IV keyword>]
A menu-driven command that provides
information about dBASE IV.

Chapter 2, Commands 29

IF <condition>
<commands>
[ELSE
<commands>]
ENDIF
A structured programming command that enables
conditional processing of commands . The IF
structure must terminate with ENDIF.
IMPORT FROM <filename> [TYPE]
PFS/D BASEII/F W2/F W3/F W4/RPD/WKS
/W K1
Creates dBASE IV files from PFS :FILE forms,
dBASE II database files, Framework database and
spreadsheet frames, RapidFile data files, and from
Lotus 1-2-3 (either .wks or .wk l) spreadsheets .

INDEX ON <key expression>


TO < .ndx filename> [UNIQUE]
or
INDEX ON <key expression>
TAG <tag name> [OF < .mdx filename>]
[FOR <condition>] [UNIQUE]
[DESCENDING]]
Creates an index in which records from a database
file are ordered alphabetically, chronologically, or
numerically.
INPUT [<prompt>] TO <memvar>
Used in dBASE programs to prompt a user to
enter an expression from the keyboard . Data entry
is terminated by a ._J .
INSERT [BEFORE] [NOORGANIZE]/[BLANK]
Adds a single new record to the database file at the
current record location .

JOIN WITH <alias> TO <filename>


FOR <condition> [FIELDS <field list>]
Creates a new database file by merging specified
records and fields from two open database files .
KEYBOARD <expC> [CLEAR]
Enters a series of characters into the type-ahead
buffer. dBASE IV then reads the characters as if
the user typed them in .

30 Quick Reference

LABEL FORM <label filename>/?


[<scope>]
[FOR <condition>]
[WHILE <condition>]
[SAMPLE]
[TO PRINTER/TO FILE <filename>]
Uses a specified label format file designed with
MODIFY LABEL to print, display, or write labels
to a file on disk .
LIST/DISPLAY
[[FIELDS] <expression list>]
[OFF]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
[TO PRINTER/TO FILE <filename>]
Used to view the contents of a database file in an
unformatted columnar list .

LIST/DISPLAY FILES [[LIKE] <skeleton>]


[TO PRINTER/TO FILE <filename>]
Displays directory information similar to that
displayed by the DOS DIR command .
LIST/DISPLAY HISTORY
[LAST <expN>]
[TO PRINTER/TO FILE <filename>]
Outputs a list of commands that have been
executed and are stored in the history buffer.
LIST/DISPLAY MEMORY
[TO PRINTER/TO FILE <filename>]
Provides information on how dBASE IV is using
your computer's memory.
LIST/DISPLAY STATUS
[TO PRINTER/TO FILE <filename>]
Provides information about the current dBASE IV
session.
LIST/DISPLAY STRUCTURE
[IN <alias >]
[TO PRINTER/TO FILE <filename>]
Displays the field definitions of the specified
database file .
LIST/DISPLAY USERS
Identifies the workstations currently logged in to
dBASE IV in a networking environment .

Chapter 2, Commands 31

LOAD <binary filename>


Loads binary program files in memory .
LOCATE
[FOR <condition>]
[<scope>]
[WHILE <condition>]
Searches the active database file for a record that
matches a specified condition .
LOGOUT
Logs out the current user and sets up a new log-in
screen.
MODIFY COMMAND/FILE <filename>
[WINDOW <window name>]

Calls the dBASE IV full-screen text editor or a


specified word processor.
MOVE WINDOW <window name>
TO <row>,<column>
/BY <delta row>,<delta column>
Moves a window to a new location on the screen .
NOTE/* <text>
and
[<command>] &&<text>
Indicates comment lines in a program ( .prg) file .
ON BAR <expN> OF <popup name>
[<command>]
Executes a specified command when a bar in a
pop-up menu is selected .
ON ERROR <command>
/ESCAPE <command>
/KEY [LABEL <key label name>]
[<command>]
Executes the specified commands if an error
occurs, the Esc key is pressed, or the <key label
name> key is pressed .
ON EXIT BAR <expN> OF <popup name>
[<command>]
Executes a specified command when the cursor is
moved off the bar in a pop-up menu .

ON EXIT MENU <menu name> [<command>]


Executes a specified command when the cursor is
moved off certain pads in a specified menu .

32 Quick Reference

ON EXIT PAD <pad name> OF <menu name>


[<command>]
Executes a specified command when the cursor is
moved off a pad in a menu .

ON EXIT POPUP <popup name>


[<command>]
Executes a specified command when the cursor is
moved off certain bars in a specified pop-up menu .

ON MENU <menu name> [<command>]


Executes a specified command when certain pads
in a menu are selected .
ON MOUSE [<command>]
Detects when the user clicks the left mouse button
and executes a command when the button is
released.

ON PAD <pad name> OF <menu name>


[<command>]
or
ON PAD <pad name> OF <menu name>
[ACTIVATE POPUP <popup name>]
Executes a specified command when a menu pad
is selected .
ON PAGE
[AT LINE <expN>
<command>]
Triggers an action when the streaming output
passes a particular line on the current page during
a ?/?? or EJECT PAGE command ; typically used
to handle page breaks with footers and headers
while printing a report .

ON POPUP <popup name> [<command>]


Executes a specified command when certain bars
in a pop-up menu are selected .

ON READERROR [<command>]
Traps errors and allows for error recovery during
full-screen operations .
ON SELECTION BAR <expN> OF <popup
name> [<command>]
Executes a specified command when a bar in a
pop-up menu is chosen.

Chapter 2, Commands 33

ON SELECTION MENU <menu name>


[<command>]
Executes a specified command when certain pads
in a specified menu are chosen .

ON SELECTION PAD <pad name> OF


<menu name> [<command>]
Executes a specified command when a pad in a
menu is chosen .

ON SELECTION POPUP <popup name>/ALL


[BLANK] [<command>]
Executes a specified command when certain bars
in a specified pop-up menu are chosen .

PACK
Removes records that are marked for deletion from
the active database file and recreates any open
indexes .

PARAMETERS <parameter list>


Assigns local variable names to data items passed
from a calling program.
PLAY MACRO <macro name>
Executes macros from the current macro library .

PRINTJOB
<commands>
ENDPRINTJOB
Structured programming commands that control a
printjob .
PRIVATE ALL [LIKE/EXCEPT <skeleton>]
or
PRIVATE <memvar list>
Use to create local memory variables in a lower-
level program with the same names as memory
variables that were created in a calling rogram or
were previously declared as PUBLIC .
PROCEDURE <procedure name>
Identifies the beginning of a subroutine .

PROTECT
Creates and maintains security on a dBASE IV
system .

34 Quick Reference

PUBLIC <memory variable list>


/ARRAY <array name list>
Designates specified memory variables and arrays
that you can use and alter in any dBASE program
or subprogram . Unlike private memory variables
and array, public variables are not released when
the program ends .
QUIT [WITH<expN>]
Closes all open files, terminates the dBASE IV
session, and returns control to the operating
system. With <expN> returns an integer upon
termination .
READ [SAVE]
Activates all @a . . . GETs issued since the last
CLEAR, CLEAR ALL, CLEAR GETS, or READ
command. It is most commonly used in dBASE
program files for full-screen entry or editing of
data.

RECALL
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Reinstates records that are marked for deletion in
the active database file.
REINDEX
Rebuilds all active index ( .ndx) and multiple index
( .mdx) files in the current work area .
RELEASE <memvar list>
or
RELEASE ALL [LIKE/EXCEPT <skeleton>]
or
RELEASE MODULES [<module name list>]
/MENUS [<menu name list>]
/POPUPS [<popup name list>]
/SCREENS [<screen name list>]
/WINDOWS [<window name list>]
Deletes memory variables, thereby opening
memory space for other use . RELEASE is also
used with the appropriate keyword to remove
LOADed assembly language modules, menus,
popups, screens and windows from memory.
RENAME <old filename>
TO <new filename>
Changes the name of a file .

Chapter 2, Commands 35

REPLACE
<field> WITH <exp> [ADDITIVE]
[,<field> WITH <exp> [ADDITIVE]]
[REINDEX][<scope>]
[FOR <condition>]
[WHILE <condition>]
Changes the contents of specified fields in the
active database file .
REPLACE FROM ARRAY <array name>
[FIELDS <field list>][<scope>]
[FOR <condition>]
[WHILE <condition>][REINDEX]
Replaces fields in a database file with data from an
array.

REPORT FORM <report form filename>/?


[PLAIN]
[HEADING <expC>]
[NOEJECT]
[SUMMARY]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
[TO PRINTER/TO FILE <filename>]
Prints information from the active database or
view using a report form file created by CREATE/
MODIFY REPORT. You may direct a report to the
screen, the printer, or to a file .
RESET [IN <alias>]
Removes the integrity tag from a file .
RESTORE FROM <filename> [ADDITIVE]
Retrieves and activates memory variables and
arrays from a memory file .

RESTORE MACROS FROM <macro file>


Restores macros that were saved to a macro
library.
RESTORE SCREEN FROM <screen name>
Displays a previously saved screen image from its
screen memory variable name .
RESTORE WINDOW <window name list>
/ALL FROM <filename>
Restores window definitions from a disk file to
memory.

36 Quick Reference

RESUME
Causes a SUSPENDed program to continue
execution.

RETRY
Re-executes a command that caused an error.
RETURN [<expression>/TO MASTER
/TO <procedure name>]
Restores control to calling programs, to the dot
prompt, or to the Control Center. When control is
restored to a program, the command following the
calling command is executed . Alternately,
RETURN is used at the end of a user-defined
function to return the result of the function .
ROLLBACK [<database filename>]
Restores the database and index files to the state
they were in before the current transaction and
then terminates the transaction .
RUN/!<DOS command>
Executes a specified DOS command, or any
program which can be executed by DOS, from
within dBASE IV.
SAVE TO <filename>
[ALL [LIKE/EXCEPT <skeleton>]]
Stores all or part of the current set of memory
variables and array elements to a disk file .
SAVE MACROS TO <macro file>
Saves the currently defined macros from memory
to a disk file.
SAVE SCREEN TO <screen name>
Saves an image of the current display to a memory
variable name .
SAVE WINDOW <window name list>
/ALL TO <filename>
Saves window definitions to a disk file .

Chapter 2, Commands 37

SCAN
[<scope>]
FOR <condition>]
[WHILE <condition>]
[<commands>]
[LOOP]
[EXIT]
ENDSCAN
A looping programming construct with an implicit
skip, suitable for applying incremental processing
commands to the records of a database file .
SEEK <exp>
Searches for the first record in an indexed database
file with a key that matches a specified expression .
SEEK conducts a very rapid record search .

SELECT <work area name/alias>


Use to choose a work area in which to open a
database file, or to specify a work area in which a
database file is already open .
SHOW MENU <menu name>
[PAD <pad name>]
Displays a bar menu without activating it .
SHOW POPUP <popup name>
Displays a pop-up menu without activating it .

SKIP [<expN>] [IN <alias>]


Moves the record pointer forward or backward in a
database file .
SORT TO <filename>
ON <fieldl >[/A] [/C] [/D]
[,<field2> [/A] [/C] [/D] . . .]
[ASCENDING]/[DESCENDING]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Creates a new database file in which the records of
the active database file are positioned in the
alphabetical, chronological, or numerical order of
the specified key fields .
STORE <expression> TO <memvar list>
/<array element list>
Creates and initializes one or more memory
variables, and initializes array elements previously
created with the DECLARE command .

38 Quick Reference

SUM [<expN list>]


[TO <memvar list>
/TO ARRAY <array name>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Totals numeric expressions to memory variables
or arrays .
SUSPEND
A debugging command that lets you interrupt a
running program . Once the program is suspended,
you can enter commands at the dot prompt . Use
RESUME to continue or CANCEL to clear the
program from memory.
TEXT
<text characters>
ENDTEXT
Outputs blocks of text to the screen, printer, or file .
This command provides a simple, convenient way
to write to the output device .
TOTAL ON <key field> TO <filename>
[FIELDS <fields list>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
Sums the numeric fields of the active database file
and creates a second database file to hold the
results . The numeric fields in the TO database file
contain the totals for all records that have the same
key value in the original database .

TYPE <filename>
[TO PRINTER/TO FILE
<filename>][NUMBER]
Displays the contents of an ASCII text file .
UNLOCK [ALL/IN <alias>]
Releases record and file locks so that other users
can modify the data .

Chapter 2, Commands 39

UPDATE ON <key field> FROM <alias >


REPLACE <field name 1 >
WITH <expression 1 >
[,<field name 2>
WITH <expression 2> . . .]
[RANDOM] [REINDEX]
Uses data from another database file to replace
fields in the current database file . It makes the
changes by matching records in the two database
files based on a single key field .
USE [< database filename>/?]
[IN <work area number>]
[INDEX < .ndx or mdx file list>]
[ORDER < .ndx filename>
/[[TAG] < .mdx tag>
[OF < .mdx filename>]]]
[ALIAS <alias>]
[EXCLUSIVE]
[NOUPDATE][NOLOG][NOSAVE][AGAIN]
Opens an existing database file and may open
.mdx and ndx index files . If the database contains
memo fields, the associated .dbt file is opened
automatically.
WAIT [<prompt>] [TO <memvar>]
Causes all dBASE IV processing to pause until
any key is pressed.

ZAP
Removes all records from the active database file .

40 Quick Reference
SET Commands

42 Quick Reference

SET Commands

This section lists the SET commands of


dBASE IV Default settings are shown in upper-
case . Commands identified with an * may be
changed through the Config .db file . See Getting
Started with dBASE IV.

SET
Displays a menu for changing the values of many
SET commands .
SET ALTERNATE on/OFF
Sends/does not send screen output to a text file .
*SET ALTERNATE TO [<filename>
[ADDITIVE]]
Sends screen output to the specified file ; erases
any existing file of the same name, or adds to the
end with ADDITIVE .
*SET AUTOSAVE on/OFF
Saves each record to the disk after a single I/O
operation. When SET AUTOSAVE is OFF,
dBASE IV saves records to disk as the record
buffer is filled.
*SET BELL ON/off
Sets the audio alarm on or off.
*SET BELL TO
[<frequency>,<duration>]
Sets the tone and duration of the audio alarm .
Default frequency is 512 hertz, duration is 2 ticks .
*SET BLOCKSIZE TO <expN>
Sets memo fields and mdx file blocks to multiples
of 512 bytes . Default is 1 .

Chapter 3, SET Commands 43


*SET BORDER TO
[SINGLE/DOUBLE/PANEL/NONE/
<border definition string>]
Sets menu, window, and pop-up borders .
*SET .CARRY on/OFF
Carries forward changes made in the contents of
the last record during APPEND and INSERT.
SET CARRY TO [<field list>
[ADDITIVE]]
Determines which fields are carried forward .
Updates only specified fields . If ADDITIVE is
used, the field list is added to previous fields
specified with SET CARRY.
*SET CATALOG on/OFF
Adds/does not add open files to the current
catalog .

*SET CATALOG TO [<filename>/?]


Opens or names the catalog file .

*SET CENTURY on/OFF


Displays/does not display the century in a date
field .
*SET CLOCK on/OFF
Displays/does not display the system clock at the
upper-right corner of the screen .

*SET CLOCK TO [<row>,<column>]


Changes the position of the clock display . Default
is row 0, column 68 .
SET COLOR ON/OFF
Toggles between monochrome and color monitors .
*SET COLOR TO [<standard>]
[,[<enhanced>][,[<perimeter>]
[,[<background>]]]]
Sets overall color parameters of screen areas .
*SET COLOR OF NORMAL/MESSAGES
/TITLES/HIGHLIGHT/BOX/INFORMATION
/FIELDS TO [<attribute>]
Lets you set the color attributes of screen area
groupings .

Please see the description of this command in


Language Reference for the screen area in each
group, and for color attribute names .

44 Quick Reference

*SET CONFIRM on/OFF


Determines cursor movement at the end of an
entry field .

*SET CONSOLE ON/off


Turns the screen display on and off from within a
program.
*SET CURRENCY TO [<expC>]
Changes the currency symbol displayed .

*SET CURRENCY LEFT/right


Displays the currency symbol on the left or the
right of the numeric value .

*SET CURSOR ON/off


Determines if the cursor is displayed .
*SET DATE [TO] AMERICAN/ansi/british
/french/german/italian/japan/usa/mdy
/dmy/ymd
Determines the format for date displays .
*SET DBTRAP ON/off
Provides a net of protection against program errors
when you interrupt the execution of one command
to execute a second command .
*SET DEBUG on/OFF
Determines whether output from SET ECHO is
sent to the screen or printer .
*SET DECIMALS TO <expN>
Determines the number of decimal places
displayed . Range is 0 to 18 . Default is 2 .

*SET DEFAULT TO [<drive>[ :]]


Specifies the default drive .
*SET DELETED on/OFF
Does not use/uses records marked for deletion .
*SET DELIMITERS on/OFF
Uses/does not use specified entry delimiters .

*SET DELIMITERS TO [<expC>/DEFAULT]


Specifies delimiters for full-screen field and
variable displays .
*SET DESIGN ON/off
Prevents transfers to design mode from the dot
prompt, from within a procedure, or from the
Control Center.

Chapter 3, SET Commands 45


*SET DEVELOPMENT ON/off


Triggers an automatic compilation of program
source ( .prg) files if you use an external text editor .
*SET DEVICE TO SCREEN/printer/file
<filename>
Sends output of the @a . . .SAY command to the
screen, to a printer, or to a file .

SET DIRECTORY TO
[[<drive : >] [<path>]]
Specifies the operating system working drive and
directory from within dBASE IV
*SET DISPLAY TO MONO/COLOR/EGA25
/EGA43/MONO43
Sets display mode to monochrome, color, 25-line
or 43-line EGA, or 43-line monochrome for
systems equipped with graphics cards that support
these modes . The VGA graphics card defaults
to EGA .
*SET ECHO on/OFF
Sends/does not send the commands as they are
executed to the screen or printer .
*SET ENCRYPTION ON/off
Encrypts/does not encrypt files that were originally
encrypted by using PROTECT, when these files
are later copied . Cannot encrypt files by itself
without PROTECT.
*SET ESCAPE ON/off
Interrupts/does not interrupt program execution
when the Esc key is pressed.
*SET EXACT on/OFF
Requires/does not require absolute matches in
character comparison .
*SET EXCLUSIVE on/OFF
Sets exclusive/non-exclusive access to files on a
multi-user system .
SET FIELDS on/OFF
Respects/ignores the fields list .
SET FIELDS TO [<field> [/R]/
<calculated field id> . . .] [,<field> [/R]/
<calculated field id> . . .]
Defines a list of fields that may be accessed in one
or more files .

46 Quick Reference

SET FIELDS TO ALL [LIKE/EXCEPT


<skeleton>]
Sets a fields list using wildcard characters .
SET FILTER TO [FILE <filename>/?]/
[<condition>]
Displays only the records that meet the specified
condition .
SET FORMAT TO [<format filename>/?]
Uses the specified format file for data entry.

*SET FULLPATH on/OFF


Suppresses the pathname display.
*SET FUNCTION <expN>/<expC>/
<key label> TO <expC>
Programs function keys .

*SET HEADINGS ON/off


Displays/does not display field names above the
fields in LIST, DISPLAY, SUM, TYPE, or
AVERAGE.
*SET HELP ON/off
Prompts/does not prompt for help when an error
occurs .
*SET HISTORY ON/off
Saves/does not save command execution in a
history buffer.
*SET HISTORY TO <expN>
Specifies the number of commands to save in the
history buffer. Default is 20 .
*SET HOURS TO [12/24]
Displays a 12-hour clock or 24-hour clock . Default
is 12-hour.
*SET IBLOCK TO <expN>
Lets you change the default size of the indexing
block that dBASE allocates to new index data
(.MDX) files .

Chapter 3, SET Commands 47


SET INDEX TO ?
or
SET INDEX TO <filename list>
[ORDER < .ndx filename>]
or
SET INDEX TO <filename list>
[ORDER < .mdx tag>
[OF < .mdx filename>]]
Opens ndx and mdx files, and specifies the
master index for a database file .
*SET INSTRUCT ON/off
Controls whether prompts appear at the Control
Center when a file is selected . (When OFF with
TALK ON, displays dBASE code while forms,
reports, or labels are generated .)

*SET INTENSITY ON/off


Uses/does not use the enhanced display.
SET KEY TO [<exp :match>/
RANGE <exp :low>, <exp :high>/
<exp :low>[,]/,<exp :high>]
[IN <alias>]
Allows the display of only those records of a
database file whose ordering index key meets a
specified range of conditions .

*SET LDCHECK ON/off


Enables or disables language driver ID checking .
SET LIBRARY TO [<filename>]
Points to a library of general procedures that any
dBASE IV application can access .
*SET LOCK ON/off
Uses/does not use all features of automatic record
locking.
See the SET LOCK command in Language
Reference for the effect of this command on
automatic locking .
*SET MARGIN TO <expN>
Controls the printer left margin setting . Default
is 0 .

*SET MARK TO [<expC>]


Changes the date separator character .

48 Quick Reference

*SET MBLOCK TO <expN>


Lets you change the default size of the block that
dBASE allocates to new memo field files ( .DBT) .
*SET MEMOWIDTH TO <expN>
Sets width of memo fields in columns . Minimum
is 8, and maximum is 255 . Default is 50
characters .

SET MESSAGE TO [<expC>


[AT <expN> [,<expN>]]]
Displays a user-defined message on the screen .
*SET MOUSE ON/off
Enables or disables the mouse cursor, if one is
installed .

*SET NEAR on/OFF


If ON, locates the next closest value in an index
when the sought value is not found . If OFF, points
to EOF when the value is not found .
*SET ODOMETER TO <expN>
Defines the update interval of the record counter
for commands that display a record count .
Maximum is 200 . Default is 1 .
SET ORDER TO
SET ORDER TO <expN>
SET ORDER TO < .ndx filename>/
[TAG]< .mdx tagname>
[OF < .mdx filename>] [NOSAVE]
Sets up a master index . Specifies order by the
index tag or filename .
*SET PATH TO [<path list>]
Sets the directory paths to be searched for files not
in the current directory.
*SET PAUSE on/OFF
Pauses/does not pause between screen loads of
data during use of the SQL SELECT command .
*SET POINT TO [<expC>]
Sets the character used for the decimal separator .
Default is the period .
*SET PRECISION TO [<expN>]
Sets precision to be used in fixed point arithmetic .
Range is 10 to 20, default is 16 .

Chapter 3, SET Commands 49


*SET PRINTER on/OFF


Sends/does not send all output to a printer .
*SET PRINTER TO [<DOS device>]
Sends printer output to a local printer. Default is
PRN.

*SET PRINTER TO \\<computer name>


\<printer name> = <destination>
SET PRINTER TO \\SPOOLE R
SET PRINTER TO \\CAPTUR E
Redirects printer output to the specified device ;
supports network printing .
SET PRINTER TO FILE <filename>
Redirects printer output to a disk file, which can be
formatted for a specific printer.

SET PROCEDURE TO
[<procedure filename>]
Opens a procedure file .
*SET REFRESH TO <expN>
Determines the interval for checking to see if a
record in a multi-user file has changed during
BROWSE and EDIT only. Default is 0, and the
range is from 0 to 3,600 seconds .
SET RELATION TO
[<expression> INTO <alias>
[,<expression> INTO <alias> . . .]]
Links the active database file to one or more open
database files according to a common key
expression .
*SET REPROCESS TO <expN>
Sets the number of retries before dBASE IV stops
trying to execute a command. Default is 0, and the
range is from -1 to 32,000.
*SET SAFETY ON/off
Asks/does not ask before overwriting an
existing file .

*SET SCOREBOARD ON/off


Displays/does not display dBASE IV messages on
line 0, if SET STATUS is OFF. If SET STATUS is
ON, SET SCOREBOARD has no effect .
*SET SEPARATOR TO [<expC>]
Sets the character used as the numeric separator.
Default is the comma .

50 Quick Reference

SET SKIP TO [<alias> [, <alias >] . . .]


Sets the relationship of database files linked with
the SET RELATION command .

*SET SPACE ON/off


Lets the ? and ?? commands print a space between
the printed expressions .

*SET SQL on/OFF


Activates/deactivates the SQL mode .

*SET STATUS on/OFF


Displays/does not display the status bar .
*SET STEP on/OFF
Stops/does not stop program execution after each
command .

*SET TALK on/OFF


Displays/does not display command responses to
the screen.
SET TITLE ON/off
Turns the catalog file title prompt on and off.

*SET TRAP on/OFF


Calls/does not call the debugger when an error
occurs during program execution .

*SET TYPEAHEAD TO <expN>


Specifies the size of the type-ahead buffer . Default
is 20 characters .
*SET UNIQUE on/OFF
Includes the first record/all records with identical
keys in an index file .

*SET VIEW TO <query filename>/?


Performs a query, or updates the environment in a
view ( .vue) file .

SET WINDOW OF MEMO TO


[<window name>]
Uses the named window for editing a memo field
while in APPEND, BROWSE, CHANGE, EDIT,
or READ .

Chapter 3, SET Commands 51


52 Quick Reference
F nct ons

54 Quick Reference

Functions

These are covered in detail in Chapter 4 of


Language Reference .
& <character variable> [ .]
Substitutes the contents of a character memory
variable in place of the variable's name .
ABS(<expN>)
Calculates the absolute value of a numeric
expression .
ACCESS()
Returns the access level of the current user as
defined with PROTECT.
ACOS(<expN>)
Calculates the angle size in radians for a given
cosine .
ALIAS([<al ias>])
Returns the alias name of a specified work area.
ASC(<expC>)
Returns the ASCII decimal code for the first
character of a character expression .
ASIN(<expN>)
Calculates the angle size in radians for a given
sine .
AT(<expCl >,<expC2>[,<expN>])
or
AT(<expC>,<memo field name>[,<expN>])
Returns a number indicating the starting position
of the first character string within the second
string . ATO starts the search from the first
character of the string or memo field being
searched .

Chapter 4, Functions 55

ATAN(<expN>)
Calculates the angle size in radians for a given
tangent.
ATN2(<expNl >,<expN2>)
Calculates the angle size in radians from the sine
<expN 1 > and cosine <expN2> .
BAR()
Returns the number of last selected prompt bar in
the active pop-up menu .
BARCOUNT ([<expC>])
Returns the number of bars in the active or
specified pop-up menu .
BAR PROM PT(<expN>[,<expC>])
Returns the text that appears in a particular bar of a
specified pop-up menu .
BOF([<alias>])
Returns a true ( .T.) if the record pointer is at the
beginning of the database file .
CALL(<expC><expression>
[,<expression list>])
Used with the LOAD command, executes a
shareable image program module .
CATALOG()
Returns the name of the active catalog file .

CDOW(<expD>)
Returns the name of the day of the week.
CEILING(<expN>)
Returns the smallest integer greater than or equal
to the given argument.
CERROR()
Returns the number of the last compiler error
message.
CHANGE([<alias>])
Determines if another user has changed a record
since it was read from the database file .
CH R(<expN>)
Converts a numeric expression to a character.
CMONTH(<expD>)
Returns the name of the month from a date
expression .

56 Quick Reference

COL()
Returns the column number of the current cursor
position .

COMPLETED()
Returns a true ( .T.) if the transaction has
successfully completed (that is, if the BEGIN
TRANSACTION command was terminated by an
END TRANSACTION) .

COS(<expN>)
Calculates the cosine from an angle measured in
radians .
CTOD(<expC>)
Converts a date from character type to date type .
DATE()
Returns the system date .
DAY(<expD>)
Returns the the day of the month from a date
expression .

DBF([<alias>])
Returns the name of the database file in USE in the
specified work area .
DELETED([<alias>])
Returns a true ( .T.) if the current record in the
specified work area is marked for deletion, or a
false (.F) if it is not .

DESCENDING([[< .mdx filename>,]


<expN>[,<alias>]])
Returns a true (.T.) if the specified mdx index tag
was created with the DESCENDING keyword .
DGEN(<expCl >[,<expC2>])
Runs the template language interpreter from
within dBASE IV programs or the dot prompt to
create dBASE programs from screen objects .
DIFFERENCE(<expC>,<expC>)
Compares the SOUNDEX() codes for two
character strings and returns a number, from 1 to 4,
indicating how closely the two strings match
phonetically.
DISKSPACE()
Returns the number of free bytes on the default
disk drive.

Chapter 4, Functions 57

DMY(<expD>)
Converts a date expression to DD Month YY .
DOW(<expD>)
Returns the number of the day of the week from a
date expression.
DTOC(<expD>)
Converts a date type expression to character type .

DTOR(<expN>)
Converts an angle size measured in degrees to an
angle size measured in radians .
DTOS(<expD>)
Converts a date type expression to a character
string in the form CCYYMMDD, which is
suitable for indexing.

EOF([<alias>])
Returns a true (T.) if the record pointer is at the
end of the file, that is, past the last record of the
database file .
ERROR()
Returns the error number of the last dBASE IV
error condition .
EXP(<expN>)
Returns the value that results from raising the
constant e to the power of <expN> .
FCLOSE(<expN>)
Closes a low-level file previously opened with the
FCREATEO or FOPENO function.
FCREATE(<expC1 >[,<expC2>])
Creates and opens a low-level file, and returns
a file handle number.

FDATE(<expC>)
Returns the date, from the operating system, that
the specified file was last modified .
FEOF(<expN>)
Tests whether the file pointer is at the end of a
low-level file .
FERROR( )
Returns the operating system error status number
for a low-level file operation .

58 Quick Reference

FFLUSH(<expN>)
Writes the contents of the system buffer for a
specified low-level file to disk .
FGETS(<expNl >[,<expN2>][,<expC>])
Reads and returns a string of characters from a
low-level file opened with the FCREATE() or
FOPEN() function.
FIELD(<expN> [,<alias>])
Returns the field name corresponding to the
specified field number in the file structure .
FILE(<expC>)
Determines if the specified file exists on disk .
FIXED(<expN>)
Converts floating point (type F) numbers to Binary
Coded Decimal (type N) numbers .
FKLABEL(<expN>)
Returns the name of the specified function key .

FKMAX()
Returns an integer indicating the maximum
number of programmable function keys .
FLDCOUNT([<alias>])
Returns the number of fields in the specified
database file .
FLDLIST(<expN>)
Returns the nth field or expression of a SET
FIELDS TO list .

FLOAT(<expN>)
Converts Binary Coded Decimal (type N) numbers
to floating point (type F) numbers .
FLOCK([<alias>])
Locks a database file so it cannot be modified by
another user.

FLOOR(<expN>)
Calculates and returns the largest integer less than
or equal to the specified value .
FOP EN(<expC1 >[,<expC2>])
Opens an existing file and returns a file handle
number.

Chapter 4, Functions 59

FOR([[< .mdx filename>,]<expN>[,<alias>]])


Returns the FOR condition used to create an mdx
file index tag .
FOUND([<alias>])
Returns a true ( .T.) if the previous FIND,
LOCATE, SEEK, or CONTINUE command in the
specified work area was successful .

FPUTS(<expNl >,<expC1 >


[,<expN2>][,<expC2>])
Writes a character string and end-of-line indicator
to the file at the current pointer position. It returns
the number of bytes written to the file .
FREAD(<expNl >,<expN2>)
Reads and returns a string of characters, including
any end-of-line indicators, from a file opened with
the FCREAI'E() or FOPEN() function .
FSEEK(<expNl >,<expN2>[,<expN3>])
Moves the file pointer to a specified location
within a file opened by FCREAI'EO or FOPENO .
FSIZE(<expC>)
Returns an integer for the size, in bytes, of the
specified file as reported by the operating system .
FTI M E(<expC>)
Returns the time, from the operating system, that
the specified file was last modified .
FV(<payment>, <rate>, <periods>)
Calculates the future value of equal, regular
deposits into an investment that yields a fixed
interest rate for a certain number of time periods .
FWRITE(<expN1 >, <expC1 >[,<expN2>])
Writes a specified character string to a file opened
with FCREATE() or FOPENO . It returns the
number of bytes written to the file .
GETENV(<expC>)
Returns the contents of a DOS environment
system variable, such as PATH or COMSPEC .
HOME()
Returns the path from which the current
dBASE IV session was invoked .

60 Quick Reference

ID()
Returns the name of the current user on a Local
Area Network .
IIF(<condition>,<expl >,<exp2>)
Immediate IF is a shortcut to the IF . . .ENDIF
command construct . If the condition is true, IIF( )
returns the result of the first expression ; otherwise,
it returns the result of the second expression .
IN KEY([<expn>])
Returns an integer representing the most recent
key pressed on the keyboard .
INT(<expN>)
Converts a number to an integer by truncating
decimals .
ISALPHA(<expC>)
Returns a true ( .T.) if the character expression
begins with an alphabetic character.
ISBLANK(<exp>)
Tests whether the specified expression is blank .
ISCOLOR()
Returns a true ( .T.) if the system is capable of
displaying color.

(SLOWER(<expC>)
Returns a true (.T.) if the first character in the
expression is lowercase.

ISMARKED([<alias>])
Returns a true ( .T.) if a change has been made to a
database file during a transaction .
ISMOUSE()
Returns a logical true (.T.) or false ( .F) that
indicates whether or not a mouse driver has been
installed.

(SUPPER(<expC>)
Returns a true (T.) if the first character in the
expression is uppercase .
KEY([[< .mdx filename>,] <expN> [,<alias>]])
Returns the key expression for the index file
specified by <expN> .

Chapter 4, Functions 61

KEYMATCH (<exp>[,<index number>[,<exp


work area>]])
Returns a logical true (.T.) or false ( .F.) that
indicates whether or not a specified expression is
found in a specified index .

LASTKEYO
Returns the decimal ASCII value of the key
pressed to exit the last full-screen command .
LEFT(<expC>/<memo field name>,
<expN>)
Returns the specified number of characters from a
character string or memo field, starting from the
first character on the left.

LEN(<expC>/<memo field name>)


Returns the number of characters in a specified
string or a memo field .
LIKE(< pattern >,<expC>)
Compares a character string against a pattern that
may contain wildcards .
LINENO()
Returns the line number of the command line
about to be executed in the current procedure .

LKSYS(expN)
Determines the log-in name of the user who
locked a record or file that you have tried
unsuccessfully to access, and the date and time of
the lock . It also returns the time, date, and log-in
name of the user who last updated the record or
file.
LOCK([<expC list>,<alias>]/ [<alias>])
Locks one or more database records, same as
RLOCKO .
LOG(<expN>)
Returns the natural logarithm of a specified
number.

LOG 10(<expN>)
Returns the common log to base 10 of a specified
number.

62 Quick Reference

LOOKUP(<return field>, <look-for exp>,


<look-in field>)
Searches for a record and returns a field in a
specified database file .
LOWER(<expC>)
Converts uppercase letters to lowercase .

LTRIM(<expC>)
Removes leading blanks from a character string .
LUPDATE([<alias>])
Returns the date of the last update of the specified
database file .
MAX(<expressionl >,<expression2>)
Returns the larger of two numeric, date, or
character expressions .

MCOL()
Returns the column position of the mouse pointer
on the screen .
MDX([<expN>[,<alias>]])
Returns the name of an open mdx file .
MDY(<expD>)
Converts the date format to Month DD, YY

MEMLINES(<memo field name>)


Returns the number of lines contained in a memo
field, when the memo field is word wrapped at the
current SET MEMO WIDTH value .
MEMORY([expN])
Returns the amount of memory in kilobytes
(1,024-byte units) that is available in or allocated
to various memory regions .
MENU()
Returns the name of the active menu .

MESSAGE(
Returns the error message of the last error.
MIN(<expressionl >,<expression2>)
Returns the smaller of two numeric, date, or
character expressions .
MLINE(<memo field name>,<expN>)
Extracts a specified line of text from a memo field
in the current record.

Chapter 4, Functions 63

MOD(<expNl >,<expN2>)
Returns the remainder from a division of two
numeric expressions .

MONTH(<expD>)
Returns the number of the month from a date
expression .
MROW()
Returns the row position of the mouse pointer on
the screen.
NDX([<expN> [,<alias>]])
Returns the name of an open ndx file .

NETWORK(
Determines whether or not the system is running
on a network .
ORDER([<alias>])
Returns the name of the primary order index file or
master mdx tag .

OS()
Returns the name of the operating system under
which dBASE IV is running .
PAD()
Returns the prompt pad name of the most recently
selected pad of the active menu .
PADPROMPT(<expC1 > [, <expC2>] )
Returns the text that appears in a particular pad of
a specific menu .

PAYMENT(<principal>,<rate>,
<periods>)
Calculates the constant, regular payment to
amortize a loan with constant interest over a given
number of payment periods .
PCOL()
Returns the current column position on the printer
(relative to _ploffset), and helps keep track of
printer column positions within programs .
PCOUNT()
Returns the number of parameters passed to a
procedure or user-defined function .

64 Quick Reference

PI()
Returns the mathematical constant
(3 .14159265358979), which is the ratio of the
circumference to the diameter of a circle .

POPUP()
Returns the name of the active pop-up menu .

PRINTSTATUS()
Returns a true (T.) if the print device is ready to
accept output .
PROGRAMO
Returns name of the program, procedure, or user-
defined function that is being executed .
PROMPT()
Returns the PROMPT of the most recently
selected popup or menu option .
PROW()
Returns the current row on the printer.
PV(<payment>,<rate>,<periods>)
Calculates the present value of equal, regular
payments invested at a constant interest rate for a
given number of payment periods .
RAND([<expN>])
Generates a random number .
RAT(<expCl >,<expC2>[,<expN>])
or
RAT(<expC1 >,<memo field name>[,<expN>])
Returns a number that shows the starting position
of a character string within a larger string or memo
field . RAT() starts the search from the last
character of the string or memo field being
searched .
READKEY()
Returns a number that epresents the key pressed to
exit from a full-screen command .
RECCOUNT([<alias>])
Returns the number of records in the specified
database file .
RECNO([<alias>])
Returns the current record number in the specified
database file .

Chapter 4, Functions 65

RECSIZE([<alias>])
Returns the size of a record in in the specified
database file.

REPLICATE(<expC>,<expN>)
Repeats a character expression a specified number
of times .
RIGHT(<expC>/<memo field name>,
<expN>)
Returns a specified number of characters from a
character expression or memo field, starting from
the last character on the right.
RLOCK([<expC list>, <alias>] /[<alias>])
Locks one or more database records ; same as
LOCK() .
ROLLBACK()
Determines whether or not the most recent
ROLLBACK command was successful .

ROUND(<expNl >,<expN2>)
Rounds the number <expN l > to the number of
decimals specified in <expN2> .

ROW()
Returns the row number of the current cursor
position .
RTOD(<expN>)
Converts radians to degrees .
RTRIM(<expC>)
Removes trailing blanks from a character string ;
same as TRIM() .

RUN([<expLl >,]<expC>[,<expL2>])
Returns a completion code after executing an
operating system command or program from
within dBASE IV.
SEEK(<exp> [,<alias>])
Performs lookups in indexed database files .
SELECT([<alias>])
Returns the work area number associated with the
specified alias . If no alias is specified, returns the
number of an available work area .
SET(<expC>)
Returns the status of various SET commands .

66 Quick Reference

SIGN(<expN>)
Returns a number representing the mathematical
sign of a numeric expression .
SIN(<expN>)
Returns the sine from an angle in radians .

SOUNDEX(<expC>)
Returns a four-character code used to find possible
matches in soundalike searches .

SPACE(<expN>)
Generates a character string of blank spaces .
SQRT(<expN>)
Returns the square root of the specified number.
STR(<expN> [,<length>
[,<decimal>]])
Converts a number to a character string .

STUFF(<expCl >,<expNl >,<expN2>,


<expC2>)
Replaces part of a character string with another
specified character string .
SUBSTR(<expC>/<memo field name>,
<starting position>
[,<number of characters>])
Extracts a specified number of characters from a
string or memo field.
TAG([[< .mdx filename>,] <expN>
[,<alias >]])
Returns the TAG name in a specified mdx file .
TAGCOUNT([< .mdx filename>[,<alias>]])
Returns the number of active indexes in the
specified work area.
TAGNO([<order name>
[, < .mdx filename>[,<alias>]]])
Returns the index number for the specified index .
TAN(<expN>)
Calculates the tangent of an angle in radians .
TIME([<exp>])
Returns the system time as a character string in
one of the following formats : HH:MM :SS or
HH :MM:SS .hh.

Chapter 4, Functions 67

TRANS FORM(<expression>,<expC>)
Provides picture formatting of character, logical,
date, and numeric data without using the @a . . . SAY
command.
TRIM(<expC>)
Removes trailing blanks from a character string ;
same as RTRIM() .
TYPE(<expC>)
Returns a single uppercase letter C, N, L, M, D, F,
or U representing the data type of the evaluated
expression .
UNIQUE([[<expC>,]<expN>[,<alias>]])
Returns a true (.T.) if the specified index was
created with the UNIQUE keyword or with SET
UNIQUE ON .
UPPER(<expC>)
Converts lowercase letters to uppercase .
USER()
Returns the log-in name of a user currently logged
in to a system that uses PROTECT to encrypt files .
VAL(<expC>)
Converts numbers that are defined as character
type into a numeric expression .
VARREAD()
Used with @ and other full-screen editing
commands to return the name of a field, memory
variable, or array element that is in the process of
being edited.
VERSION()
Returns the version number of dBASE IV that is
currently executing .
WINDOW()
Returns the name of the currently active window.
YEAR(<expD>)
Returns the year from a date expression .

68 Quick Reference

70 Quick Reference

System Memory
Variables

dBASE IV uses a group of predefined system


memory variables to control printer parameters
and the appearance of text on the printed page .
System memory variable names all start with an
underline (_) character .
dBASE IV assigns defaults to the system memory
variables upon start-up. You can change these
defaults at any time from the report generator,
from the dot prompt, or from within programs .
In the following syntax descriptions, defaults are
shown in uppercase letters ; however, system
memory variables are not case sensitive . Some
system memory variables require a second system
memory variable as a corequisite before they take
effect . When this is shown in the syntax, set the
corequisite value first .
_alignment
"LEFT"/"center"/"right"
Specifies the alignment of output produced by the
?/?? command with respect to margins when
wrap is true (.T.) .

box = <condition> ( .T ./.f .)


Prints or does not print boxes defined with the
DEFINE BOX command . The default condition is
to print boxes, that is, box is set to true (.T.) .
indent = <expN>
Specifies the indentation of the first line of each
new paragraph printed with the ? command when
wrap is true (T.) . The maximum indent must be
less than the rmargin setting . The indent value
starts at the lmargin setting . The default value
is 0.

Chapter 5, System Memory Variables 71


Imargin - <expN> (range = 0 to 254)


Defines the page left margin for output produced
by the ? command when wrap is true ( .T.) . It is
additive to the _ploffset value .
lmargin + _indent must be less than the rmargin
setting.
_padvance = "FORMFEED"/"linefeeds"
Uses either form feeds or line feeds to advance the
paper in the printer.

_pageno = <expN>
(range = 1 to 32,767)
Determines or sets the current page number.
_pbpage = <expN>
(range = 1 to 32,767)
Starts a printjob at the specified page number .
_pcolno = <expN> (range = 0 to 255)
Positions the subsequent streaming output to begin
at a given column of the current line, or returns the
current column number.

pcopies <expN>
(range - 1 to 32,767)
Specifies the number of copies to print.
_pdriver = "<printer driver filename>"
Activates the desired printer driver or returns the
name of the current driver . A DOS path is required
only when the printer driver is not in the current
directory.

_pecode = <expC> (characters up to 254)


Provides the ending control codes for a print job .
To send an Escape character, use either " { ESC } "
or its ASCII value " {27 } " followed by any letter or
number. To send an Escape A, use " { ESC } A", or
"{ESC}{65}" .

To send the curly brace character, also use curly


braces " { { } " or " { } } " .

72 Quick Reference



List of Control Character Specifiers :


1110111
through "{ 255 }" ASCII values
" { ESC } " or " {27 } " Escape character
" { BACKSPACE } " or " {8 } " Backspace
character
" { BELL } " or " {7 } " Bell or audio alarm
character
"{TAB}" or 11 191" Tab character
" { NULL } " or " { 0 } " Null character or ASCII
zero
" { RETURN) " or " { 13 } " Return character
" { DEL } " or " { 127 } " Delete character
" { CTRL-A } " through " { CTRL-Z } " Control
and letter combinations
_peject = "BEFORE"/"after"/"both"/"none"
Sends a form feed to the printer before starting a
printjob, after finishing the print job, or both .
BEFORE is the default for dBASE III PLUS°
compatibility . If this is not a consideration, change
the default .
_pepage = <expN>
(range=1 to 32,767)
Stops a print job when the specified page number
is printed, even when there are more pages in the
document or report.
_pform = "<print form filename>"
Activates a print form file, which contains certain
print settings, or returns the name of the current
print form file . You can specify any form filename
and include its DOS file path if it is not in the
current directory .
A _pform file is a binary file that contains all the
system memory variable settings . You can override
one or more of the variables contained in a form
file from the dot prompt or from within programs .
The last assigned memory variable setting takes
precedence .
_plength <expN>
(range = 1 to 32,767)
Specifies the output page length .

Chapter 5, System Memory Variables 73


_plineno = <expN>
(0/any integer less than _plength)
Adjusts the line number to the specified line on the
page, or returns the current line number.
_ploffset - <expN> (range = 0 to 254)
Sets the page left offset for printed output only. It
is the same as the SET MARGIN command .
_ppitch = "pica"/"elite"/"condensed"
/"default"
Sets the printer pitch or returns a string showing
the currently defined pitch. The default is no pitch
control, so that the printer hardware default setting
is used until you enter a value for _ppitch .
_pquality = <condition> ( .F ./.t .)
Selects quality or draft mode on the printer, or
returns a logical condition showing the currently
defined print mode . The default setting is false
( .F.), draft mode, even if the hardware default of
the printer is set to letter quality . To synchronize
the default with a printer in letter-quality mode, set
_pquality to true ( .T.) .
_pscode = <expC>
Provides the starting control codes for a print job .
Used to turn on attributes such as bolding, under-
lining, or italics anywhere in a document . The
default is a null string. Limited to character types
supported by the printer in use . Please refer to
_pecode for a list of valid keywords, rules, and
conventions .
Use _pecode = ending control string to terminate
the typeface specified with _pscode .
_pspacing = 1/2/3
Controls the line spacing on the printed page ;
default is 1 for single spacing .
_pwait = <condition> (.F ./.t .)
Supports individual sheet printing by pausing after
page breaks and displaying a prompt to let you
insert paper.
rmargin = <expN> (range - 1 to 255)
Defines the paragraph right margin for the output
of the ?/?? command when wrap is true ( .T.) .
Default is 79 .

74 Quick Reference

tabs = <expC>
(ascending numbers separated by commas)
Sets one or more tab stops for screen, printer, or
file output printed with the ?/?? command, and
also sets the default tab stops for the word wrap
editor. The default setting is a null string when
dBASE IV uses the DOS default of a tab every 8
columns . The maximum number of tabs is 30 .
wrap = <condition> ( .F ./.t .)
Sets word wrapping between margins on and off.
Must be set to true (.T.) for the _alignment,
indent, lmargin, and rmargin system memory
variables to work .

Chapter 5, System Memory Variables 75


76 Quick Reference

78 Quick Reference

SQL Commands
and Functions

SQL commands and functions are covered in


detail in Chapter 6 of Language Reference .
ALTER TABLE <table name>
ADD (<column name> <data type>
[,<column name> <data type> . . .]) ;
Adds new columns to an existing table .

CLOSE <cursor name> ;


Closes (releases) a SQL cursor.
CREATE DATABASE [<path>]
<database name> ;
Creates a new database to hold new database
objects .
CREATE [UNIQUE] INDEX <index name>
ON <table name>
(<column name> [ASC/DESC]
[,<column name> [ASC/DESC] . . .]) ;
Creates an index based on one or more columns of
a table in the current database .
CREATE SYNONYM <synonym name>
FOR <table/view name> ;
Defines an alternate name for a table or view .
CREATE TABLE <table name>
(<column name> <data type>
[,<column name> <data type> . . .]) ;
Creates a new table, defining the columns within
that table .
CREATE VIEW <view name>
[(<column name>,<column name> . . .)]
AS <SELECT command>
[WITH CHECK OPTION] ;
Creates a virtual table based on the columns
defined in other tables or views .

Chapter 6, SQL Commands and Functions 79



DBCHECK [<table name>] ;


Verifies that SQL catalog tables contain current
information for SQL tables .
DBDEFINE [< .dbf filename>] ;
Creates SQL catalog table entries for dBASE
database files .
DECLARE <cursor name> CURSOR
FOR <SELECT command>
[FOR UPDATE OF <column list>
/<ORDER BY clause>] ;
Defines a cursor and an associated SELECT
statement that specifies a result table on which the
cursor operates .
DELETE FROM <table name> (1)
[<alias name>][<WHERE clause>] ;
Deletes specified rows from a table .
DELETE FROM <table name> (2)
WHERE CURRENT OF <cursor name> ;
Deletes row pointed to by the cursor.
DROP DATABASE <database name> ;
Drops (deletes) a SQL database .

DROP INDEX <index name> ;


Drops (deletes) an existing SQL index .
DROP SYNONYM <synonym name> ;
Drops (deletes) a table or view synonym .
DROP TABLE <table name> ;
Drops (deletes) a SQL table .
DROP VIEW <view name> ;
Drops (deletes) a SQL view .

FETCH <cursor name>


INTO <memvar list> ;
Advances the cursor pointer and copies the values
of the selected row into dBASE memory variables .
GRANT ALL [PRIVILEGES]
/<privilege list>
ON [TABLE] <table list>
TO PUBLIC/<user list>
[WITH GRANT OPTION] ;
Grants user privileges for access and update of
tables and views .

80 Quick Reference

INSERT INTO <table name> (1)


[(<column list>)]
VALUES (<value list>) ;
Adds new rows to a table from a value list .
INSERT INTO <table name> (2)
[(<column list>)]
<SELECT command> ;
Adds new rows to a table from a SELECT
command.
LOAD DATA FROM [path]<filename>
INTO TABLE <table name>
[[TYPE] SDF/DIF/WKS/SYLK/FW2/RPD
/DBASEII/DELIMITED
[WITH BLANK/WITH <delimiter>]] ;
Imports data into a SQL table from an external
file.
OPEN <cursor name> ;
Opens a cursor and positions the cursor before the
first row in the result table.

REVOKE ALL [PRIVILEGES]


/<privilege list>
ON [TABLE] <table list>
FROM PUBLIC/<user list> ;
Revokes table access and update privileges .
ROLLBACK [WORK] ;
Restores a table to its previous contents prior to
execution of commands specified in a
BEGIN. . . END TRANSACTION block .
RUNSTATS [<table name>] ;
Updates database statistics in SQL catalog tables
of the current database .

Chapter 6, SQL Commands and Functions 81



SELECT <clause>
[INTO <clause>]
FROM <clause>
[WHERE <clause>]
[GROUP BY <clause>]
[HAVING <clause>]
[UNION <SELECT command> . . .]
[ORDER BY <clause>
/FOR UPDATE OF <clause>]
[SAVE TO TEMP <clause>] ;
Displays data in rows from one or more tables .
The SELECT clause can also contain expressions
and aggregate functions .
SHOW DATABASE ;
Displays information about each SQL database .
START DATABASE <database name> ;
Activates a SQL database .
STOP DATABASE ;
Closes the current SQL database .
UNLOAD DATA TO [path] <filename>
FROM TABLE <table name>
[[TYPE] SDF/DIF/WKS/SYLK/FW2/RPD
/DBASEII/DELIMITED
[WITH BLANK/WITH <delimiter>]] ;
Exports data from a SQL table to an external file .
UPDATE <table name>/<view name> (1)
SET <column name> = <expression>
[,<column name> = <expression> . . .]
[WHERE <search condition>] ;
Changes the data in selected rows of a table or
view.
UPDATE <table name> (2)
SET <column name> <expression>
[,<column name> = <expression> . . .]
WHERE CURRENT OF <cursor name> ;
Changes the data in a row pointed to by the cursor .
AVG([ALL/DISTINCT]<column name>)
or
AVG([ALL]<column expression>)
Computes the average value of a numeric column
in selected rows .

COUNT(*/[DISTINCT]<column name >)


Counts the number of selected rows in a query .

82 Quick Reference

MAX([ALL/DISTINCT]<column name>)
or
MAX([ALL]<column expression>]
Returns the maximum value found in specified
columns .
MIN([ALL/DISTINCT]<column name>)
or
MIN([ALL]<column expression>]
Returns the minimum value found in specified
columns .

SUM([ALL/DISTINCT]<column name>)
or
SUM([ALL]<column expression>]
Sums the values of a numeric column in selected
rows .

Chapter 6, SQL Commands and Functions 83


84 Quick Reference

86 Quick Reference

Cursor
Movement Keys

The keys listed below move the cursor or take an


action in dBASE IV Except where noted in
parentheses, the action takes place in all areas
of dBASE IV. If an action is followed by a
parenthesized work surface name (BROWSE,
EDIT, Queries, Memo field, or lists), or editing
mode (layout or word wrap) the action occurs only
in that area of dBASEIE IV
- or Ctrl-D or Ctrl-L
Right one position .
- or Ctrl-H or Ctrl-S
Left one position.
I or Ctrl-J or Ctrl-X
Down one row.
Next field (EDIT) .
T or Ctrl-E
Up one row.
Previous field (EDIT) .
Ctrl-K
Previous field (EDIT) .
PgDn or Ctrl-C
Display next screen (BROWSE, EDIT, word wrap,
layout) .
PgUp or Ctrl-R
Display previous screen (BROWSE, EDIT, word
wrap, layout) .
End
End of field (EDIT) .
Last field in record (BROWSE) .
Last text/field on line (Word wrap, layout) .
Last column of skeleton (Queries) .

Chapter 7, Cursor Movement Keys 87


Home
Beginning of field (EDIT) .
Beginning of record (BROWSE) .
Left margin (Layout) .
Indent, or left margin (Word wrap) .
First column of skeleton (Queries) .

Backspace
Delete previous character .

Tab
Next field (BROWSE, EDIT) .
Next tab stop (Layout, word wrap) .
Next column (Queries, lists) .
Insert tab character. (Word wrap if Insert is on .)
Move margin to next tab stop . (Word wrap if
Enable auto indent is on and cursor is at
beginning of paragraph .)
Shift-Tab
Previous field (BROWSE, EDIT) .
Previous tab stop (Layout, word wrap) .
Previous column (Queries, lists) .
Move margin to previous tab stop .
(Word wrap if Enable auto indent is on and
cursor is at beginning of paragraph .)

Next field (BROWSE, EDIT) .


Break line, move to new one (Layout or Word
wrap if Insert is on)
Esc or Ctrl-Q
Leave, abandoning changes ; cancel extended
selection.
Del or Ctrl-G
Delete currently selected item .
Ins or Ctrl-V
Toggle insert ON or OPP .
Ctrl - --->
Beginning of next word or field.
Ctrl- *--
Beginning of previous word or field .
Ctrl-PgDn
End of text (Word wrap) .
Bottom of layout surface (Layout) .
Current field in last record (BROWSE, EDIT) .

88 Quick Reference

Ctri-PgUp
Beginning of text (Word wrap) .
Top of layout surface (Layout) .
Current field in first record (BROWSE, EDIT) .

Ctrl-Home
Move into memo field (Memo field) .

Ctrl-End or Ctrl-W
Save work and leave .
Move out of memo field (Memo field) .
Ctri- .]
Save work and remain .
Ctrl-Backspace
Delete previous word (Layout and word wrap) .

Shift-F5
Finds the first occurrence of a specified string
(Word wrap) .
Shift-F4
Finds the next occurrence of the string found with
Ctrl-KF (Word wrap) .

Ctrl-KR
Reads another file into the file being edited
(Word wrap) .

Ctrl-KW
Writes the entire file to another file if no text is
selected; otherwise, writes the selected text
(Word wrap) .
Ctrl-N
Break line at cursor (Word wrap and layout) .
Ctrl-T
Deletes all characters from the current cursor
position to the beginning of the next word
(Word wrap) .
Ctrl-Y
Deletes from the cursor to the end of the line
(BROWSE, EDIT) .
Deletes complete line (Word wrap, layout) .

Chapter 7, Cursor Movement Keys 89


90 Quick Reference
NOTES
NOTES
Borland
Corporate Headquarters : 1800 Green Hills Road, P .O . Box 660001,
Scotts Valley, CA 95067-0001, (408) 438-8400 . Offices in : Australia,
Belgium, Canada, Denmark, France, Germany, Hong Kong, Italy, Japan,
Korea, Malaysia, Netherlands, New Zealand, Singapore, Spain . Sweden,
Taiwan, and United Kingdom ∎ Part # DBS 1020WW21793 ∎ BOR 5036

You might also like