Documente Academic
Documente Profesional
Documente Cultură
FoxPro is a DBMS most commonly used in earlier days. organizational databases most efficiently used. FEATURES OF FOXPRO
1 We can link up multiple databases to give rise a pyramidal structure of databases. 2 Queries can be made on a single or multiple databases, databases being grouped by some field, sorted on fields, meeting user defined criteria. 3 We can generate Reports with fields of choice from a single or multiple databases grouped by some column and with suitable headings. 4 We can make use of View windows to see selected fields from a single or multiple databases. 5 We can design customized Menu systems for organizing the entire function and subroutines of our program with Popup prompting fields, files and structures with the FoxPro Menu designer tool. 6 We can design customized Windows for display of suitable messages and screen activities. 7 We can design customized Screens with FoxPro Screen Designer. We can save these and retrieve repetitively afterwards. 8 We can generate our own Application and Projects with FoxPro Application Generator. 9 We can organize our application through catalog manager. 10 We can import data from other database and can export FoxPro databases to others FoxPro for Windows communicates data with other Windows applications.
It is an
FOXPRO WINDOW
When you will start FoxPro on your systems you will see the screen and this window consists of three sub areas and these are: 1 Command Window:- This is the area with caption Command. When you will start FoxPro you will find the small Command Window at the right hand corner with blinking cursor for the command to input. We can apply commands either by typing or by selecting the right command in the Command window. 2 Menu:- This is the area to the upper side of the window. This is the toolbar which contains further submenus and these are File, Edit, View, Format, Tools, Program, Windows and Help.
3 Display Area:- This is the remaining area of the Window which is generally in the form of white.
form. Different subject areas are organized into fields along columns. Records, consisting of all field values organized along rows. So, a database is a collection of fields into a tabular form. 2 FILE/TABLE:- A database file is a collection of related information. It is also called a table, as it is a two-dimensional structure. For example, a database files containing the Employee Name, Employee Number, Employee dates of birth etc.
3 RECORD:- All data pertaining to a employee in the above example would constitute a record in the database. A file is a collection of such records. 4 FIELDS:-A field is the smallest part of a record that can be accessed. In the above example Employee name, Employee numbers are all fields. A group of such related fields forms a record.
Example:
Record.dbf
NAME Naunita Manjinder AGE 20 21 ADDRESS Bathinda Jalandhar
In the above example Record.dbf is the name of the File. Name, Age and Address are the name of the field. Manjinder 21 Jalandhar is a complete Record.
2 NUMERIC FIELDS:- They are used to store numbers. You can perform calculations on the data stored in these fields. They can contain whole numbers or decimal numbers. In addition to the numbers they can contain decimal point and a negative sign. 3 FLOAT:- The float data type is designed for scientific calculations, since it can store more significant digits internally. But it is not commonly used. 4 LOGICAL:- This field is used when there are only two possibilities for the data, i.e. Yes/No, True/False. For example, bills have been paid or not. Logical fields have predefined width of one. 5 DATE:- Date fields are used to store dates. They have a predefined width of eight. Date fields will accept only valid dates, which are normally entered and displayed in mm/dd/yy format.
6 MEMO:- This field is normally used to store large amount of text such as abstracts, short documents, etc. Memo field data is not stored in the database file, but it is stored in a separate database text file. 7 GENERAL:- The general data type can store OLE objects that allows you embed objects created in one application within another application.
S.No 1 2 3 4 5 6 7
VARIABLES TO STORE Character or string Integers or numbers Dates T or F Stores the number in scientific form
10 bytes[by default]
Text description Bit Map images, Binary Codes or any type of data.
UNDERSTANDING DATABASES
OBJECTIVES
Creating a database/table Working with database/table Closing a table/database
2 Same command can be executed through the menu by selecting following command Choose File > New > Table from the FoxPro menu system.
If u will write only create in the FoxPro command window, then after executing u will see a window which will ask u to save the table and that window is as shown below:-
After saving the database or table there will be a dialog box as shown below:-
This is a window in which u can enter the following things:1 Enter the field name under the caption NAME. 2 Enter the data type of the field name under caption TYPE. 3 Enter the width of the field. 4 Enter the decimal point width value of the field. 5 Enter the index for the field that is whether u wants to be the value in ascending or descending order.
FoxPro saves the structure in a file by the name specified by the user and displays the dialog box as shown below:-
Enter records right now by clicking yes, or save the structure only, so as to Append records afterwards by clicking No.
ENTRIES IN Student_325 After u clicked Yes then there will be a dialog box in which u can enter the records of the created database as shown above.
OPENING A TABLE/DATABASE
If you need to open a database that already exists, within the command window provide the name of the database after USE. Use without any database name following it closes the currently opened database. USE <Filename>
EXAMPLE
USE "c:\documents and settings\student\my documents\isha.dbf" The USE command instructs FoxPro to open the specified database file. When this command is given, you return to the next line in the command window which means that the command has been successfully executed and the db you want to work on is ready to use.
If the specified database file does not exists FoxPro displays an appropriate error message which helps you in rectifying the error. The same command can be executed through menu by selecting: FILE > OPEN and choose the database from the dialog box.
EXERCISE NO 1
1) Create a database named STUDENT with the following structure:
FIELD NAME Stud_id Stud_name Branch Stud_sem Stud_per TYPE Character Character Character Character Character WIDTH 4 50 10 8 5
ADDING THE RECORDS IN A DATABASE 3 Append the following records to the database 101 rajni ee 5th 66.0000
Editing data
INTRODUCTION
Once the data has been entered into the tables entered in, you can retrieve the data using list and display commands. Data can be retrieved on conditional basis depending on your requirements. These commands provide you with the options of viewing data on the screen or sending output on to the printer.
LIST
The LIST command displays the records of the current database. If used without any option this command displays all the records of the current database. If a scope option such as RECORD, NEXT or REST is included, the display is limited to the number of records specified to the scope.
SCOPE -- Scope refers to the number of records that FoxPro searches in the course of performing a command. Some of the keywords used as Scope are NEXT, REST and ALL.
NEXT -- Next specifies number of records (starting from the current one) to be listed. This clause is optional.
DISPLAY
It displays the current record of the current database. This command is same as that of list command. All the option used in the LIST command can be used with the Display command. The basic difference between the two commands is that the LIST command when typed will display all the records of the database irrespective of the record pointer. But Display command displays the record where the record pointer is.
Syntax :Display[<scope>][<field list>] [FOR<Criteria>] [WHILE<Criteria>] [OFF] [TO PRINT] Display command without parameter displays the current record. With All clauses it displays all the records. The difference between LIST and DISPLAY ALL is that LIST command scrolls away but DISPLAY ALL pauses after one screen.
RECORD POINTER
Every record in your database file has a record number. Records are numbered sequentially as they are entered. The record number of the current record and the total numbers of records are displayed on the status bar. A pointer keeps track of the current record when you are browsing a file. The position of the record pointer can be seen on the status bar. When a database file is opened the record pointer is automatically set to record number 1 initially. Whenever a command that accesses the records is given, the record pointer is appropriately moved.
GOTO
We use Goto command to jump to a particular record in the file without scrolling through all the records. It proves beneficial in case of large records and saves time in searching a record. Syntax:
MODIFYING DATA
Once the data is entered and if you wish to change some part of the data, FoxPro provides us with two commands, EDIT and BROWSE. Both the commands allows us to modify the data, the basic difference between both of them is that the Edit command displays one record at a time, and allows you change the information of that record. Browse displays many records at a time, and allows you to change information in multiple records.
EDIT
To use the Edit command it is essential that a database file be in use. If you just type Edit in the Command window, FoxPro displays the current record with the data for editing. In case if you have to change the data of a particular record, you can use scope or the conditional statement.
Syntax :EDIT [Scope] [FIELDS<field list>] [FOR<criteria>] [WHILE<criteria>] <field list> -- You can specify the list of fields of choice. FOR -- For specifies the criteria of selecting records for editing. editing. EXAMPLE:Edit record 4 Edit for name-navjeet Edit fields stud_name WHILE -- While specifies the criteria of selecting records for
BROWSE
When you type BROWSE in the command window it opens a window and displays contents of the active database file. The name of the database appears as the same window title. While in browse mode you can spilt the window into two partitions and can examine the data. This provides the facility to edit and view field entries of the multiple records column wise.
DELETE RECORDS
One of the commands to delete the data is Delete command. The major advantage of using this command is when you execute this command data is not physically deleted from your database file. When the command is executed, instead of deleting the records it marks the record for deletion. The advantage of this is in case you want to revert back your original decision you can.
Syntax:-
DELETE [RECORD <record no>] [Scope] [FOR <condition>] <condition>] SCOPE In case you want to delete few records from the current record pointer you can use the words NEXT, REST, ALL as scope words. Delete Delete all Delete next 2 Marks the current record for deletion Marks all records of the database for deletion
[WHILE
Marks 2 records for deletion from the current record pointer position.
Delete record for It will mark all those records for deletion where Student Name is stud_name='rajni RAJNI.
RECALL
Some times you might have deleted some useful data using delete command. Since delete commands actually marks the records for deletion you have a chance to revert your decision. The command that allows you to get back the data that are marked for
deletion is RECALL.
Syntax :RECALL [Scope][FOR <criteria>] [ WHILE <criteria>] SCOPE -- In case you have to recall some records from the current record pointer position you can use Scope. The words used as scope are NEXT, REST, ALL.
EXAMPLES Recall Recall all -- Recall unmark the current record if it is marked for deletion. -- Unmark all records of the database that are marked for deletion.
Recallnext 2 -- Unmark 2 records that are marked for deletion from the current record pointer position. Recall record for stud_name = 'naunita' It will unmark all those records that are marked for deletion for name=Naunita.
PACK
The PACK command is responsible for physically removing records that were, until now, logically flagged as deleted. The Pack command has no parameters. Once we have packed a database, there is no way of bringing back records that have been removed. After the pack operation the database will be reduced by, the number of deleted records. The record numbers will also be readjusted to provide for consecutive numbering, from 1.
Syntax :Pack
ZAP
If you have to delete all the records of a database, the only known way of doing this job is to use DELETE ALL and the PACK commands. All the records from the database would now be removed. If, however we had several thousand records in file, deleting all the records and then packing the file is time- consuming. An instant delete of all records is possible through the use of ZAP command. Zap will remove all records from the database.
Syntax :Zap
REPLACE
The replace command is used to replace the contents of one or more fields either in the current record or all records. You can selectively update information/data of the field(s), for selective records in the database by using For and While conditions. The replace command is a very powerful command, i.e., with this command you can search for a particular record(s), and you can update selective field(s) of that record(s). Replace command can be executed from command window or from the menu. If you wish to execute this command through command window the general syntax of replace command is given below:
EXAMPLE
REPLACE stud_id WITH stud_id*100 all.
MANAGING DATABASES
OBJECTIVES
Sorting, Indexing. Searching for the records on certain criteria.
SORTING
Sorting involves the physical rearranging of records in the database. That is, each of the record in the database is physically moved around so that they are organized in the required sequence. The command which does this is SORT. With the sort command, specify the field name on which you have to arrange your database. It creates a new database with the same structure and copies all the records of the current database into the new database and arranges either on alphabetical, numeric or alphanumeric order. The sort can be performed on one or more named fields within the active database. When sort command is executed records that are marked for deletion are also marked.
Syntax :SORT TO<file> ON <field 1>[/A | /D], [<field 2>[/A | /D] [<scope>] [FOR<expL 1>] [FIELDS<field list>] File -- New Filename which holds the sorted data. /A -- This option lets you specify ascending order although it is done by default if it is not specifying. /D -- Sorts in descending order.
For Example:First open the database in which u want to perform sorting. Then write the following command into the command window. Sort to "c:\documents and settings\ student\ my documents\ stud_name.dbf" on rollno /d The above command will sort the opened database in descending order with respect to the field name ROLLNO and save the sorted data into cust1.dbf The major disadvantages of this command are :1) It requires same amount of disk space as that of the original file. 2) When a new record is added it will be added at the end of the database. So the database has to be sorted again in order to have an ordered database.
INDEXING
Unlike Sort command, Index will not move your records physically from one place to another in the new database. Instead, when you give Index command it creates a new file which contains information on where things are located in the database file. Foxpro stores records in the database file sequentially, as they are entered. The last record entered is appended to the bottom of the database. Like Sort command Index command also creates a new file, but the file size is smaller compared to that of Sort command. To index a database file, you can use Index command or take the help of the index dialog box. FoxPro can create two types of index files :- SINGLE and COMMAND.
A database can be indexed in order to facilitate searching on the basis of single key field or a number of key fields. The indexed file is compact. It contains only the index number for the key field value and the corresponding record number.
LOCATE
With the non-indexed file you can position the record pointer in the database according to some criteria for field values. To execute this command it is necessary that the database is in use. The syntax of the LOCATE Command is given below:LOCATE FOR <field1> = <value1> [,<field2> = <value2> ,....] EXAMPLE Locate for name = 'naunita'
IDENTIFICATION DIVISION. PROGRAM-ID. DIVIDE69. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PICTURE IS 99. 01 B PICTURE IS 99. 01 C PICTURE IS 999. PROCEDURE DIVISION. MAIN-PARA. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. DIVIDE A INTO B GIVING C. DISPLAY "THE RESULT IS " C. STOP RUN.
IDENTIFICATION DIVISION. PROGRAM-ID. CALCULATOR. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 999. 01 B PIC IS 999. 01 C PIC IS 999. 01 OPT PIC IS X. PROCEDURE DIVISION. MAIN-PARA. DISPLAY "ENTER THE 1ST NUMBER" A. ACCEPT A. DISPLAY "ENTER THE 2ND NUMBER" B. ACCEPT B. DISPLAY "ENTER THE CHOICE" OPT. ACCEPT OPT. IF OPT="+" ADD A B GIVING C. IF OPT="-" SUBTRACT A FROM B GIVING C. IF OPT="*" MULTIPLY A BY B GIVING C. IF OPT="/" DIVIDE A BY B GIVING C. DISPLAY "THE RESULT IS" C. STOP RUN.
IDENTIFICATION DIVISION. PROGRAM-ID. PERFORM. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. TOPLEVEL. DISPLAY "HI THERE!!!!". PERFORM BOTTOM. DISPLAY "BACK IN TOP" STOP RUN. BOTTOM. DISPLAY "HI AGAIN!!!!!".
IDENTIFICATION DIVISION. PROGRAM-ID TIMES. DATA DIVISION. PROCEDURE DIVISION. TOPLEVEL. DISPLAY "GO TO MIDDLE". PERFORM MIDDLELEVEL 6 TIMES. DISPLAY "BACK TO TOP". STOP RUN. MIDDLELEVEL. DISPLAY"RIGHT NOW U ARE IN MIDDLE". PERFORM BOTTOMLEVEL. BOTTOMLEVEL. DISPLAY"RIGHT NOW U ARE IN BOTTOM".
ENVIRONMENTAL DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC 99. 01 B PIC 99V99. 01 C PIC 999. 01 D PIC 999.99. PROCEDURE DIVISION. MAIN-PARA. DISPLAY"ENTER TEMPRATURE IN CELCIUS". ACCEPT A. DIVIDE 9 BY 5 GIVING B. ADD A TO 32 GIVING C. MULTIPLY B BY C GIVING D. DISPLAY"RESULT IS"D. STOP RUN.
INTRODUCTION
A Word processor is an S/w Package that helps to create and edit a document. Creating a document involves writing it into the internal memory of computer and saving it by writing in disk. Editing a document involves correcting spelling mistakes, inserting or deleting the words, sentences and styles. We can underline a text, can make it bold or italic or can change its font size and can vary the font also.
After writing the document, spell checker is available in the s/w that will check its spelling and will correct if any mistake is there. We can have as many number of copies of that text as desired by user.
STARTING OF MS-WORD
The steps to activate or to starting MS- Words are as: Click on the start button in the task bar. Select the Programs option from the start menu. Click on the Microsoft Word {MS- Word}.
Title Bar It shows the title, which contains the symbol & name
of active word document at the left side of title bar. In right side it contains minimize/ maximize, restore & close buttons.
correct options, Mail merge, Envelope & labels, Macro, Options etc. Table : It includes insert table, delete cells, split cell, select rows, select column, formula, sort, select table, merge cell, table auto format. Window : It includes new windows, arrange all & split. Help : It contains help for every problem. Its shortcut key is F1. Then it displays a screen for typing our question or for specific topic.
Ruler Bar The ruler bar allow us to format the vertical alignment
of the text in the document. Tab setting can be done using ruler bar.