Commands and Function

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Prepared By - Manoj Verma-9818606913

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

15. Display All


Display all Command is similar of List command. This command is also used for
display all record of the table

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

21. Count for deleted


This command only count that record which is delete by user
Syntax: count for deleted()

22. Count for not deleted


This command is used to count that record which is not deleting in database file.
It show the total number of record in Status Bar
Syntax: - count for not deleted ()

23. Append Blank


It adds the blank record where the cursor pointer appeared at the end of
database. we can add record in this blank row by using browse command

Syntax:- append blank


Syntax:- Browse
24. Copy Structure to
We can copy the structure/field of any file into new file.
Syntax: - Copy structure to filename

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.

Syntax:- use ram

Syntax:- append from shyam

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

Syntax: replace age with 20

Syntax:- replace age with 20 for city =”Delhi”

Syntax:- replace city with “Mumbai” for city = “Delhi”

30. Replace all


8
Prepared By - Manoj Verma-9818606913

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

Syntax:- replace all age with 23

Syntax:- replace all name with “Veer”

Syntax:- replace all city with “Delhi”

End of Commands

Function

Numerical String Date Logical


Function Function Function Function

NUMERIC FUNCTION

Abs():- it return the absolute value of given expression.

Argument :- numeric

Return :- numeric

Syntax :- abs(numeric expression)

Exp. :- ?abs(-28)

Result :- 28

9|Page
Between():- it return the Boolean value means true or false.

Argument :- numeric

Return :- ‘T’ or ‘F’

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

Syntax :- ceiling(numeric expression)

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

Syntax :- floor(numeric expression)

Exp. :- ?floor(28.9)

Result :- 28

Isdigit() :-it return the Boolean result value if the first character is digit.
Argument :- character

Return :- Boolean .T.or .F.

Syntax :- isdigit(character expression)

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

Return :- Boolean .T.or .F.

Syntax :- isalpha(character expression)

Exp. :- ?isalpha(as28abc)

Result :- .T.

Mod():- it return the remainder value.


Argument :- numeric

Return :- numeric

Syntax :- mod(numeric expression)

Exp. :- ?mod(12,5)

Result :- 2

Max():- it return the maxium value of given numeric value.

Argument :- numeric

Return :- numeric

Syntax :- max(numeric expression)

Exp. :- ?max(23,44,55,6,23,)

Result :- 44

Min():- it return the minium value of given numeric value.

Argument :- numeric

Return :- numeric

Syntax :- min(numeric expression)

Exp. :- ?min(23,44,55,6,23,)

11 | P a g e
Result :- 6

Round():-it round a specified number of decimal places

Argument :- numeric

Return :- numeric

Syntax :- round(numeric,no of decimal place)

Exp. :- ?round(23.23744,2)

Result :- 23.24

Sign():- it return the numeric value if value postive ,negetive or zero

Argument :- numeric

Return :- numeric

Syntax :- sign(numeric expression)

Exp. :- ?sign(-28)or(28)or(12-12)

Result :- -1 or 1 or 0

Sqrt():- it return the square root of the given numeric character.


Argument :- numeric

Return :- numeric

Syntax :- sqrt(numeric expression)

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

Exp. :- ?bof()or goto top ,skip-1, bof()

Result :- .F.or .t.

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()

Exp. :- ?eof()or goto bottom ,skip, eof()

Result :- .F.or .t.

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

Syntax :- islower(character exp)

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

Syntax :- isupper(character exp)

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()

Exp. :- ?deleted()or goto 3, delete

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

Int():- it return the integer part of given character.


Argument :- numeric

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

Argument :- numeric ,character

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

len():- this function is used to count the lenth of string

Argument :- character

Return :- numeric

Syntax :- len(character)

Exp. :- ?len(“ram is good boy”)

Return :- 17

replicate():- this function return a character expression by given no of times

Argument :- character,numeric

Return :- character

Syntax :- replicate(character,numeric)

Exp. :- ?replicate(“manoj”,3)

Return :- manoj manoj manoj

alltrim():-it remove space from both side

Argument :- character

Return :- character

Syntax :- alltrim(character)
16
Prepared By - Manoj Verma-9818606913

Exp. :- ?alltrim(“ manoj ”)

Return :- Manoj

DATE FUNCTION

Date():- it return the current date

Syntax :- date()

Exp :- ?date()

Result :- current date print

time():- it return the current time

Syntax :- time()

Exp :- ?time()

Result :- current time print

year():- it return the current year

Syntax :- year()

Exp :- ?year(date())

Result :- current year print

Day():- it return the current day

Syntax :- day()

Exp :- ?day(date())

Result :- current day print

month():- it return the current month

Syntax :- month()

Exp :- ?month(date())

Result :- current month print

cmonth():- it return the name of current month

17 | P a g e
Syntax :- cmonth()

Exp :- ?cmonth(date())

Result :- current month print in character

Dow():- it return the day of week.

Syntax :- dow()

Exp :- ?dow(date())

Result :- current date print

Cdow():- it return the current day of week in character expression

Syntax :- cdow()

Exp :- ?cdow(date())

Result :- current day of week print

mdy():- it return the current date

Syntax :- mdy()

Exp :- ?mdy(date())

Result :- 12-30-2006

dmy():- it return the current date

Syntax :- dmy()

Exp :- ?dmy(date())

Result :- 12-10-2006

Set date to british

Set date to amer

Set date to japa

Set date to ital

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 :-

Syntax :- variable name = 0

Exp :- x=0

ii)Char :-

Syntax :- variable name =space(20)

Exp :- address = space(20)

iii)Date :-

Syntax :- variable name = date()

Exp :- d=date( )

Programme 1- Sum of two numbers

Unformatted Programme Example


CLEAR
A=0

B=0

C=0

A=INPUT”ENTER THE NUMBER”TO A

B=INPUT”ENTER THE NUMBER”TO B

C=A+B

?”SUM = “, C

Formatted Example
CLEAR

STORE 0 TO A,B,C

@ 2,9 SAY “ENTER THE VALUE” GET A


20
Prepared By - Manoj Verma-9818606913

@ 4,19 SAY”ENTER THE SECOND NO” GET B

READ

C=A+B

@ 9,19 SAY “SUM = “+STR(C)

Programme 2- Calculate Area


clear

store 0 to r,area

piee=3.14

@ 4,4 say "enter the radius" get r

read

area = piee*r*r

@ 6,4 say "area = " +str(area)

Programme 3- Calculate Interest and Amount


clear

store 0 to p,r,i,t,a

@ 2,2 say "enter the principal" get p

@ 4,2 say "enter the time" get t

@ 6,2 say "enter the rate of intrest" get r

read

i=p*r*t/100

@ 8,2 say "intrest = " +str(i)

a=p+a

@ 10,2 say "amount = "+str(a)

Programme 4- Check inserted year is leap year or not leap year

21 | P a g e
clear

store 0 to y

@ 2,2 say "enter the year " get y

read

if (y%4 = 0)

@ 10,2 say "year is leap year"

else

@ 10,2 say "year is not leap year"

End if

Programme 5- Check Smallest number


clear

store 0 to a,b

@ 2,2 say "enter the number " get a

@ 4,2 say "enter the second number " get b

read

if (a<b)

@ 10,2 say "a is smallest"

else

@ 10,2 say "b is smallest"

End if

Programme 6- Check Odd/Even Number


clear

store 0 to a

@ 2,2 say "enter the number " get a

read
22
Prepared By - Manoj Verma-9818606913

if (a % 2 = 0)

@ 10,2 say "a is even number"

else

@ 10,2 say "a is odd number"

End if

Programme 7- Print counting 1 to 20


clear

a=1

do while (a<=20)

?a

a=a+1

enddo

Programme 8- Print counting 1 to 20 Step by Step


clear

a=1

do while (a<=100)

?a

a=a+1

if (a%20=1)

wait

end if

end do

Programme 9- Print name upto Loop


clear

x=1

23 | P a g e
a=space(20)

accept"enter any name" to a

do while (x<=50)

?a

x=x+1

end do

Programme 10- Print 1 to 10 square


clear

x=1

do while (x<=10)

?x*x

x=x+1

end do

Programme 11- Swapping two numbers


clear

a=0

b=0

t=0

@ 2,2 say"enter the number to a" get a

@ 4,2 say"entre the numebr to b" get b

read

t=a

a=b

b=t
24
Prepared By - Manoj Verma-9818606913

@ 6,2 say "after swap value a = "+str(a)

@ 8,2 say "after swap value b = "+str(b)

Programme 12- Calculate Salary with bonus


clear

dept = space(20)

bonus=0

total=0

salary=0

input "enter the salary" to salary

accept "enter the designation" to dept

if dept = "ca"

bonus = .05*salary

else

bonus = .03*salary

end if

total = salary+bonus

?"total = ",total

Programme 13- Print Grade With 3 Subjects


Clear

P=0

C=0

M=0

Avg=0

Input “enter marks of physics” to p

25 | P a g e
Input “enter marks of civics” to c

Input “enter marks of maths” to m

Avg = (p+c+m)/3

If avg>=90

?”a grade”

else

if avg>=80 and avg<90

?”b grade”

else

if avg>=60 and avg<80

? “c grade”

else

if avg>=50 and avg<60

? “d grade”

else

?”e grade”

End if

end if

end if

end if

Programme 14- Print Result


Clear

x=0

y=0

z=0
26
Prepared By - Manoj Verma-9818606913

Input "enter marks of maths" to x

Input "enter marks of maths" to y

Input "enter marks of maths" to z

if (x>=33 and y>=33 and z>=33)

?"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

Programme 15- Print Greatest number in three number


Clear

x=0

y=0

z=0

Input "enter the no" to x

Input "enter the second no" to y

Input "enter the third no" to z

if (x>y and x>z)

?" x is greater"

End if

if (y>z and y>x)

? "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()

@ 2,36 say "for get your age"

@ 5,36 say "enter your date of birth " get dob

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

Programme 17- Factor of the give number


clear

store 0 to i,n

@ 12,10 say "enter the number" get n

read

for i = 1 to n step+1

if n%i=0

?i

endif

endfor

Programme 18- Case Statement

clear

ch=0

x=0

29 | P a g e
y=0

ans=0

@ 1,39 say “1.addition.”

@ 2,39 say “2.subtraction.”

@ 3,39 say “3.multiplication.”

@ 4,39 say “4.divide.”

@ 6,39 say “enter your choice “get ch

read

@ 16,39 say “enter the value “ get x

@ 18,39 say “enter the second value “ get y

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

@ 20,20 say “not valid keys”

endcase

@ 22,39 say “answer = “+str(ans)

30

You might also like