Professional Documents
Culture Documents
Reference
Guide
VERSION
2.0
Borland
dBASE I V
for DOS
dBASE IV®
Version 2 .0
Quick Reference
Commands 17
SET Commands 43
Functions 55
2 Quick Reference
Paradigm Terms
and Symbols
[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 .
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.
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.) .
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
Release 1 A
Release 2 .x
filename
flows
foreground
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 .
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
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 .
12 Quick Reference
14 Quick Reference
16 Quick Reference
Commands
@ <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>,<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>
[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 .
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 .
Chapter 2, Commands 19
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
AVG(<expN>)
CNTO
MAX(<exp>)
MIN(<exp>)
NPV(<rate>,<flows>,<initial>)
STD(<expN>)
SUM(<expN>)
VAR(<expN>)
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
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 .
24 Quick Reference
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
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 ) .
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 .
30 Quick Reference
Chapter 2, Commands 31
32 Quick Reference
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
PACK
Removes records that are marked for deletion from
the active database file and recreates any open
indexes .
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
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.
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 .
38 Quick Reference
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
ZAP
Removes all records from the active database file .
40 Quick Reference
SET Commands
42 Quick Reference
SET Commands
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 .
*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 .
44 Quick Reference
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 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 .)
48 Quick Reference
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 .
50 Quick Reference
52 Quick Reference
F nct ons
54 Quick Reference
Functions
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 .
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
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
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.
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
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
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 .
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
_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.
72 Quick Reference
_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 .
76 Quick Reference
78 Quick Reference
SQL Commands
and Functions
80 Quick Reference
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 .
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 .
84 Quick Reference
86 Quick Reference
Cursor
Movement Keys
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 .)
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) .
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