Commands and Function
Commands and Function
FOX-PRO
RDBMS
RDBMS stands for relation database management system . relation means the joining two or
more database files .these file are related on a specified relation .a package which provide this
facility is called RDBMS.
DATA BASE
It is a collection of data or information regarding on organization .a database is a most important
and valuable for any organization.
RECORDS
Database is a collection of record which contains the information about a particular object For
Example:- employee record which contain the name ,address ,city ,salary etc. of a particular
employee.
FOX-PRO
Fox-pro is a package works as a dbms(database management system) . it provide the facilities of
rdbms .these facilities are :
a) storing of data
b) arithematic calculation
c) storing
d) report generation
ATTRIBUTE
There are the property of an object.attribute are also called field.for exp name,salary,object are
the attribute of an object
LANGUAGE
FRONT END
In which we do any work after compile ,which only provide front and c,c++,java,html
BACK END
In which data saved access fox-pro after compile it come on the front end from the
editor.exp.fox-pro,oracle,sql
1|Page
CTRL + F2 – If command window not show on screen
COMMANDS
1. Create
Create Command is used to create a database file with multiple fields (e.g.
Name, city, age etc…)
2
Prepared By - Manoj Verma-9818606913
2. Append
Append command is used to insert new record in database file
3|Page
3. Browse
Browse command is used to show the record in tabular format. We can also
modify the record in this sheet
4. Browse Noedit
We can’t modify record in tabular format, because this window is read-only
mode
5. List
List command is used to display all record in table.
Syntax1:- List
Syntax2:- List name, city
6. Modify Structure
It is allow the user to make any changes in the current database structure. It also
allows modify insert & delete the fields.
4
Prepared By - Manoj Verma-9818606913
7. Display structure
Display all field on screen with data type or data size.
8. clear
Clear whole screen.
9. Close all
Close all database file
10. Use
If you want to open any database file, write the name of file and then press entry
to open the existing file.
Syntax – Use (Filename)
11. Quit
Close the Fox-pro Application.
12. Edit
5|Page
Modify the Existing Record in table by giving specified commands.
Syntax1:- Edit
Syntax2:- Edit for city = “Delhi”
Syntax3:– Edit for age >25
13. Goto
It is used to place the record pointer at a specified record no. It will take value
internally.
Syntax1:- Goto Top
Syntax2:- Goto Bottom
Syntax3:- Goto 3
14. Display
Display command is used to display the single record of the table. we can give
the specified record number by goto command
Syntax: Goto 3
Syntax: Display
16. Delete
Delete command is used to delete the record. We can give the specified record
number by goto command and then delete it, but it delete record temporally. It
show black mark in browse window and not count in actual record of the table.
Syntax: goto 2
Syntax: delete
Syntax: count for not deleted()
17. Recall
Recall command is used to record the delete record of the table. It apply after
applying delete command first. We can recall record using this command, And
then record add in actual record
Syntax: Goto 1
6
Prepared By - Manoj Verma-9818606913
Syntax: Delete
Syntax: Recall
18. Pack
Pack command is used to delete the record permanently. After the use of delete
command pack command is delete record permanently and the record can’t be
recovered by recall command.
Syntax: goto 3
Syntax: Delete
Syntax: Pack
19. Zap
It is used to delete the all record permanently. The record can’t be recovered. It
gives a warning after use this command.
Syntax – Zap filename
20. Count
Count command is used to count all record from database file, whether record is
deleted or not deleted. It show count record in Status bar.
Syntax – Count
7|Page
25. Append From
It add the record of another table, but the condition is same e.g. the column of
existing table and the importing table must be same otherwise data not append
properly for existing table.
26. Skip
Skip command is used to skipping the record pointer. It can be skip by giving specified
record number.
Syntax1: Skip 4
Syntax2: Skip 1
Syntax3: Skip -2
27. Erase
Erase command is used to erase or delete the database file. But keep in mind
that the file must be close when you erase the file.
Syntax: - Erase filename.dbf
28. Copy to
It is used to copy the content of the current file into a new file .it Will overwrite
the matter if name is exist in database.
Syntax: - Copt to filename
29. Replace
Replace command used for replace the any value of specified column . we can
change it by condition or without condition
Replace all Command is used for replace all record of table. This command is used for
modify record with a single command. If want to change all city = delhi then it change all
record quickly
End of Commands
Function
NUMERIC FUNCTION
Argument :- numeric
Return :- numeric
Exp. :- ?abs(-28)
Result :- 28
9|Page
Between():- it return the Boolean value means true or false.
Argument :- numeric
Syntax :- between(source,lower,upper)
Exp. :- ?between(10,1,5)
Result :- .T.
Ceiling():- it return the nearest integer that is greater than and equal to the expression/numeric
argument
Argument :- numeric
Return :- numeric
Exp. :- ?ceiling(28.9)or(28.0)
Result :- 29 or 28
Floor():-it return the nearest integer that is less than or equal to the numeric argument
Argument :- numeric
Return :- numeric
Exp. :- ?floor(28.9)
Result :- 28
Isdigit() :-it return the Boolean result value if the first character is digit.
Argument :- character
Exp. :- ?isdigit(28abc)
10
Prepared By - Manoj Verma-9818606913
Result :- .T.
Isalpha():- it return the bollean value if the first character of the given character expression
is alphabet
Argument :- character
Exp. :- ?isalpha(as28abc)
Result :- .T.
Return :- numeric
Exp. :- ?mod(12,5)
Result :- 2
Argument :- numeric
Return :- numeric
Exp. :- ?max(23,44,55,6,23,)
Result :- 44
Argument :- numeric
Return :- numeric
Exp. :- ?min(23,44,55,6,23,)
11 | P a g e
Result :- 6
Argument :- numeric
Return :- numeric
Exp. :- ?round(23.23744,2)
Result :- 23.24
Argument :- numeric
Return :- numeric
Exp. :- ?sign(-28)or(28)or(12-12)
Result :- -1 or 1 or 0
Return :- numeric
Exp. :- ?sqrt(64)
Result :- 8
LOGICAL FUNCTION
Bof():- it return the logical or Boolean value .it is used to determine whether the record pointer
position at the beginning of file or not. Of stand for beginning of file before the first record.
Return :- logical
Syntax :- bof()
12
Prepared By - Manoj Verma-9818606913
Eof():- it return the logical or Boolean value .it is used to determine whether the recod
pointer position at the end of file or not.mof stand for end of file before the first record.
Return :- logical
Syntax :- eof()
Islower():-it return the logical value .if the given expression start the lower alphabet then
true otherwise false.it see the first alphabet
Argument :- character
Return :- logical
Exp. :- ?islower(“manoj”)
Result :- .T.
Isupper():-it return the logical value .if the given expression start the upper alphabet then
true otherwise false.it see the first alphabet
Argument :- character
Return :- logical
Exp. :- ?isupper(“manoj”)
Result :- .F.
Deleted():-it return the logical value. It determine whether the current record is temporally
delete or not
Return :- logical
Syntax :- deleted()
13 | P a g e
Result :- .F. or .T.
STRING FUNCTION
Asc():- asc stand for american standard code.it is used to display the ascii value of any given character
expression. it show the ascii of first character.
Argument :- character
Return :- numeric
Syntax :- asc(character)
Exp. :- ?asc(“A”)
Return :- 65
Chr():- it is used to display the character value of any ascii digit.it will show character value
Argument :- numeric
Return :- character
Syntax :- chr(numeric)
Exp. :- ?chr(“70”)
Return :- F
Return :- integer
Syntax :- int(numeric)
Exp. :- ?int(12.234)
Return :- 12
Left():- it return the specified no of the character form the left side of the given character
expression
Argument :- numeric ,character
Return :- character
14
Prepared By - Manoj Verma-9818606913
Syntax :- left(character,number)
Exp. :- ?left(“manoj”,3)
Return :- man
right():- it return the specified no of the character form the right side of the given character
expression
Argument :- numeric ,character
Return :- character
Syntax :- right(character,number)
Exp. :- ?right(“manoj”,2)
Return :- oj
Substr():- it return specified no of the character from the specified position of a given string
Return :- character
Syntax :- substr(character,number)
Exp. :- ?substr(“anamika”,2,3)
Return :- nam
Proper():- this function return a character expression by capitalize the first character of
the given string.
Argument :- character
Return :- character
Syntax :- proper(character)
Exp. :- ?proper(“manoj”)
Return :- Manoj
upper():- this function return a character expression by capitalize the all character of the
given string.
Argument :- character
Return :- character
Syntax :- upper(character)
15 | P a g e
Exp. :- ?upper(“manoj”)
Return :- MANOJ
lower():- this function return a character expression by lowest the all character of the given
string.
Argument :- character
Return :- character
Syntax :- lower(character)
Exp. :- ?lower(“manoj”)
Return :- manoj
Argument :- character
Return :- numeric
Syntax :- len(character)
Return :- 17
Argument :- character,numeric
Return :- character
Syntax :- replicate(character,numeric)
Exp. :- ?replicate(“manoj”,3)
Argument :- character
Return :- character
Syntax :- alltrim(character)
16
Prepared By - Manoj Verma-9818606913
Return :- Manoj
DATE FUNCTION
Syntax :- date()
Exp :- ?date()
Syntax :- time()
Exp :- ?time()
Syntax :- year()
Exp :- ?year(date())
Syntax :- day()
Exp :- ?day(date())
Syntax :- month()
Exp :- ?month(date())
17 | P a g e
Syntax :- cmonth()
Exp :- ?cmonth(date())
Syntax :- dow()
Exp :- ?dow(date())
Syntax :- cdow()
Exp :- ?cdow(date())
Syntax :- mdy()
Exp :- ?mdy(date())
Result :- 12-30-2006
Syntax :- dmy()
Exp :- ?dmy(date())
Result :- 12-10-2006
End of Function
18
Prepared By - Manoj Verma-9818606913
19 | P a g e
PROGRAMMING
Data Type:- Before Using Any Variable It Data Ype Must Be Declared
i)Numeric :-
Exp :- x=0
ii)Char :-
iii)Date :-
Exp :- d=date( )
B=0
C=0
C=A+B
?”SUM = “, C
Formatted Example
CLEAR
STORE 0 TO A,B,C
READ
C=A+B
store 0 to r,area
piee=3.14
read
area = piee*r*r
store 0 to p,r,i,t,a
read
i=p*r*t/100
a=p+a
21 | P a g e
clear
store 0 to y
read
if (y%4 = 0)
else
End if
store 0 to a,b
read
if (a<b)
else
End if
store 0 to a
read
22
Prepared By - Manoj Verma-9818606913
if (a % 2 = 0)
else
End if
a=1
do while (a<=20)
?a
a=a+1
enddo
a=1
do while (a<=100)
?a
a=a+1
if (a%20=1)
wait
end if
end do
x=1
23 | P a g e
a=space(20)
do while (x<=50)
?a
x=x+1
end do
x=1
do while (x<=10)
?x*x
x=x+1
end do
a=0
b=0
t=0
read
t=a
a=b
b=t
24
Prepared By - Manoj Verma-9818606913
dept = space(20)
bonus=0
total=0
salary=0
if dept = "ca"
bonus = .05*salary
else
bonus = .03*salary
end if
total = salary+bonus
?"total = ",total
P=0
C=0
M=0
Avg=0
25 | P a g e
Input “enter marks of civics” to c
Avg = (p+c+m)/3
If avg>=90
?”a grade”
else
?”b grade”
else
? “c grade”
else
? “d grade”
else
?”e grade”
End if
end if
end if
end if
x=0
y=0
z=0
26
Prepared By - Manoj Verma-9818606913
?"pass"
else
if (x>=33 and y>=33 and z<33) or (x>=33 and y<33 and z>=33) or (x<33 and y>=33 and z>=33)
?"compartment"
else
?"fail"
endif
x=0
y=0
z=0
?" x is greater"
End if
? "y is greater"
End if
27 | P a g e
if (z>x and z>y)
? "z is greater"
End if
Programme 16- Insert date of birth and get the day month and year
clear
bd=0
bm=0
by=0
cm=0
cy=0
cd=0
dob= date()
read
bd=day(dob)
bm=month(dob)
by=year(dob)
cd=day(date())
cm=month(date())
cy=year(date())
if (cd<bd)
cd = cd +30
cm=cm-1
end if
28
Prepared By - Manoj Verma-9818606913
d=cd-bd
if (cm<bm)
cm = cm+12
cy=cy-1
end if
m=cm-bm
y=cy-by
? "days",d
? "months",m
?"years",y
store 0 to i,n
read
for i = 1 to n step+1
if n%i=0
?i
endif
endfor
clear
ch=0
x=0
29 | P a g e
y=0
ans=0
read
read
do case
case ch=1
ans=x+y
case ch=2
ans=x-y
case ch=3
ans=x*y
case ch=4
ans=x/y
otherwise
endcase
30