COMMON FOXPRO COMMANDS
1. SET DEFA TO –
Used to set the default directory while starting foxpro. Format of the
command is
SET DEFA TO <<PATH>>
e.g.
SET DEFA TO C:\CLG1206
Without setting the path, Foxpro will not be able to find the required
files.
2. CLEAR
CLEAR ALL/CLEAR
To clear the Memory/screen
3. CREATE
Used to create new database file (.dbf e.g. branch.dbf, emp.dbf). Format
of the command is
CREATE <<filename>>
On giving this command, a window opens where one can give the details
of various fields
4. USE <<filename>>
Used to open a file for adding/modifying or deleting records.
Format
USE <<filename>>
5. LIST
LIST FIELDS <FIELD LIST separated by commas>
Used to list records according to some given fields
6. CLOSE
CLOSE ALL or CLOSE DATABASES
Used to close all files or data base files
7. MODI STRU
Used to modify the structure of a database file. Such as adding or
deleting a field. Format
USE <<filename>>
MODI STRU
8. APPEND
Used to add records to a file.
Format
USE <<filename>>
APPEND
9. BROWSE/DELETE/PACK/RECALL
Used to view a file and to add/modify and delete records. Format is
USE <<filename>>
BROWSE
BROWSE FOR <<LOGICAL EXPRESSION>>
To add records give ‘Ctrl+N’ in the Browse window. It will add one
blank record.
To modify record, simply go to the record and change value
To delete a record, press ‘Ctrl +T’ in the browse window. It will delete
the record on which the key is pressed. A deleted record can be again
brought back to the file, by giving ‘RECALL’ command from the
command window.
USE <<filename>>
RECALL ALL
The above command will recall all deleted records, if they have not been
packed. If after deleting a record, we give the following command
USE <<FILENAME>>
PACK
Then all records which have been deleted by ‘Ctrl +T’ in the browse
window will be permanently erased.
BROWSE command can also be used to selectively view records based
on a certain condition. For example, in the branch.dbf, if we wish to view
only those records which have ‘ZOCODE’ = 44 ( where zocode 44 is for
Lucknow zone) then we can give the following command
BROWSE FOR ZOCODE=44
OR
BROWSE FOR ZONAME = “LUCKNOW”
The valid format is
BROWSE FOR <<fieldname>>=value
Here on should note that if the value is numeric then we will give,
<<fieldname>>=value
if it is character
<<fieldname>>=”value” in correct case (Lucknow and LUCKNOW are
not same for this command)
Please note that ZOCODE and ZONAME have to be valid fields of the
branch.dbf file. If the name of the field is ZO_CODE and we give
ZOCODE in our command, it will give error. To see the correct name as
fields, one can give the command
USE <<filename>>
DISP STRU
After noting down the correct name of the field, the above BROWSE
COMMAND can be given.
10. LOCATE
LOCATE FOR << logical expression>>
Any record can be located for a given condition using the above format.
11. SET COMMANDS
The following set commands can be given at the command
window.
SET DATE BRIT – Sets the date to dd/mm/yy format.
SET CENTURY ON – Sets the date format to dd/mm/yyyy
format
SET FILTER TO – This command is used after opening a file
with ‘USE’ command. One can selectively view records from a
file. It works just like BROWSE FOR command. Format will be
USE <<filename>>
SET FILTER TO <<fieldname>>=value
SET STATUS ON – Displays the status bar, where on can see
which file is open, how many total records are there and where the
record pointer is.