0% found this document useful (0 votes)
54 views

Competency-Based Learning Material

This document provides an overview of FoxPro including: 1. A brief history of FoxPro and its development from Fox Software to Microsoft. 2. Compatibility information for different versions of FoxPro across operating systems like DOS, Windows, Macintosh and UNIX. 3. Technical details on features like the Rushmore optimizing engine and memory management. 4. A timeline of FoxPro versions from 2.0 to 2.6 showing file sizes and dates. The document serves as an introduction to the FoxPro programming language and database management system. It provides context for further materials on using and programming with FoxPro.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Competency-Based Learning Material

This document provides an overview of FoxPro including: 1. A brief history of FoxPro and its development from Fox Software to Microsoft. 2. Compatibility information for different versions of FoxPro across operating systems like DOS, Windows, Macintosh and UNIX. 3. Technical details on features like the Rushmore optimizing engine and memory management. 4. A timeline of FoxPro versions from 2.0 to 2.6 showing file sizes and dates. The document serves as an introduction to the FoxPro programming language and database management system. It provides context for further materials on using and programming with FoxPro.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 73

USING FOXPRO 2.

TABLE OF CONTENTS

INFORMATION SHEET # 1............................................................................................................... 4


HISTORY OF FOXPRO..................................................................................................................... 4
Version information......................................................................................................................... 4
OPERATING SYSTEM COMPATIBILITY....................................................................................4
TECHNICAL ASPECTS.............................................................................................................. 5
VERSION TIMELINE.................................................................................................................. 5
FOXPRO ENVIRONMENT................................................................................................................ 6
OPERATION SHEET #1.................................................................................................................... 7
Operation Title: Opening FoxPro Application................................................................................7
Operation Title: Closing FoxPro Application...............................................................................10
BASIC COMMANDS........................................................................................................................ 11
Operation Title: CREATING A NEW FOLDER............................................................................18
Operation Title: CREATING AN EDITING WINDOW..................................................................20
Common errors in FoxPro................................................................................................................21
Operation Title: COMPILING FOR ERRORS.............................................................................24
Operation Title: RUNNING A PROGRAM...................................................................................25
Job Title: Hello World Program..................................................................................................26
FLOWCHARTING............................................................................................................................ 28
Job Title: Flowcharting: “How to take a bath”.............................................................................30
VARIABLES..................................................................................................................................... 32
Job Title: Hello Program............................................................................................................. 33
OPERATORS................................................................................................................................... 34
Job Title: Simple Calculator Program.........................................................................................35
CONDITIONAL STATEMENTS AND ITERATIONS..........................................................................37
Job Title: Days in Month Program..............................................................................................41
Job Title: Grading System Program...........................................................................................43
WHAT IS DATABASE?..................................................................................................................... 46
Operation Title: CREATING A DATABASE.................................................................................47
Operation Title: MODIFYING A DATABASE...............................................................................48
Operation Title: CREATING AN INDEX......................................................................................49
Job Title: CREATING DATABASE..............................................................................................50
Job Title: DATA ENTRY PROGRAM..........................................................................................51
Job Title: SEEK PROGRAM.......................................................................................................55
Job Title: EDIT PROGRAM........................................................................................................59
Job Title: DELETE PROGRAM..................................................................................................63
Job Title: VIEW PROGRAM.......................................................................................................67
DESIGNING LIGHT-BAR MENUS...................................................................................................71
Job Title: MAIN MENU PROGRAM............................................................................................72

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

SUMMARY OF LEARNING OUTCOMES:

Upon completion of this module the trainee/student must be able to:

LO1. Introduction to FoxPro

LO2. Simple Programming

LO3. Database Management

LO4. System Compilation

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Learning Experiences

Learning Outcome No.1 Introduction to Computer

Learning Activities Resources


History of FoxPro Information sheet # 1
Familiarizing Environment Information Sheet # 2
Opening FoxPro Operation Sheet #1
Closing FoxPro Operation Sheet #2
Familiarizing FoxPro Commands Information Sheet #3
Answer Sheet # 1
Creating Directory Operation Sheet #3
Creating an Editing Window Operation Sheet # 4
Common Errors in FoxPro Information Sheet # 4
Compiling for Errors Operation Sheet # 5
Running a Program Operation Sheet # 6
Creating a Hello World Program Job Sheet # 1

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 1
HISTORY OF FOXPRO

FoxPro is a text-based procedurally-oriented programming language and


DBMS, originally published by Fox Software and later by Microsoft, for MS-
DOS, MS Windows, Apple Macintosh, and UNIX.

Although FoxPro is a Database Management System (DBMS) and it does


support relationships between tables, it is not considered a Relational
Database Management System (RDBMS), lacking transactional
processing.

The final published release of FoxPro was 2.6, after which the name was changed to Visual FoxPro.

Although no longer sold or supported by Microsoft, there is still an active worldwide community of
FoxPro users and programmers. FoxPro 2.6 for UNIX (FPU26) has even been successfully installed
on Linux and FreeBSD using the Intel Binary Compatibility Standard (ibcs2) support library.

Version information

Microsoft FoxPro running on Macintosh System 7.1

OPERATING SYSTEM COMPATIBILITY

Extant Versions by OS
Version FP 2.0 FP 2.5 FP 2.6
MS-DOS Yes Yes Yes
Windows 3.1 to XP Yes Yes Yes
Macintosh Yes Yes Yes
SCO UNIX No No Yes
Linux & FreeBSD No No Yes
Windows 2000 No No Yes

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

TECHNICAL ASPECTS

FoxPro 2 included "Rushmore" optimizing engine, which used indices to accelerate data retrieval
and updating. Rushmore technology examined every data-related statement, and looked for filter
expressions. If one was used, it looked for an index matching the same expression.
In addition, FoxPro2 was originally built on WatCOM C++, which had its own memory extensor - at
that time state-of-the-art. FoxPro2 could access expanded and extended memory, using almost all
available RAM (DOS). It used some interrupts in absence of the extended memory driver: if no
HIMEM.SYS was loaded, FoxPro enabled that mechanism.

VERSION TIMELINE

Version VERSION() returns EXE Size EXE Date


FPW 2.6a FoxPro 2.6a for Windows 2,444 kb 28-SEP-1994
FPM 2.6a FoxPro 2.6a for Macintosh ? kb August 1994
FPD 2.6a FoxPro 2.6a for DOS 1,788 kb August 1994
FPW 2.6 FoxPro 2.6 for Windows 2.38 Mb 9 March 1994
FPM 2.6 FoxPro 2.6 for Macintosh ? kb 1993
FPD 2.6 FoxPro 2.6 for DOS ? kb March 1994
FPU 2.6 FoxPro 2.6 for UNIX 2.3 Mb 1993
FPW 2.5 FoxPro 2.5 for Windows 1.63 Mb Jan. 1993
FPD 2.0 FoxPro 2.0 for DOS 465.86 kb 1991

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET #2

FOXPRO ENVIRONMENT
CONTROL BUTTONS
TITLE BAR MENU BAR

SCREEN

COMMAND WINDOW

1. Title Bar - The Title bar gives the name of the document and the program or application
being used.

2. Menu Bar - The Menu bar displays different menus such as System, File, Edit, Database,
Record, Program, Window and dropdown menus.

3. Control Buttons

 The Minimize button moves the entire window to your taskbar - the bar that runs
across the bottom of your computer screen.

 The Restore button is use to back the original size of the window.

 The Maximize button is use to enlarge the size or appearance of the current
window.

 The Close button is use to close the current window.

4. Command Window – the Command window is often the fastest way to get things done.

5. Screen – this part of the environment is where you manipulate the design of your program.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #1

Operation Title: Opening FoxPro Application

Purpose: The student will learn how to open a FoxPro Application in a different
way.

Condition/situation Your system unit should have a FoxPro application


For the operation

Equipment, Tools Working System Unit, FoxPro Application


And Materials

Procedure

1) Opening FoxPro using run in the menu bar

1.1) Open FoxPro application by clicking the start menu then look for the Run Icon and
select it.

Run

1.2) After selecting the Run Icon a dialog box will appear , Type the directory of FoxPro
application “C:\Foxpro\Foxpro.exe” to the Run Dialog Box.

Type the Directory of FoxPro


application

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

1.3) after typing the Right directory of FoxPro, press enter or click OK to appear the FoxPro
window.

2. Opening FoxPro application in local disk (C :)

2.1) Open FoxPro applications by clicking in the start menu then select My Computer.

2.2) Look for the Local Disk (C :) and open it.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

2.3) look for the folder of FoxPro, and then open it.

2.4) Look and open the foxpro.exe application. The FoxPro window will appear once you
open the application.

FoxPro.ex
e
application

Precaution
Make sure the directory of the Application is Correct.

Quality Criteria:
1.) Open a FoxPro Application using Run Dialog box in the menu.
2.) Open a FoxPro Application in the Local Disk (c :).

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #2

Operation Title: Closing FoxPro Application

Purpose: The student will learn how to close a FoxPro Application in a different
way.

Procedure
Closing the FoxPro application
a. Using File Menu
 Click File then select Quit.

b. Using Command Window


 Type Quit then press Enter Key.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET #3
BASIC COMMANDS

SET DEFAULT COMMAND


Syntax: set default to <path>
Path : <drive letter> :\< directory name>
Sample: set defa to c:\foxpro\atis
The default command lets you specify and set a folder where you can/are going to save your
program. Once the path is wrong a message will appear saying “Invalid path or filename”. When
you have type a right directory, nothing will happen.

SET TALK COMMAND


Syntax: Set Talk OFF/ON
Used with OFF, this command lets you disable the FoxPro talk messages that scroll on the screen
when you perform many different functions. The default setting for Talk is ON. It is best not to set
talk off when you are using Visual FoxPro. The command is useful in programs, where you do not
want the end user to be confused by the talk.

SET ECHO COMMAND


Syntax: Set Echo OFF/ON
This command controls whether the Esc key can be used to interrupt the program. If it is used with
on, the source code for your program is displayed in the Trace Window as it runs, and the line that
is currently being executed is highlighted. The default setting is ON.

SET STAT COMMAND


Syntax: Set Stat OFF/ON
Set Status OFF/ON
This command determines whether the character-based status bar, showing information about the
active table and the current keyboard status, is shown at the bottom of the screen. By default, the
character-based status bar is On in FoxPro.

SET SYSM O COMMAND


Syntax: Set Sysm OFF/ON
Set Systemenu OFF/ON
This command determines whether a user can access the System menu bar while a program is
running. The off option prevents the user from doing this. The default setting is ON.

MODI COMM/MODIFY COMMAND


Syntax: modify command [<file name>]
Modi comm [<file name>]
This command opens an editing window to a new program file or edits an existing one.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

DEFI WIND/DEFINE WINDOW


Syntax: Defi Wind <window’s name> from <row>,<col> to <row>, <col>
[<scheme>,<shadow>,<no shadow>,<double/panel>] title <”window’s title”> footer <”footer title”>
This command allows you to define a window for later use. You can define the upper-left and lower-
right corners of the window by specifying from and to coordinates.

ACTIVATE WINDOW/ACTI WIND


Syntax: Acti wind [<Window’s Name>]
It Activates a window that you have previously initialized with the define window command. All
subsequent screen output will be directed to this window unless you activate another window on top
of it.

DEAC WIND/DEACTIVATE WINDOW


Syntax: Deac Wind [<Window’s Name>]
It removes a previously activated window or windows form the screen. The windows remain in
memory until you remove them with clear windows or release windows.

@.. SAY COMMAND … GET COMMAND


Syntax: @ <row>,<col> say <expression> [get <variable>]
Sample: @ 2,2 say “Enter your Name: ” get varname
This command is used for formatted input/output. The cursor is placed on the row and column of the
screen or active window defined by the <row> and <col> numbers following the @ sign. (Rows are
numbered from 0 at the top of the screen to 45 at the bottom. Columns are numbered from 0 at the
left edge of your screen to 79 at right. Although the result might vary depending on your display.) To
expression following sat is displated on the screen in this location, and the variable following GET is
displayed immediately after it. The READ command is generally used later in the program to let you
edit this variable.
CONCATENATOR [+] [-]
It is use to join two particular string character end to end.
+ concatenator combine (concatenates) string including the spaces of each string
- concatenator lets you combined strings excluding the spaces of the string
Example: @2, 2 say “snow” + “ball”

@ PROMPT COMMAND
Syntax: @ <row>,<col> prompt <”Expression”>
Same with the @ say command, this will also display the expression you specified after the prompt
keyword. The only difference is it can be generated into light bar button when the menu to command
has been used.

@ BOX COMMAND
Syntax: @ <row>,<col>,<row>,<col> box
This command is use to simply display a box. The size of the box defends on the given coordinates
(the specified starting row and column and ending rows and column.)

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

@ DOUBLE|PANEL COMMAND
Syntax: @ <row>,<col> to <row>,<col> panel/double

This command is use to simply display a box also. The size of the box defends on the given
coordinates (the specified starting row and column and ending rows and column.) It defers in the
terms that it display either double line or a thick single line.

READ
Syntax: Read
This command lets the user edit the variables of all active @... Get commands. It is used in
programming to allow the user to enter data into a data entry screen that you design.

@...CLEAR TO COMMAND
Syntax: @ <srow>,<scol> clear to <erow>,<ecol>
Sample: @ 4,2 clear to 4,50
This commands let you clear on the specific area of your window/screen.
SET COLOR COMMAND
Syntax: Set colo to [<color set name>]
Set color to [<color set name>]

These commands let you specify the colors of a number of elements of the screen. There are
several common ways to define screen colors with a set color command. You may specify a color
pair list which is a list of between 1 and 10 color pairs separated by commas. These pairs determine
foreground and background colors that appear in different circumstances – font example, W/B, R/B,
W+/B, R+/B. Possible color codes are as follows:

COLORS EQUIVALENT
N BLACK
X BLANK
B BLUE
GR BROWN
BG DYAN
G GREEN
RB MAGENTA
R RED
W WHITE
GR+ YELLOW

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

CLEAR
Syntax: Clear
Clear All
The clear command by its self clears the screen or the current output window, leaving it blank. The
Options let you specify a number of other items to be cleared from the screen or memory.

CREATE DATABASE COMMAND


Syntax: Create Database [<Name of Database >]
This command creates a new database and makes it the current database.

INDEX ON COMMAND
Syntax: index on <fieldname> to <indexname>
Sample: index on id to idxid
This command lets you create an index file for a given field specified on the database that you are
using.

USE COMMAND
Syntax: use <driveletter>:\<directory/s>\<filename>.dbf
This command lets you use a database located on the path you have specified. When you use this
command, you will automatically have an access to the database.

SET INDEX COMMAND


Syntax: set index to <indexname>
It will let you use the index that is available on your database. This command is use when you are
creating search programs

REINDEX COMMAND
Syntax: reindex
It will let you refresh or reopen the index you are using.

APPE/APPEND COMMAND
Syntax: Append [<blank>],[<no menu>]
It lets you add data to the end of the current table. First you must open the file with the command
use <file name> if you use this command when no file is open, the open file dialog box is displayed
to let you choose a table.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

REPLACE COMMAND
Syntax: Replace SomeField with SomeValue
This command is use to update the value of field in the table using the currently selected record.

STORE COMMAND
Syntax: Store SomeField to SomeValue

This command is the opposite of replace command it allows to store the value of field to currently
selected variable.

SKIP COMMAND
Syntax: skip
This command is lets you jumps on the next record on your database. When you use the use
command, the Beginning of file (BOF) is the one that will be shown/prompt, if you use this
command, it will let you jump to the next record until you reach the End Of File (EOF)

WAIT COMMAND
Syntax: Wait [window] <expression>
This command lets you press any key first before executing the next command. It is optional to use
the key window for you to display the expression in a pink bar at the right top of your screen. When
the key is only wait, it will display the default message “press any key to continue…”.

MENU TO COMMAND
Syntax: MENU TO <variable>
This command is used along with the @ prompt command to implement the light-bar menus.

CLOSE
Syntax: Close
This command closes various types of the files. It must be used with one of the alternatives listed
after it.

Functions
TRIM()
Syntax: trim(<expression>)
This command removes all trailing spaces from the specified character expression.

LTRIM()
Syntax: ltrim(<expression>)
This command removes all leading spaces from the specified character expression.
UPPER()
Syntax: upper(<expression>)
This command is use to return text in upper case format.

LOWER()
Syntax: lower(<expression>)
This command is use to return text in lower case format.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

PROPER()
Syntax: proper(<expression>)
It returns text in lowercase text with the initial letters capitalized. Not as useful as you might think
because many proper names include a mixture of uppercase and lowercase letters which must be
retained - "McDonald" and "IBM" for example.

STR()
Syntax: str(<expression>)
It returns number as a string of characters rounded to decimals.
RIGHT()
Syntax: right(<expression>,<no. of characters to be return >)
It returns the rightmost characters. Remember that the count of will include trailing spaces.

LEFT()
Syntax: left(<expression>,<no. of characters to be return >)
It returns the leftmost character. Note that it will be include any spaces.

LEN()
Syntax: right(<expression>)
It returns the length of character- including spaces. Remember this when you are getting the length
of data retrieved from a field.

PICT()

Syntax: picture ”picturecharacter”


This command gets or display a variable using mask. For example you can use pict command to get
only number keys though you declared a character variable.

Sample: @ 2,2 say “Try Again? ” get ans pict “y/n” – where only Y or N character where be valid.

Picture character Functions


A Displays alphabetic characters only
B Left-justifies numeric data
C Displays CR for credit, after a positive number
D Displays American date format
E Displays European date format
X Displays DB for debit, after a negative number
Z Displays any zeros as blanks
! Displays capital letters only
( Surrounds negative numbers with parentheses

DO COMMAND
Syntax: DO <FILENAME>
Sample: do c:\foxpro\hello.prg

This command display/execute the actual output of your program code.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

ANSWER SHEET # 1

Name: _____________________ Date: __________________

Unit Title: Procedural Programming Language

I. Answer the Following questions:

________________ 1. This command is use to display an expression on specified row and column on
the screen.
________________ 2. When this command has been executed, the default location will change to the
path what the user specified.
________________ 3. This command is use to create and open an editing window.
________________ 4. This command is use to display a box.
________________ 5. Same with the @...say command, it also display an expression but it can be
generated to light bar button when the menu to command has been used.
________________ 6. This command is use to display a rectangular shape with either double or tick
border.
________________ 7. This command is used to plan or describe a window needed for your program.
You can define the size, color, border and title of window using this command.
________________ 8. This command displays the window that has been defined when the program
starts the execution.
________________ 9. This command closes the activated window.
________________ 10. This function converts an expression into proper case when used.
________________ 11. It is a command used to specify a color of any expression or object on your
screen.
________________ 12. This commands clears only an specified row and column on your screen
________________ 13. This command clears the whole window when the command has been executed
________________ 14. This command is use to close all windows on FoxPro and terminate the FoxPro
window.
________________ 15. This command is use to close a window.

II.Give the function of the following commands:


1. @... Say command

2. Use command

3. Upper function

4. Trim Function

5. Set echo command

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #3

Operation Title: CREATING A NEW FOLDER

Purpose: The student will learn how to create a new folder that they will be use
in saving their work.

Condition/situation The System Unit that you’re going to use must be working.
for the operation :

Equipment, Tools Working System Unit, FoxPro 2.6 Application


And Materials :

Procedure:

1. Folders are the basic organizational building blocks of any computer system. Without folders it
would be virtually impossible to keep track of all the files that are found on even the smallest
system. New folders can be created just about anywhere, but three methods are shown below.
(Note: Before you start creating a new folder make sure that you’re in the location where the new
folder is to be created. In this case I’m going to use the)

a. Right click anywhere on an open area. Select New and then click Folder. A new
folder with the default name (New Folder) will be created.

b. On the Menu bar select File > New > Folder and the folder will be created in the
right hand pane.

c. In the File and Folder Tasks section, click the Make a New Folder selection. The
New Folder is created in the right hand pane.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

2. Lastly rename the folder by typing a new name (the required filename) for the folder and then hit
enter on the keyboard.

Quality Criteria:
1. The folder must be created on the right directory
2. The folder must have the correct folder name.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #4

Operation Title: CREATING AN EDITING WINDOW

Purpose: The student will learn how to create an editing window.

Procedure:

Editing window is where you type or insert the commands for your program. We have to ways to
create an editing window. Here are the procedures:

1 Using the System Menu Bar

1.1 Click the Menu Bar then Select NEW. A dialog box will appear

1.2 Select the “Program “ in the selection


1.3 Finally, Click OK. You have now your editing window, but it has no name yet.

2 Using the Command Prompt

2.1 On the command prompt type the command “Modify command” (see basic commands
IS).
2.2 Next to the command type the desired name of your editing window.

Sample Output of an Editing


2.3 Then press Enter. Window

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 4

Common errors in FoxPro

While Creating and running a program, it is very common that you will encounter errors
for your commands. Here are some of the common errors.

a. Syntax Error - refers to an error in the syntax of a sequence of characters that is intended to be written in
a particular programming language.

b. Unrecognized phrase / keyword – invalid command or keyword

c. Variable not found – you are trying to use a variable that has not been declared before using.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

d. Position is off the screen – maximum number of row/column exceeded

e. Operator / Operand type mismatch – you are combining two values with different data type.

f. For/while need logical expressions – logical expression missing

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

g. Nesting Error– you have open a logical/structural statement without closing it before running a program

Possible cause of Nesting Error:


 A DO WHILE is present without a matching ENDDO or vice versa
 A IF is present without a matching ENDIF or vice versa
 A DO CASE is present without a matching ENDCASE or vice versa
 A LOOP or EXIT clause is present outside the DO WHILE ... ENDDO, FOR ... ENDFOR, or SCAN ...
ENDSCAN commands.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #5

Operation Title: COMPILING FOR ERRORS

Purpose: The student will learn how to detect minor errors on their program.

Procedure:

1. Click Program from the menu bar.

2. Select Compile.

3. Wait window will inform you on how many error(s) you have committed.
Wait Window

4. When you reach “0 Compilation errors”, you may now run your program.

Note: 0 Compilation errors don’t mean that your program is free of error(s) because it only
compiles minor errors.

Precautions: Remember to select the editing window before compiling.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #6

Operation Title: RUNNING A PROGRAM

Purpose: The student will learn how to Run the program manually or by typing
the code.

Procedure:

1. Click Program then select Do <name of the program you want to run>.
Select DO located on the lowest part of the menu followed with the name of the program.

2. Or you can simply press CTRL + O

3. Then the program output will display.

Precautions: Remember to select the editing window before compiling.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET #1

Job Title: Hello World Program

Objective: This job lets the student learn how to create the basic of programming,
displaying an output (message) in a window specified.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding the
directory instruction) (see operation sheet # 3 )
2. Open a FoxPro Environment (see operation sheet # 1)
3. Set the directory you create as your default location (see information sheet #
3 for [set default to command])
4. Open/create an editing window with the name “hello.prg”
(See operation sheet # 4)
5. Create a command on the editing window for the output below:
Window name: helloworld
Window coordinates:

S row: 10 E row: 20
S col: 15 E col: 55
Title : “Hello World!”
Border: double with shadow

6. Compile your program for errors


7. Run your program.

Quality Criteria: The student must:


1. Created a folder and followed the instruction for directory.
2. Opened a FoxPro environment
3. Followed the OH&S procedures while doing the job
4. Create a Program as instructed on the procedure
5. Compiled the program for errors
6. Run a program.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Learning Experiences

Learning Outcome No.2 Simple Programming

Learning Activities Resources


Flowcharting Information sheet # 5
How to Take a Bath Job Sheet # 2
Answer Sheet # 2
Variables Information Sheet # 6
Hello Program Job Sheet # 3
Operators Information Sheet # 7
Simple Calculator Job Sheet # 4
Conditional Statements and Iterations Information Sheet # 8
Days in Month Program Job Sheet # 5
Grading System Program Job Sheet # 6

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 5

FLOWCHARTING
What is a Flow Chart?
A flowchart is a graphical representation of a process or system that details the sequencing
of steps required to create output. This diagrammatic representation can give a step-by-step
solution to a given problem. Data is represented in these boxes, and arrows connecting them
represent flow / direction of flow of data. Flowcharts are used in analyzing, designing, documenting
or managing a process or program in various fields. It also serves as a Blue Print of a program.

Basic Symbols of Flow Chart


Flowcharts use special shapes to represent different types of actions or steps in a process.
Lines and arrows show the sequence of the steps, and the relationships among them. These are
some basic symbols use in flowcharting.

Symbol Name Definition


Show a Process or action step. This
Process is the most common symbol in both
process flowcharts.

A Predefined Process symbol is a


marker for another process step or
series of process flow steps that
Predefined Process are formally defined elsewhere.
(Subroutine) This shape commonly depicts sub-
processes (or subroutines in
programming flowcharts).

As the names states, any process


Preparation step that is a Preparation process
flow step, such as a set-up
operation.

Flow Line & Arrow Head Flow line connectors show the
direction that the process flows.

Terminator Terminators show the start and stop


points in a process.

Decision Indicates a question or branch in


the process flow. Denotes a point in
the program where there are one
path to be taken.

On-Page Connector Use as a connector to show a jump


from one point in the process flow
to another. Connectors are usually
labeled with capital letters (A, B,

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

AA) to show matching jump points.

Off-Page Connector Off-Page Connector shows


continuation of a process flowchart
onto another page. When using
them in conjunction with
Connectors, it's best to differentiate
the labels, e.g. use numbers for Off-
Page Connectors and capital letters
for Connectors.

Data The Data flowchart shape indicates


(I/O) inputs to and outputs from a
process. As such, the shape is
more often referred to as an I/O
shape than a Data shape.

Example:

START

TRUE FALSE
Are you on
your
destination
?
TAKE A STEP
You reached
your
destination

STOP

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 2

Job Title: Flowcharting: “How to take a bath”

Objective: This job lets the student learn how to create flowchart for a process and
also learn how to use the flowcharting symbols.

Materials/Equipments: Ballpen
Paper

Procedure:
1. List all the materials that will be needed for taking a bath (bucket bath).
2. List step by step process on how to do the job(taking a bath).
3. Create a flow chart for the steps you have listed.

Evaluation: Teacher examination and inspection, using the following criteria;


1. All steps were completed in the correct output.
2. All safety precautions were followed.
3. Listed a step by step on how they take a bath.
4. Created a Flow Chart from the list created.
5. Properly place the step by step on its appropriate symbol.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

ANSWER SHEET # 2

Name: _____________________ Date: __________________

Unit Title: Procedural Programming Language

I. Answer the Following questions:

________________ 1. This sysmbol indicates the question in the flowchart. It has the only symbol
that has two different outgoing path.

________________ 2. It is the graphical representation of the flow of any process.

________________ 3. It specify that the continuation of the flowchart is on the same page.

________________ 4. This symbol represent each process or action taken.

________________ 5. Symbol use to indicate the input and/or output.

________________ 6. It is a parrallel shape which commonly know as I/O symbol.

________________ 7. This connector represent the connection of the flow at different pages.

________________ 8. A symbol use to show the start and end of the flowchart.

________________ 9. It shows the directions and connect all the symbols in a flowchart.

________________ 10. This symbol define another block statements of the process.

II. Name the following symbol

1. _____________ 3. _____________ 5. _____________

2. _____________ 4. _____________

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 6

VARIABLES

What is a Variable?
A variable is a facility for storing data. Variables are the memory locations which are used to
store values temporarily. It is use to hold particular or specific value that may vary. A variable is also
identified as a container.

How to Name a Variable?


A defined naming strategy has to be followed while naming a variable.

 A variable name must begin with an alphabet letter.


 Should not exceed 255 characters.
 It should not contain space(s) and any special character except underscore (_). You can
use underscore to serve as a space.
 Must be appropriate to its use.

How to declare a Variable?


Declaring a Variable is very important because before you can use a Variable you must
declare it first so that the programming language must acknowledge the Variable. You must declare
a variable before you can use it. But before you declare and use a variable you must know the
different DataTypes available in the language.

A Data Type (or DataType) is a classification identifying one of various types of data, as
floating-point, integer, or Boolean, stating the possible values for that type, the operations that can
be done on that type, and the way the values of that type are stored.

Basic Data Types of FoxPro

Character – use in storing letters, numbers, and special characters.


Numeric – use in storing numeric values.
Date- use in storing date values.

In declaring a variable you must know how to declare it properly and correctly. Here are the
proper and correct formats of declaring a variable in FoxPro. For each of the data type.

Character Format: <variable name> = space(<length of variable>)


e.g. name=space(30)
Numeric Format: <variable name> = 0 or 0.00
e.g. num=0
Date Format: <variable name> = date()
e.g. bday = date()

Using Variable

You can get a value from the user or use variables as an expression, if you want to display the
variable, don’t forget its datatype. You may type it after a string expression on the @ say command,
you can also use it after the @ get command to get a value from the user, or display it as another
message if it is a numeric or date datatype. Just don’t put/write double quote (“) before and after
the variable.

Sample: @ 2,2 say “Enter your name: ”get name


read
@ 4,2 say “Hello ” + name (output: Hello )

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 3

Job Title: Hello Program

Objective: This job lets the student learn how to create the program using variable.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
2. Open a FoxPro Environment (see operation sheet # 1)
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
4. Open/create an editing window with the name “hello2.prg”
(See operation sheet # 4)
5. Create a command on the editing window for the output below:
Window name: hello2
Window coordinates:

S row: 5 E row: 24
S col: 10 E col: 70

Title : “Hello Program!”


Border: panel with shadow

Variables Datatype length


Varname character 30
Varage numeric default
Varbday date default

Your program must display as below.

6. Compile your program for errors


7. Run your program.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 7

OPERATORS

An Operator is a symbol, which represents an operation to be performed. It is usually found in


every arithmetic expression.

ARITMETIC OPERATORS RELATIONAL OPERATORS

SYMBOL MEANING SYMBOL MEANING


+ Addtion > greater than
- Subtraction >= greater than or equal to
* Multiplication < less than
/ Division <= less than or equal to
% Modulos(Remainder) = equal to
<> not equal to

LOGICAL OPERATORS ASSIGNMENT OPERATOR

SYMBOL MEANING SYMBOL MEANING


.and. (&&) and = equal to
.or. ( | | ) or
.not. ( ! ) not

Logical AND truth table


true and true = true
true and false = false
false and true = false
false and false = false

Logical OR truth table


true or true = true
true or false = true
false or true = true
false or false = false

Logical NOT truth tabel


not true = false
not false = true

We use this operators to perform deffirent task in our program. For example we use
arithmetic operators and assignment operator to assigned a value to a variable or constant value, or
also to create a formula/equation.

Sample : varname = “melcris” (we use assignment operator to assign a value to a variable)
Varsum = varnum1 + num2 (we create an equation to get a sum of two variables)

Logical operators and Relational operators are used in conditions and other logical executions on
the program (will be discussed to the next topic).

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 4

Job Title: Simple Calculator Program

Objective: This job lets the student learn how to create the program using variable
and create formula and equations using operators.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “calc.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:


Window name: calc
Window coordinates:

S row: 2 E row: 24
S col: 2 E col: 75

Title : “Calculator”
Border: double with shadow

Variables Datatype length


Sum numeric 0.00
Diff numeric 0.00
Quo numeric 0.00
Prod numeric 0.00
Ave numeric 0.00
Num1 numeric 0.00
Num2 numeric 0.00

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Your program must:

a. Get 2 inputed values from the user to be stored to variables num1 and
num2.
b. Formulate a value for sum,difference,product and quotient of num1 and
num2 to be stored in the variables sum,diff,prod,quo.
c. Formualte a value for the averrage of sum,difference,quotient and
product to be stored in variable ave.
d. Display all the value of the variables.

Your program must display as below.

6. Compile your program for errors


7. Run your program.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 8

CONDITIONAL STATEMENTS AND ITERATIONS

The computer has the capability to make decisions based on a given set of conditions and choices.
This can be done through the application of conditional statements and iterations in our program.

CONDITIONAL STATEMENT

Condition – is a question answerable only by yes or no, true or false. Here are the conditional
statements that you can use in FoxPro:

IF…ELSE…ENDIF CONDITIONAL STATEMENT


In simple if-else conditional statement, there are two given choices the computer could make.
Furthermore, the computer could only choose one of them. Its like having two girlfriends, you could
only choose one to marry .

Syntax: if (condition )
Statement if true
else
statement if false
endif

Sample: varage = 0
@ 2,2 say “Enter your age: ”get age
read

if varage > 18
@ 4,2 say “You are Qualified to vote”
Else
@ 4,2 say “You are too young”
Endif

Flowchart:

F T
Condition

Statement if false Statement if true

Actually, the else part is optional which means that it can be included or not in our program;
(our program will still run even without else statement). When the condition isproven true, it will
execute the statement under the true and before else, otherwise statement after else and before
endif will be executed. In the absence of else statement, there is nothing to be executed in case
condition has result to false. The endif keyword tells that it is the end of the structure and it will
execute the statement after the structure regardless of the result of the condition.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

NESTED IF… CONDITIONAL STATEMENT

Nested if statement is an inner if..else statement inside another if…else statement. In this
conditional statement, the inner if conditional statement would only be executed if the outer if
conditional statement is evaluated to true, otherwise the last else conditional statement will be
executed.

If the our if conditional statement is evalated to true then the inner if (conditional statement) is
executed. Since this inner if is also a conditinal statement, therefore it will also be evaluated. If the
evaluation results to true, then its associated statement would be executed, otherwise its inner else
partener would be executed:

Syntax: if (condition1)
If (condition2)
Statement if true
Else
Statement if false
Else
Statement if false
Endif

Sample: age = 0
If age >= 1 and age <=100
If age> 18
@ 2,2 say “Qualified to vote”
Else
@ 2,2 say “Too young”
Else
@ 2,2 say “Out of range”
Endif

Note: To analys the structure easily, always indent your program code properly.
According to the rule of syntax, the nearest if statement is the partner of the else statement.
Without knowing this ruel, yo would endup guessing.

DO/CASE STATEMENT

Do/case conditional statement is a multi-way decision that tests whether one of the conditions
results to true. With the do/case conditional statement, we can simplify some of the tasks that are
long and cumbersome using the nested if conditional statement.

Syntax: do case (variable)


Case (condition1)
Statement1
Case (condition2)
Statement2

Endcase

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Sample: do case color


Case color = 1
@ 2,2 say “Red”
Case color = 2
@ 2,2 say “Blue”
Case color = 3
@ 2,2 say “Green”
Endcase

Flowchart:

F T
Condition
1
F T Statement if true
Condition
2

Statement if true

Statement if false

LOOPING/ITERATION

The looping statement is a program instruction that repeats some statement or sequence of
statements is a specified number of times. Looping statement allow a set of instructions to be
performed all over again until a certain condition is reached, met, or proven and tested as false.

DO WHILE…ENDDO LOOPING STATEMENT

This looping statements executes a task or command under the do while and before the
enddo while and only while the condition has been proven true. Once the condition turns to false,
the command after enddo will then be executed. The initialization variable specifies the first value
whre the loop starts. If the initialization turns out the condition to be false at the start, the statement
between the do while and enddo will not be executed (nothing will happen, it will just execute the
next command to enddo).

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Syntax: initialization
do while (condition)
Statement if true
enddo

Sample: a=0
Do while a < 5
@ a,2 say “ The value of a is ” + str(a)
Enddo

Output:
The value of a is 0
The value of a is 1
The value of a is 2
The value of a is 3
The value of a is 4

Flowchart:

Initialization

F T
Condition
1
Statement if true

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 5

Job Title: Days in Month Program

Objective: This job lets the student learn how to create the program using conditional
statements

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “daymonth.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window name: daymonth

Window coordinates:

S row: 15 E row: 28
S col: 15 E col: 60

Title : “DayMonth”

Border: panel with shadow

Variables Datatype length


Ans character 1
varmonth character 10
varyear character 4

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Your program must:

a. Get value of month from the user. The format of month must be on
proper casing only and must not accept numbers.
b. Display the number of days for the inputted month.
c. Get value of year only if the inputted value of the user is February.
d. Display “There are 28 days in February ” if the year is not a leaf year
e. Display “There are 29 days in February ” if the year is divisible by four.
f. The program must ask the user if he/she wants to try again, if the user
press y the program will be repeated. The program will only be
terminated once the user press n.

Output:

6. Compile your program for errors


7. Run your program.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 6

Job Title: Grading System Program

Objective: This job lets the student use the combination of using variables,
conditional statements, iterations and other functions.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “grading.prg” (See


operation sheet # 4)

5. Create a command on the editing window for the output below:

Window name: grading

Window coordinates:

S row: 2 E row: 35
S col: 2 E col: 78

Title : “ Grading System ”


Footer: “ASTI”
Border: double with shadow

Variables Datatype length


Ans character 1
Varname character 30
Attendance numeric 0.00
Quizzes numeric 0.00
Q1 numeric 0.00
Q2 numeric 0.00
Q3 numeric 0.00
Q4 numeric 0.00
Performance numeric 0.00
Exam numeric 0.00
Grade numeric 0.00

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Formula:
Attendance = 10 percent of the inputted attendance
Performance = 20 percent of the inputted performance
Quizzes = 30 percent of the Average inputted quizzes
(q1, q2, q3, q4)
Exam = 40 percent of the inputted exam
Grade = sum of the percentage attendance,
performance, quizzes, and exam

Remark:
Failed = If the student get a grade less than 75
Passed = if the student get a grade higher or equal to 75

Your program must:


a. Get value of the ff. variables from the user
Name 4 values for quizzes
Attendance exam
Performance
b. Compute for the given value based on the formula above
c. Display the result of the computation as shown on the picture
below.
d. Display the remark if the user passed or failed based on the
condition for remarks above.
e. Ask the user if he/she wants to try again, and executed as what the
user answered.

Output:

6. Compile your program for errors


7. Run your program.

Learning Experiences

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Learning Outcome No.3 Database Management

Learning Activities Resources


What is database Information Sheet # 9
Creating a database Operation Sheet # 7
Modifying a database Operation Sheet # 8
Creating an index Operation Sheet # 9
Create database Job Sheet # 7
Data Entry program Job Sheet # 8
Seek Program Job Sheet # 9
Edit Program Job Sheet # 10
Delete Program Job Sheet # 11
View Program Job Sheet # 12

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 9

WHAT IS DATABASE?

Database

A database can be defined as a structured collection of records or data that is stored in a computer
so that a program can consult it to answer queries. The records retrieved in answer to queries
become information that can be used to make decisions. The computer program used to manage
and query a database is known as a database management system (DBMS). The properties and
design of database systems are included in the study of information science.

The term "database" originated within the computing discipline. Database-like records have been in
existence since well before the industrial revolution in the form of ledgers, sales receipts and other
business related collections of data.

Fields

In the context of a relational database table, a column is a set of data values of a particular simple
type, one for each row of the table.[1] The columns provide the structure according to which the
rows are composed. The term field is often used interchangeably with column, although many
consider it more correct to use field (or field value) to refer specifically to the single item that exists
at the intersection between one row and one column.

Records

A row—also called a record or tuple—represents a single, implicitly structured data item in a table.
In simple terms, a database table can be thought of as consisting of rows and columns or fields.
Each row in a table represents a set of related data, and every row in the table has the same
structure.

Index

A database index is a data structure that improves the speed of data retrieval operations on a
database table at the cost of slower writes and increased storage space. Indexes can be created
using one or more columns of a database table, providing the basis for both rapid random look ups
and efficient access of ordered records. The disk space required to store the index is typically less
than that required by the table (since indexes usually contain only the key-fields according to which
the table is to be arranged, and excludes all the other details in the table), yielding the possibility to
store indexes in memory for a table whose data is too large to store in memory.

In most cases, an index is used to quickly locate the data record(s) from which the required data is
read. In other words, the index is only used to locate data records in the table and not to return data.

A covering index is a special case where the index itself contains the required data field(s) and can
return the data.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET # 7

Operation Title: CREATING A DATABASE


Purpose: To teach student how to create database manually.
Procedure:
1. The student will learn how to create database manual Select File then click New

2. Select Database then click on Ok on the dialog box that will appear

3. On another box that will appear, type the name of the field.

4. Select the Data type of the field you declared, then on the with dec part, type the
length of the field you have defined.

5. Once you already finish in typing the fields, you can now click ok.
6. Another dialog box will appear, here type the filename of the database you are creating
and select the directory or path where you are going to save your database.

7. Clicks save. A message will appear saying “Input data records now?” It’s up to you if you
want to go directly to go to the database and insert a record. (But it is recommended to
select NO since we will be creating a dataentry program on the next topic)

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #8

Operation Title: MODIFYING A DATABASE

Purpose: To teach student how to modify the database.


Procedure:

1. First, be sure that the database you will be modifying is currently in use, if not you can
use the USE command or open the database first. (see syntax for USE command – IS#3)
2. Click on the database option at the menu bar, and then click setup.

3. The Structure of your database will appear on the dialog box, to modify the fields or to
add another field click on modify.

4. The same with creating database dialog box will appear, you can now add, or edit the
field you want.
5. Click OK when you are finish. Then another OK to close and save the changes for
modifying the database you select.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

OPERATION SHEET #9

Operation Title: CREATING AN INDEX

Purpose: To teach student to create index fields


Procedure:
1. First, be sure that the database you will be modifying is currently in use, if not you
can use the USE command or open the database first. (see syntax for USE
command – IS#3)
2. Click on the database option at the menu bar, and then click setup.

3. The Structure of your database will appear on the dialog box, to modify the fields
or to add another field click on modify.

4. On the right side of the dialog box (look for ADD), click the Add button. On the
dialog box appeared, select the directory where you are going to save your index,
then click on new.

5. a.) Select the field you will indexing, b.) On the output section, select the IDX option, c.)
Type the name of the index on the save as… text box (sample: idxid.idx), d.) Click on OK.
You will be asked if you want to include the field on the index, click yes then click OK to
finish adding the index.

A B

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 7

Job Title: CREATING DATABASE

Objective: This job lets the student learn how to create database and add index.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Create database following the given fields and criteria.


Filename: datainfo.dbf

Field Datatype width dec


ID character 12
Name character 30
Address character 50
Gender character 1
Status character 1
Bdate date 8
Religion character 15
Height numeric 6 2
Weight numeric 6 2
Contact character 11

5. After, creating the database, create an index for your field id with the
index name “indexid.idx”

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 8

Job Title: DATA ENTRY PROGRAM

Objective: This job lets the student learn to create a program that adds data to the
database automatically using the append and replace command.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “entry.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78

Title: “ Data Entry Program ”


Footer: ACEBA Systems Technology Institute
Border : double line with shadow
Window name: entry

Your program must:


a. Use the database you have created previously (job sheet # 6)
b. Get a value from the user for the following data.
Name Contact
ID number Religion
Address Height
Gender Weight
Birthday Status

Conditions:
The height and weight must only accept numbers.
The gender and status must accept only one digit number
according to the available options
Birthday must accept only valid date.
The format of ID number is in this pattern
“# # # # - # # # # - # #”

c. Save the record on the database


After the user inputted the data, the program must ask the user
if he/she wants to save the records. If the user type “Y” then
the program must write the data in the database and display a
confirmation. But if the user presses N a message must

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

appear saying “Record not saved!” Only Y or N are valid keys


whether it is in upper or lower case.

d. Be able to repeat the program execution


The Program must also be able to ask if the user wants to add
another record, If the user answer yes (or Y), the program
must clear all the object and restart the program, else
terminate the program.

Desired output:

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Data Entry Program Code

set talk off


set echo off
set sysm off
set stat off
set safe off

defi wind entry from 2,2 to 32,78 title "Data Entry Program" foot "ACEBA Systems
Technology Institute" doub
acti wind entry

ans="y"
do while ans="y"

eidnum=space(15)
ename=space(30)
eaddress=space(40)
egender=space(1)
estatus=space(1)
ebday=date()
econtact=space(11)
ereligion=space(15)
eheight=space(6)
eweight=space(6)
ans1=space(1)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read

use c:\myfolder\datainfo.dbf

inde on id to eidnum
set index to eidnum
reindex

seek eidnum

if found ()
@10,15 say "The Record Already Exist"
else
@5,1,33,74 box
@6,5 say "Name : "get ename
@6,50 say "Birthday :"get ebday
@8,5 say "Address : "get eaddress
@10,5 say "Contact : "get econtact
@12,5 say "Religion : "get ereligion
@14,5 say "Height : "get eheight pict "###.##"
@14,19 say "cm"
@16,5 say "Weight : "get eweight pict "###.##"
@16,19 say "lbs."
@10,35,16,50 box
@10,37 say "Gender : "get egender
@10,55,16,72 box
@10,57 say "Status : "get estatus
@12,37 say "1.Male"
@14,37 say "2.Female"
@12,57 say "1.Single"
@13,57 say "2.Married"
@14,57 say "3.Widow/Widower"
@15,57 say "4.Separated"
@18,3,20,72 box

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

@19,5 say "Save the Record?[Y/N]"get ans1


read
@21,3,23,72 box
if ans1="y"
use c:\myfolder\datainfo.dbf
append blank

replace id with eidnum


replace name with ename
replace address with eaddress
replace birthday with ebday
replace contact with econtact
replace religion with ereligion
replace height with eheight
replace weight wit eweight
replace gender with egender
replace status with estatus
@22,5 say "Record Successfully save!!!"
else
@22,5 say "Record Not Save!!!"
endif

endif

@24,3,26,72 box
@25,5 say "Do you want to Enter Another Record?[Y/N]"get ans
read
@2,00 clear to 24,78
enddo

deact wind entry

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 9

Job Title: SEEK PROGRAM

Objective: This job lets the student learn to create a program that search and display
specific records from the database using the index, seek and store
command

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “seek.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78

Title: “ Seek Program ”


Footer: ACEBA Systems Technology Institute
Border : double line with shadow
Window name: seek

Your program must:


a. Use the database you have created previously (job sheet # 6)
b. Use the index you have created
c. Get the ID number from the user.
d. Search the value of the ID number from the database by using
seek command
e. Display the records base on the result of searching.
1. If the value matches to a record on the database, display
the following value.

Name Birthday
Address Gender
Status Contact
Religion Height
Weight

All the displayed record must not be able to be edited.


The birthday must be displayed on a long date format.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

2. If the value does not match to a field, display the message


on your program saying “Sorry! No Record Match!”

f. Display a confirmation if the user wants to search another


record, if the user presses “Y” then the program must be re-
executed, else terminate the program. Y or N is the only valid
keys (in upper or lower case).

Desired Output:

1. Output if the ID Number matches a record on the database.

2. Output if the ID number does not math to any record on the


database

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Seek Program Code

set talk off


set echo off
set sysm off
set stat off

defi wind seek from 2,2 to 32,78 title "Search Program" foot "ACEBA Systems
Technology Institute" doub
acti wind seek

ans="y"
do while ans="y"

eidnum=space(15)

@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read

use c:\myfolder\datainfo.dbf

set index to eidnum


reindex

seek eidnum
if found ()
store name to ename
store birthday to ebday
store address to eaddress
store contact to econtact
store religion to ereligion
store height to eheight
store weight to eweight
store gender to igender
store estatus to istatus

@5,1,33,74 box
@6,5 say "Name : "+ ename
@8,5 say "Birthday :"+ dtoc(ebday)
@10,5 say "Address : "+ eaddress
@12,5 say "Contact : "+ str(econtact)
@14,5 say "Religion : "+ ereligion

if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif

if istatus="1"
estatus="Single"
else
if istatus="2"
estatus="Married"
else
if istatus="3"
estatus="Widow/Widower"

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

else
if istatus="4"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif

@16,5 say "Gender : "+ egender


@18,5 say "Status : "+ estatus
@20,5 say "Height : "+ eheight
@20,25 say "cm."
@22,5 say "Weight : "+ eweight
@22,25 say "lbs."

else
@10,15 say "Sorry! No Record Match"

endif

@24,3,26,72 box
@25,5 say "Do you want to Search Another Record?[Y/N]"get ans
read
@2,00 clear to 30,78
enddo

deact wind seek

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 10

Job Title: EDIT PROGRAM

Objective: This job lets the student learn to create a program that search and modify
specific records from the database using the index, seek and store, and
replace command

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “edit.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78

Title: “ Search Program ”


Footer: ACEBA Systems Technology Institute
Border : double line with shadow
Window name: edit

Your program must:


a. Use the database you have created previously (job sheet # 6)
b. Use the index you have created
c. Get the ID number from the user.
d. Search the value of the ID number from the database by using
seek command
e. Display the records base on the result of searching.
1. If the value matches to a record on the database, display
the following value.
Name Birthday
Address Gender
Status Contact
Religion Height
Weight

All the displayed record must be editable.

2. If the value does not match to a field, display the message


on your program saying “Sorry! No Record Match!”

g. Save the changes of the records on the database

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

After the user change the data, the program must ask the user
if he/she wants to save the changes to the records. If the user
type “Y” then the program must overwrite the old data in the
database and display a confirmation. But if the user presses N
a message must appear saying “Record not changed!” Only Y
or N is valid keys whether it is in upper or lower case.

h. Display a confirmation if the user wants to edit another record,


if the user presses “Y” then the program must be re-executed,
else terminate the program. Y or N is the only valid keys (in
upper or lower case).

Desired Output:
1. If the ID NUMBER matches to a record on the database

2. if the ID number does not much to the records on the database

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Edit Program Code

set talk off


set echo off
set sysm off
set stat off

defi wind edit from 2,2 to 32,78 title "Edit Program" foot "ACEBA Systems
Technology Institute" doub
acti wind edit

ans="y"
do while ans="y"

eidnum=space(15)
ans1=space(1)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read

use c:\myfolder\datainfo.dbf

set index to eidnum


reindex

seek eidnum
if found ()

store name to ename


store birthday to ebday
store address to eaddress
store contact to econtact
store religion to ereligion
store height to eheight
store weight to eweight
store gender to igender
store estatus to istatus

@5,1,33,74 box
@6,5 say "Name : "get ename
@6,50 say "Birthday :"get ebday
@8,5 say "Address : "get eaddress
@10,5 say "Contact : "get econtact
@12,5 say "Religion : "get ereligion
@14,5 say "Height : "get eheight
@16,5 say "Weight : "get eweight
@10,35,16,50 box
@10,37 say "Gender : "get egender
@10,55,16,72 box
@10,57 say "Status : "get estatus
@12,37 say "1.Male"
@14,37 say "2.Female"
@12,57 say "1.Single"
@13,57 say "2.Married"
@14,57 say "3.Widow/Widower"
@15,57 say "4.Separated"
@18,3,20,72 box
@19,5 say "Save the Changes?[Y/N]"get ans1
read
@21,3,23,72 box

if ans1="y"

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

use c:\myfolder\datainfo.dbf

replace id with eidnum


replace name with ename
replace address with eaddress
replace birthday with ebday
replace contact with econtact
replace religion with ereligion
replace height with eheight
replace weight wit eweight
replace gender with egender
replace status with estatus
@22,5 say "Record Successfully Change!!!"
else
@22,5 say "Record Not Change!!!"
endif

else
@10,15 say "Sorry! No Record Match!"
endif

@24,3,26,72 box
@25,5 say "Do you want to Edit Another Record?[Y/N]"get ans
read
@2,00 clear to 24,78
enddo

deact wind edit

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 11

Job Title: DELETE PROGRAM

Objective: This job lets the student learn to create a program that search and delete
specific records from the database using the index, seek, delete and pack
command

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “delete.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78

Title: “ Delete Program ”


Footer: ACEBA Systems Technology Institute
Border : double line with shadow
Window name: delete

Your program must:


a. Use the database you have created previously (job sheet # 6)
b. Use the index you have created
c. Get the ID number from the user.
d. Search the value of the ID number from the database by using
seek command
e. Display the records base on the result of searching.
1. If the value matches to a record on the database, display
the following value.
Name Birthday
Address Gender
Status Contact
Religion Height
Weight

All the displayed record must not be editable. (like seek


program)
Birthday must appear in long date format

2. If the value does not match to a field, display the message


on your program saying “Sorry! No Record Match!”

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

i. Delete the records on the database


After displaying the record, the program must ask the user if
he/she wants to delete the record. If the user type “Y” then the
program must mark the record and delete only the mark record
on the database, and then display a message saying the
record is already or successfully deleted. But if the user
presses N a message must appear saying “Record not
delete!”, nothing will happen to the record on the database.
Only Y or N is valid keys whether it is in upper or lower case.

j. Display a confirmation if the user wants to edit another record,


if the user presses “Y” then the program must be re-executed,
else terminate the program. Y or N is the only valid keys (in
upper or lower case).

Desired Output:

6. Compile your program for errors.


7. Run your program

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Delete Program Code

set talk off


set echo off
set sysm off
set stat off

defi wind delete from 2,2 to 36,78 title "Delete Program" foot "ACEBA Systems
Technology Institute" doub
acti wind delete

ans="y"
do while ans="y"

eidnum=space(15)

@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read

use c:\myfolder\datainfo.dbf

set index to eidnum


reindex

seek eidnum
if found ()
store name to ename
store birthday to ebday
store address to eaddress
store contact to econtact
store religion to ereligion
store height to eheight
store weight to eweight
store gender to igender
store estatus to istatus

@5,1,33,74 box
@6,5 say "Name : "+ ename
@8,5 say "Birthday :"+ dtoc(ebday)
@10,5 say "Address : "+ eaddress
@12,5 say "Contact : "+ str(econtact)
@14,5 say "Religion : "+ ereligion

if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif

if istatus="1"
estatus="Single"
else
if istatus="1"
estatus="Married"
else
if istatus="1"
estatus="Widow/Widower"

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

else
if istatus="1"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif

@16,5 say "Gender : "+ egender


@18,5 say "Status : "+ estatus
@20,5 say "Height : "+ eheight
@20,25 say "cm."
@22,5 say "Weight : "+ eweight
@22,25 say "lbs."

@24,5 say "Do you want to Delete This Record?[Y/N]"get ans1


read
@25,3,27,72 box
if ans1="y"
delete
pack
@26,5 say "Record successfully Deleted!!"
else
@26,5 say "Record not deleted!!"
endif

else
@10,15 say "Sorry! No Record Match"

endif

@29,3,31,72 box
@30,5 say "Do you want to Search Another Record?[Y/N]"get ans
read
@2,00 clear to 36,78
enddo

deact wind delete

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 12

Job Title: VIEW PROGRAM

Objective: This job lets the student learn to create a program that will display all the
records on the database starting from the BOF until EOF. The student will
also learn how to use the skip and wait command.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “view.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78

Title: “ View Program ”


Footer: ACEBA Systems Technology Institute
Border : double line with shadow
Window name: view

Your program must:


a. Use the database you have created previously (job sheet # 6)
b. Display a label on the first row of the window you have
created.
c. Display only the values for the following fields on the same
column as there label.

ID Number birthday
Name Contact
Gender
Only 18 rows (records) must be displayed.
The other record will be shown next once the user press a key

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

d. Display records while the end of file is not encountered. Once


there is no more records to display, clear all the objects on the
window and display the message “No more records to view”
and wait for the user to press a key before terminating the
program.

Desired Output:

6. Compile your program for errors.


7. Run your program

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

View Program Code

set talk off


set echo off
set sysm off
set stat off
defi wind view from 2,2 to 32,78 title "Search Program" foot "ACEBA Systems
Technology Institute" doub
acti wind view
use c:\myfolder\datainfo.dbf
do while not eof()

@5,5 say "ID Number : "


@5,15 say "Name : "
@5,25 say "Birthday :"
@5,35 say "Address : "
@5,45 say "Contact : "
@5,55 say "Religion : "
@5,65 say "Gender : "
@5,75 say "Status : "

if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif

if istatus="1"
estatus="Single"
else
if istatus="1"
estatus="Married"
else
if istatus="1"
estatus="Widow/Widower"
else
if istatus="1"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif
@x,5 say id
@x,15 say name
@x,25 say birthday
@x,35 say address
@x,45 say contact
@x,55 say religion
@x,65 say gender
@x,75 say estatus
x=x+1
enddo
deact wind view

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

Learning Experiences

Learning Outcome No.4 System Compiling

Learning Activities Resources


Designing Light-bar Menus Information Sheet # 10
Main Menu Program Job Sheet # 13

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

INFORMATION SHEET # 10

DESIGNING LIGHT-BAR MENUS

You now have your Data Entry, Search, Edit, Delete and View program. All you need to do
now is to compile it to make it a system; we will now be creating a Main Menu program. Main menu
program is compose of light-bar buttons (menus) so that the user can select and press on the
button then the program they desired will appear. Using this menu the user can easily access the
system we have created.

A series of @-PROMPT commands is first used to display the desired menu options at specific
positions on the screen. The format for this command is

@ row,column PROMPT “expression” [MESSAGE “expression”]

Where the character expression that follows the PROMPT clause appears in a bar at the specified
row and column position. The MESSAGE clause is optional. If it is used, the character expression
that follows MESSAGE will appear in the message area of the screen whenever that particular
menu option is highlighted.

A series of @-PROMPT commands are followed by a MENU TO command. The format of this
command is

MENUT TO memory-variable

It activates the menu choices defined with the PROMPT command and waits for a user response.
The user can highlight the desired menu option and press [ENTER], at which time a numeric value
representing the chosen menu option gets passed on the memory variable specified in the MENU
TO command. For example, if the user highlight the first menu option and presses [ENTER], 1 gets
stored to the variable. If the user highlights the fourth menu option and presses [ENTER], 4 get
stored to the variable.

Once the user presses [ENTER], nothing will happen since there is no specific command under
each light bar, to create an execution, you can use the do case or any conditional statement that will
check the value of the variable and execute a certain command once a value has been meet. Here
is the example program;
ans = 0

@ 5,5 prompt “ [ HELLO PROGRAM ] ”


@ 7,5 prompt “ [ CALCULATOR ] ”
@ 9,5 prompt “ [ EXIT ]”

menu to ans

do case
case ans = 1
do hello.prg
case ans = 2
do calc.prg
case ans = 3
quit
endcase

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

JOB SHEET # 13

Job Title: MAIN MENU PROGRAM

Objective: This job lets the student learn to create a menu for their system. In this
job, they will use the menu to, @ prompt, and do command.

Materials/Equipments: System Unit [XP OS]


Installer FoxPro 2.6 for Dos

Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )

2. Open a FoxPro Environment (see operation sheet # 1)

3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])

4. Open/create an editing window with the name “main.prg”


(See operation sheet # 4)

5. Create a command on the editing window for the output below:

Window coordinates:
Srow: 6 Erow : 24
Scol : 2 Ecol : 78

Title: “Main menu Program ”


Footer: ACEBA Systems Technology Institute
Border: double line with shadow
Window name: mainmenu

Your program must:


a. Display the output below

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2
USING FOXPRO 2.6

b. Display/direct to other program once a light-bar button has been


pressed.

Program light-bar button


Data Entry New Record
Seek Program Search Record
Edit Program Edit Record
Delete Program Delete Record
View Program View Record
Confirmation Close

c. Display a confirmation once the user click close.

Once the user type or press “Y” the program must be


terminated, else the program will still be running.

ACEBA SYSTEMS TECHNOLOGY INSTITUTE ASTI-TD2K10-KSA –MCA| CS DEPARTMENT


2

You might also like