Sunteți pe pagina 1din 75

IBS LAB FILE

PRACTICAL NO:-1

INTRODUCTION TO FOXPRO FoxPro is very powerful Database Management System. Its integrate development Environment allows programmer's language. It is both an interpreter and true compiler. As interpreted language, it translates each command into computer instructions, as it is executes the translation time, most possibly during loops. A compiler improves performance by translating command to machine instructions just once. It replaces commands such as PRINT or LIST with blocks of machine code. This compiled programs run faster than interpreted codes. FoxPro supports arithmetic functions such as addition, subtraction, multiplication, and division. It also provides many special mathematical and financial functions. The main screen combines a menu bar across the top line with a command prompt environment based on the command window. FoxPro opens the command window at the beginning of each session. Commands entered into it execute immediately.

Data Types:Character: It is used to store characters (A to Z, a to z). It has width up to 254. Numeric: It is used to store numeric values that include numbers & decimal values. It has width up to 20. Float: It is also used to store numeric values & floating values. It has width up to 20. Double: It has width up to 8. It can store numerical, floating values. Date: This data type is used to store date in (dd/mm/yy) format. It has width up to 8. Integer: It used to store integer values and it has width up to 4. Logical: This data type is used to store the result of some condition which is either true/false. It has width of 1. Memo: This data type can store numeric & alphanumeric values. It can handle very large data.

FoxPro window description:


ATUL SHARMA 90690363019

IBS LAB FILE

View window: It is used to see the content of tables or the results of queries which areentered by user. It shows the information rows and columns wise along with the column headings.

Command window: This window is used to enter commands/queries to access information from the labels. This window can be moved to any place in main window and can be resized.

Menu bar: This bar conation various menu items (eg. file, edit, view, format, tool, program, window, help) and there sub menus. These menus have various options to create/design database, manage database, compiling queries etc.

Tool bar: This bar contains various ready to use tools to create and manage database or to do others tasks. These are like shortcuts to the options available in menu items.

Fox pro main window

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-2

UNDERSTANDING DATABASE IN FOXPRO It is a collection of related and relevant information. It could be check register, accounting ledger, payroll, client list or inventory. Or it could be any of thousands of applications in business, education, engineering, and the professions, the sciences and other fields. In general, a database consists of number of RECORDS .In FoxPro, a record may consist a number of items such as employee code number, employees name, address, date of joining, salary, designation etc. A number of such items in FoxPro's record are known as FIELDS. Number of fields makes up a single record of single person, and number of such record made up an entire DATABASE. Tables: A table is a database object that holds users data. It consists of rows and columns. Information is stored in tabular form a row make a record. Column contains same kind of attribute of an entity. Records: A record is a collection of fields. It consists of all the attribute of an entity. A row makes a record. Creating Tables: Fox Pro provides a very convenient way to create tables. The procedure is discussed step by step. 1. Click on File Menu then on New. There are various options to create project, database, tables etc as shown in the following picture. Then click on the new file. A create dialog box will appear. Then enter the table name and click on save. Click on File>> select New

ATUL SHARMA

90690363019

IBS LAB FILE

Rename the table according to your needs and save it.

Then a table designer window will appear where we can specify attribute/column name there data type and there size. Fill in the required entries.

ATUL SHARMA

90690363019

IBS LAB FILE

After entering the required fields and clicking on Ok. Then a massage box will appear which will ask to enter entries at that time or later click yes to enter entries.

On clicking yes following record entry window will appear and one by one record can be entered. Input Data Records.

Press Ctrl +W to save the table.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-3

RETRIEVING AND EDITING DATABASE In fox pro we retrieve the database by using various commands . for example display, display next, display all, list, list all. Database can also be edited very easily in fox pro . commands used for editing are browse, edit, replace etc.

RETRIEVING

Display: This command is used to display the current record which is pointed by record pointer. It displays the record which the pointer is currently pointing. We can point to any specified record using goto command which we will explan later. And then display the pointed record using display command.

ATUL SHARMA

90690363019

IBS LAB FILE

Display Next: This command is used to display specific number of records starting from current record pointer position.

Display All: This command is used to display the all record in the specified table. If all record could not come in single window then it provide option for hit any key to continue the display the record. It displays record with column name.

ATUL SHARMA

90690363019

IBS LAB FILE

ATUL SHARMA

90690363019

IBS LAB FILE

Display Rest: This command is used to display all the records up to last record starting from the current position.

MODIFY STRUCTURE: This command is used to make changes in the structure of the table and when we save the changes they become permanent. We can add new fields or can increase size of data types.

ATUL SHARMA

90690363019

IBS LAB FILE

SKIP: This command is used to move the record pointer in some specific steps according to the index given in the command. Below example shows the working of SKIP command. Here first we goto record 1 and then write skip 2. This means record pointer moves to record 3. At the left bottom corner it can be seen that record 3 is written. That means the pointer is now pointing to record 3:-

ATUL SHARMA

90690363019

IBS LAB FILE

List:- This command is used to display record in a table. LIST ALL: To display all record in a table this command is used but it can only display record which comes in single window. It doesnt have option like in display all command to continue show of record in next window.

LIST FIELD:
Used to check all the entries of a particular column

ATUL SHARMA

90690363019

IBS LAB FILE

LIST OFF: This command is used to display a specific record without record pointer field. It does not have the Record# field:-

LIST FOR:

ATUL SHARMA

90690363019

IBS LAB FILE

This command is used to display a specific record based on the condition given in the command. For example:-

EDITING It is desirable some time to change the previously stored information. We can change the database by using commands like edit, browse etc.

Browse It is used to check the entries in a tabular form. This command is used to view the record of table in tabular form. It also displays record pointers current position. It allows to modify the data also.

ATUL SHARMA

90690363019

IBS LAB FILE

EDIT: This command is used to update in the record of a table. It is desirable some time to change the previously stored information. EDIT FOR: In this command some value with column name can be specified to find a record that is to be updated.

ATUL SHARMA

90690363019

IBS LAB FILE

GOTO:This command is used to move pointer on any record specified in the command. Then we can see the record using display command. For example we can go to first record And then display the next 2 records.

ATUL SHARMA

90690363019

IBS LAB FILE

REPLACE:This command is used to replace some data in a record with a new record. For example we may need to edit data by replacing the branch of a student. Here we first go to record no 17 and then replace the students branch of ece with mech:-

ATUL SHARMA

90690363019

IBS LAB FILE

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-4

REMOVING DATA FROM DATABASE To familiarize with the operation which are done to remove data from tables. (A).DELETE: This command is used for marking any record which we want to delete. Marked record can be identified when we use browse command, this kind of marking can be removed. It marks the specified record with a star.

ATUL SHARMA

90690363019

IBS LAB FILE

(B).RECALL: This command is used to recall the marked record. If by mistake we have marked any wrong record then this command can recover that record

ATUL SHARMA

90690363019

IBS LAB FILE

(C).PACK: This command is use to delete only those records permanently which are marked for deletion. If we execute this command than that record can never be recovered.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-5

FILE UTILITIES IN FOXPRO When working with foxpro you have to do operations such as listing the files in a directory ,making a copy of file ,erasing or renaming file .foxpro support many commands for performing these functions to display list files from current or specified drive or directory. Here different given below for performing the different operations. (A).DIR D: it is used to display all files present in d directory.

(B).COPY FILES: copy file command is used to make a copy of database or any other file.

ATUL SHARMA

90690363019

IBS LAB FILE

(C).RENAME: rename command is used to assign new name to any file.

(D).ERASE: It is used to delete the file.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-6

IMPLEMENTING THE TIME AND DATE FUNCTION USING FOXPRO

TIME: the Time function returns the system time maintained by the dos. ?time () shows the current in 24 hours format. Set clock on: It displays the clock on the right side of the FoxPro window. Second () and? Sys (): these are two identical functions that return the no of seconds that have elapsed mids night. Only difference between two is that second returns the no of seconds with the resolution of 1m sec. Date (): date function returns the dos system date FoxPro display the American formal month/date/year. Set mark to special character: set mark to special character command delimits to be used expression display off data. Set century on/off: if you wish to use a 4 digit year format with date () then you have to use the command set century on.

All the above commands are shown in the below snapshot:

ATUL SHARMA

90690363019

IBS LAB FILE

Day():the day function returns numeric day value from a data expression. Month(): this function retrevies the numeric value of month from any date expression. Cmonth():it returns the name of month from any data expression. Year(): year functiion returns the numeric year from a date expression. It always return the year with century regardness of setting of command set century. Dow(): day of week function returns no.corresponding to day o week from specified date type expression.the day one of week is Sunday. Cdow(): charcters day of week function return name of day from the specified date type expression.

In the following snapshot we have first set the system date to the variable current. Then day() command is used as day(current) and similarly other commands are used:-

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-7

IMPLEMENTING THE NUMERIC FUNCTIONS USING FOXPRO

Square root: it returns the sqrt of numeric expression enclose the numeric expression within the parenthesis.

Logarithm: FoxPro has two functions to calculate logarithm of numeric expression ? Log (): it returns the numeric expression. ?log10 (): it returns the common algorithm to the base ten.

The snapshot given below shows the square root and logarithm functions:

ATUL SHARMA

90690363019

IBS LAB FILE

?int(): this function returns integer part of numeric expression. int(num) ?abs(): this function returns the absolute value of numeric expression that is it convert a negative expression to coreesponding positive number. abs(num) ?round(): the function rounds of the number upto specified number of places. The place is specified by writing it after putting comma after the number. round(num), round(num,1), round(num,2), round(num,-2), round(num,-3) etc.

The following snapshot shows the above functions. Here we have specified the number in num variable. After that it is rounded and stored in another variable num2:-

?max ( ): the max function gives the maximum value among the given values. ?min ( ): the min function gives the minimum value among the given values.The max and min function can be used to find maximum and minimum values among the numbers and alphabets also. ?between ( ): between function is used to check whether the number written in center among the 3 numbers is smaller than both or not. It returns T(true) or F(false) for the correct or incorrect values respectively.

ATUL SHARMA

90690363019

IBS LAB FILE

?mod ( ): the mod function is used to find the remainder after performing the division operation on any numbers. ?exp ( ): the exp function returns the exponent value of the number specified in brackets.
Snapshot showing above functions:

?sign ( ): this function gives the sign of specified number. It gives 0, -1, 1 for zero, negative and positive value respectively.
In following snapshot we have stored 0 in variable marks and then sign is used.

ATUL SHARMA

90690363019

IBS LAB FILE

?len ( ): this function is used to find the length of the character. We can specify the character within the parenthesis or it can first be stored in a variable e.g. ch and then length can be found by writing: - ?len (ch) However if we use a table and write a column name in the parenthesis then the len function will specify the range of the column taken. For example using our table deepti112 if we write len(name) then it will give the range of column name i.e. 10 .

Sum and average functions The sum and average functions are used to find the sum and the average respectively. They are used by considering a table. When they are used they provide the sum and the average of the column having numerical values in that table. For example: in the table deepti112 when we use these functions then they provide the sum and average of all the entries of column rollno. This example is shown in the following snapshot:-

ATUL SHARMA

90690363019

IBS LAB FILE

Count for:- count for counts the total number of records for a given condition. e.g. in table deepti112 we count the total no of records for branch= cse. The result (i.e. 8 in this case) is shown at the bottom left of window.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-8
TO USE SORTING AND INDEXING COMMAND IN FOXPRO.

SORT: This command is used to sort the element of a column in either ascending / descending order which is mentioned in the command. Sorted values are stored in the new table.

ATUL SHARMA

90690363019

IBS LAB FILE INDEX: This command is used to provide a index value on some specified column of a given table. Index value is stored in new table.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-9

INTRODUCTION TO COBOL COBOL (COmmon Business Oriented Language) was one of the earliest high-level programming languages. It was developed in 1959 by a group of computer professionals called the Conference on Data Systems Languages (CODASYL). Since 1959 it has undergone several modifications and improvements. In an attempt to overcome the problem of incompatibility between different versions of COBOL, the American National Standards Institute (ANSI) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL. In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version. In 1985, ANSI published still another revised version that had new features not in the 1974 standard. The language continues to evolve today. Object-oriented COBOL is a subset of COBOL 97, which is the fourth edition in the continuing evolution of ANSI/ISO standard COBOL. COBOL 97 includes conventional improvements as well as object-oriented features. Like the C++ programming language, object-oriented COBOL compilers are available even as the language moves toward standardization. COBOL FEATURES: COBOL is self-documenting: One of the design goals for COBOL was to make it possible for non-programmers such as supervisors, managers and users, to read and understand COBOL code. As a result, COBOL contains such English-like structural elements as verbs, clauses, sentences, sections and divisions. Readers who are familiar with C or C++ or Java might want to consider how difficult it becomes to maintain programs written in these languages. C programs that you have written yourself are difficult enough to understand when you come back to them six months later. COBOL is Simple: COBOL is a simple language (no pointers, no user defined functions, no user defined types) with a limited scope of function. It encourages a simple straightforward programming style. Curiously enough though, despite its limitations, COBOL has proven itself to be well suited to its targeted problem domain (business computing). We noted above that COBOL is a simple language with a limited scope of function. And that is the way it used to be but the introduction of OO-COBOL has changed all that. OO-COBOL retains all the advantages of previous versions but now includes User Defined Functions Object Orientation National Characters - Unicode Multiple Currency Symbols Cultural Adaptability (Locales) Dynamic Memory Allocation (pointers) Data Validation Using New VALIDATE Verb Binary and Floating Point Data Types ATUL SHARMA 90690363019

IBS LAB FILE User Defined Data Types

COBOL is Portable: The COBOL standard does not belong to any particular vendor. The vendor independent ANSI COBOL committee legislates formal, non-vendor-specific syntax and semantic language standards. COBOL has been ported to virtually every hardware platform - from every favour of Windows, to every falser of Unix, to AS/400, VSE, OS/2, DOS, VMS, Unisys, DG, VM, and MVS. COBOL is Maintainable: COBOL has a 30 year proven track record for application maintenance, enhancement and production support at the enterprise level. Early indications from the year 2000 problem are that COBOL applications were actually cheaper to fix. One reason for the maintainability of COBOL programs have been given above - the readability of COBOL code. COBOL programmers know that the parts of the program that will have to be altered to accommodate these changes will be isolated in the Environment Division. In COBOL programs, programmers have no choice. COBOL's rigid hierarchical structure ensures that these items are restricted to the Environment Division. COBOL coding sheet:

ATUL SHARMA

90690363019

IBS LAB FILE The structure of COBOL programs: COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. The hierarchy consists of Divisions, Sections, Paragraphs, Sentences and Statements. A Division may contain one or more Sections, a Section one or more Paragraphs, a Paragraph one or more Sentences and a Sentence one or more Statements. We can represent the COBOL hierarchy using the COBOL metalanguage as follows;

Divisions: A division is a block of code, usually containing one or more sections, that starts where the division name is encountered and ends with the beginning of the next division or with the end of the program text. Sections: A section is a block of code usually containing one or more paragraphs. A section begins with the section name and ends where the next section name is encountered or where the program text ends. Section names are devised by the programmer, or defined by the language. A section name is followed by the word SECTION and a period. See the two example names below SelectUnpaidBills SECTION. FILE SECTION.

ATUL SHARMA

90690363019

IBS LAB FILE Paragraphs: A paragraph is a block of code made up of one or more sentences. A paragraph begins with the paragraph name and ends with the next paragraph or section name or the end of the program text. A paragraph name is devised by the programmer or defined by the language, and is followed by a period. See the two example names below PrintFinalTotals. PROGRAM-ID. Sentences and statements A sentence consists of one or more statements and is terminated by a period. For example: MOVE 45 TO A. MOVE 34.76 TO Pcost COMPUTE B = Pcost * A.

Four Divisions of COBOL: At the top of the COBOL hierarchy are the four divisions. These divide the program into distinct structural elements. Although some of the divisions may be omitted, the sequence in which they are specified is fixed, and must follow the order below. IDENTIFICATION DIVISION. Contains program information. ENVIRONMENT DIVISION. Contains environment information.

DATA DIVISION. Contains data descriptions. PROCEDURE DIVISION. Contains the program algorithms.

1. IDENTIFICATION DIVISION: The IDENTIFICATION DIVISION supplies information about the program to the programmer and the compiler. The IDENTIFICATION DIVISION has the following structure:

ATUL SHARMA

90690363019

IBS LAB FILE IDENTIFICATION DIVISION. PROGRAM-ID. NameOfProgram. [AUTHOR. YourName.] other entries here 2. ENVIRON MENT DIVISION: The ENVIRONMENT DIVISION is used to describe the environment in which the program will run. The purpose of the ENVIRONMENT DIVISION is to isolate in one place all aspects of the program that are dependent upon a specific computer, device or encoding sequence. In the ENVIRONMENT DIVISION, aliases are assigned to external devices, files or command sequences. Other environment details, such as the collating sequence, the currency symbol and the decimal point symbol may also be defined here 3. DATA DIVISION: The DATA DIVISION has two main sections: the FILE SECTION and the WORKINGSTORAGE SECTION. Additional sections, such as the LINKAGE SECTION (used in subprograms) and the REPORT SECTION (used in Report Writer based programs) may also be required. The FILE SECTION is used to describe most of the data that is sent to, or comes from, the computer's peripherals. The WORKING-STORAGE SECTION is used to describe the general variables used in the program. The DATA DIVISION has the following structure and syntax:

4. PROCEDURE DIVISION: The PROCEDURE DIVISION contains the code used to manipulate the data described in the DATA DIVISION. It is here that the programmer describes his algorithm. The PROCEDURE DIVISION is hierarchical in structure and consists of sections, paragraphs, sentences and statements.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-10 ADDITION OF TWO NO USING COBOL.

IDENTIFICATION DIVISION. PROGRAM-ID. ADD1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. ADD A B GIVING C. DISPLAY "THE RESULT IS:" C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-11 SUBTRACTION OF TWO NO USING COBOL

IDENTIFICATION DIVISION. PROGRAM-ID. subtraction. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. SUBTRACT A FROM B GIVING C. DISPLAY "THE RESULT IS:" C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

EXPERIMENT-12 MULTIPLICATION OF TWO NO USING COBOL

IDENTIFICATION DIVISION. PROGRAM-ID. multiplication. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. MULTIPLY A BY B GIVING C. DISPLAY "THE RESULT IS:" C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-13 DIVISON OF TWO NO USING COBOL

IDENTIFICATION DIVISION. PROGRAM-ID. divison. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. DIVIDE A BY B GIVING C. DISPLAY "THE RESULT IS:" C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-14 AIM: FIND THE GREATER NO FROM TWO NO USING COBOL


IDENTIFICATION DIVISION. PROGRAM-ID. GREATER1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE FIRST NUMBER". ACCEPT A. DISPLAY "ENTER THE SECOND NUMBER". ACCEPT B. IF A>B DISPLAY "A IS GREATER". IF B>A DISPLAY " B IS GREATER". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-15 FIND THE EVEN AND ODD NO FROM THE TWO NO USING COBOL

IDENTIFICATION DIVISION. PROGRAM-ID. oddeven. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 99. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE NUMBER". ACCEPT A. DIVIDE A BY 2 GIVING B REMAINDER C. IF (C = 0) DISPLAY "A IS EVEN". IF (C NOT = 0) DISPLAY "A IS ODD". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-16 PROGRAM TO COMPARE OF 2 NON NUMERIC OPERAND.

IDENTIFICATION DIVISION. PROGRAM-ID. COMPARE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS X(9). 01 B PIC IS X(9). PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE VALUE OF A". ACCEPT A. DISPLAY "ENTER THE VALUE OF B". ACCEPT B. IF A>B DISPLAY "A IS GREATER". IF B>A DISPLAY "B IS GREATER". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-17 PROGRAM TO COMPARE OF 2 NUMERIC OPERAND.

IDENTIFICATION DIVISION. PROGRAM-ID. COMPARE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 999V99. 01 B PIC IS 999V99. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE VALUE OF A". ACCEPT A. DISPLAY "ENTER THE VALUE OF B". ACCEPT B. IF A>B DISPLAY "A IS GREATER". IF B>A DISPLAY "B IS GREATER". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-18 PROGRAM TO COMPARE OF NON NUMERIC OPERAND WITH NUMERIC OPERAND.

IDENTIFICATION DIVISION. PROGRAM-ID. COMPARE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS X(3). 01 B PIC IS 999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE VALUE OF A". ACCEPT A. DISPLAY "ENTER THE VALUE OF B". ACCEPT B. IF A>B DISPLAY "A IS GREATER". IF B>A DISPLAY "B IS GREATER". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-19 SHOW USE OF MOVE STATEMENT IN COBOL.

IDENTIFICATION DIVISION. PROGRAM-ID. SHIFT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 999. 01 B PIC IS 99. PROCEDURE DIVISION. PARA1. DISPLAY " ENTER A". ACCEPT A. DISPLAY " ENTER B". ACCEPT B. MOVE A TO B. DISPLAY " NEW VALUE IS "||B. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-20 TO CONVERT TEMPERATURE FROM DEGREE FARHENHITE TO DEGREE CELSIUS USING COBOL

IDENTIFICATION DIVISION. PROGRAM-ID. convert temp. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 999V99. 01 B PIC IS 999V99. 01 C PIC IS 999V99. 01 F PIC IS 999V99. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE TEMPERATURE IN FARHENHITE". ACCEPT F. SUBTRACT 32 FROM F GIVING A. DIVIDE 5 BY 9 GIVING B. MULTIPLY A BY B GIVING C. DISPLAY "THE RESULT IS:" C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-21 PROGRAM TO SHOW THE USE OF SIGN CLAUSE.

IDENTIFICATION DIVISION. PROGRAM-ID. SIGN1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS S999. PROCEDURE DIVISION. PARA1. DISPLAY "ENTER THE VALUE OF A". ACCEPT A. IF A IS POSITIVE DISPLAY "A IS POSITIVE". IF A IS NEGATIVE DISPLAY "A IS NEGATIVE". IF A IS ZERO DISPLAY "A IS ZERO". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-22 WAP IN COBOL TO FIND HIGHER NUMBER FROM THE GIVEN 3 NUMBERS USING IF-ELSE STATEMENT.
IDENTIFICATION DIVISION. PROGRAM-ID. HIGH. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 99. PROCEDURE DIVISION. PARA-1. DISPLAY 'ENTER FIRST NUMBER'. ACCEPT A. DISPLAY 'ENTER SECOND NUMBER'. ACCEPT B. DISPLAY 'ENTER THIRD NUMBER'. ACCEPT C. IF A>B AND A>C DISPLAY 'A IS BIGGEST'. IF B>C AND B>A DISPLAY 'B IS BIGGEST'. DISPLAY 'C IS BIGGEST'. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-23 PROGRAM TO SHOW THE USE OF JUSTIFY CLAUSE IN COBOL.


IDENTIFICATION DIVISION. PROGRAM-ID. JUSTIFY. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PICTURE IS X(6). 01 B PICTURE IS X(2) JUSTIFIED RIGHT. PROCEDURE DIVISION. PARA-1. DISPLAY "ENTER THE VALUE OF A". ACCEPT A. MOVE A TO B. DISPLAY "VALUE OF A IS " || A. DISPLAY "THE RESULT IS " || B. STOP-RUN.

OUTPUT:

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-24 PROGRAM TO SHOW THE USE OF ON SIZE ERROR OPTION

IDENTIFICATION DIVISION. PROGRAM-ID. AAA. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 B PIC IS 99. 01 C PIC IS 99. PROCEDURE DIVISION. PARA-1. DISPLAY "ENTER THE VALUE OF A ". ACCEPT A. DISPLAY "ENTER THE VALUE OF B ". ACCEPT B. ADD A B GIVING C ON SIZE ERROR GO TO ERROR-PARA. DISPLAY C. ERROR-PARA. MOVE 0 TO C. DISPLAY C. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-25 PROGRAM TO SHOW THE USE OF PERFORM STATEMENT

IDENTIFICATION DIVISION. PROGRAM-ID. abc. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. MAIN-PARA. PERFORM PARA-2 THROUGH PARA-3. PARA-2. DISPLAY "HELLO!". PARA-3. DISPLAY "SUSCET Tangori". STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-26 WAP IN COBOL TO PRINT HELLO 10 TIMES USING PERFORM WITH TIME STATEMENT.

IDENTIFICATION DIVISION. PROGRAM-ID. PRINCE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99 VALUE IS 01. PROCEDURE DIVISION. PARA-1. PERFORM P1 10 TIMES. P1. DISPLAY "HELLO" . ADD 1 TO A. STOP-RUN.

OUTPUT:

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-27 COBOL PROGRAM TO SHOW THE USE OF PERFORM WITH UNTIL OPTION.

IDENTIFICATION DIVISION. PROGRAM-ID. abc. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99 VALUE IS 1. PROCEDURE DIVISION. MAIN-PARA. PERFORM PARA-2 UNTIL A>5. PARA-2. DISPLAY "HELLO!". ADD 1 TO A. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-28 COBOL PROGRAM TO CALCULATE FACTORIAL OF A NUMBER USING PERFORM WITH VARYING OPTION.
IDENTIFICATION DIVISION. PROGRAM-ID. FACTOTJ. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PICTURE IS 999. 01 I PICTURE IS 999. 01 C PICTURE IS 999 VALUE IS 1 PROCEDURE DIVISION. MAIN-PARA. DISPLAY " ENTER THE NUMBER: ". ACCEPT A. PERFORM PARA-1 VARYING I FROM A BY -1 UNTIL I = 1. DISPLAY C. PARA-1. COMPUTE C = C * I. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-29 COBOL PROGRAM TO PRINT FIBONACCI SERIES USING PERFORM WITH VARYING UNTIL OPTION.

IDENTIFICATION DIVISION. PROGRAM-ID. FIBBOTJ. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PICTURE IS 99 VALUE IS 00. 01 B PICTURE IS 99 VALUE IS 01. 01 C PICTURE IS 99. 01 I PICTURE IS 99. 01 N PICTURE IS 99. PROCEDURE DIVISION. MAIN-PARA. DISPLAY " ENTER VALUE OF N: ". ACCEPT N. DISPLAY "FIBBONACCI SERIES". DISPLAY A. DISPLAY B. PERFORM PARA-1 VARYING I FROM 1 BY 1 UNTIL I > N - 3. PARA-1. COMPUTE C = A + B. DISPLAY C. MOVE B TO A. MOVE C TO B. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-30 COBOL PROGRAM TO FIND THAT GIVEN NUMBER IS PRIME OR NOT USING PERFORM STATEMENT.
IDENTIFICATION DIVISION. PROGRAM-ID. PRIME. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC IS 99. 01 I PIC IS 99. 01 X PIC IS 99. 01 R PIC IS 99 VALUE IS 0. 01 C PIC IS 99. PROCEDURE DIVISION. PARA-1. DISPLAY 'ENTER THE NUMBER'. ACCEPT A. COMPUTE X = A / 2. PERFORM P1 VARYING I FROM 2 BY 1 UNTIL I > X. IF R = 0 DISPLAY " THIS IS A PRIME NUMBER". IF R = 1 DISPLAY " NUMBER IS NOT PRIME ". P1. COMPUTE C = A - (I * (A / I ) ). IF C = 0 MOVE 1 TO R. STOP-RUN.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-31 INTRODUCTION TO WORD PROCESSOR

WORD PROCESSORA word processor is a package that processes textual matter and creates organised and flawless documents. The word processing originated way back in 1964 when special typewriters Magnetic Tape Selectric Typewriters (MTST) were launched by IBM (International Business Machines).These machines were capable of storing documents on magnetic storage. The stored data could easily be reprinted when desired.

FEATURES OF WORD PROCESSORS: 1. Fast: Typing text in a word processor becomes speedy as there is no mechanical carriage movement associated. 2. Editing features: Any type of correction can be made easily as and when required. 3. Permanent storage: With word processors, document can be saved as long as desired. The saved document can be retrieved whenever desired. 4. Formatting features: The typed text can be made to appear in any form or style (bold, italic, underline, etc).All this is possible due to formatting features of word processors. 5. Graphics: Most modern word processors provide the facility of incorporating drawings in the documents which enhances their usefulness. 6. OLE (Object Linking and Embedding) : Most modern word processors provide facilities to link objects in a dcument.OLE is a program-integration technology that you can use to share information between programs through objects. Objects are saved entities of different types like charts, pictures, etc. 7. Spell check: Word processors not only are capable of checking spelling mistakes but also can suggest possible alternatives for incorrectly spell words. 8. Mail merge: The mail merge facility enables us to print a large number of letters/documents with more or less similar text. Mail merge feature actually merges main document with a data source. The main document stores original text with data area at appropriate places. These data areas are successively filled by the information in the data source and merged document is printed.
9. Drawing Canvas:-The new Drawing Canvas helps you easily insert position, layers and resize drawing object in your documents.

ATUL SHARMA

90690363019

IBS LAB FILE

10. Diagramming:- You can add variety of diagrams using the diagramming tools on the drawing toolbar. Diagram (Radial type) Diagram toolbar Drawing sizing handle Drawing border 11. Improved watermarks:- You can easily select a picture, logo, or custom text to apply as the background for your printed document.

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL- 32 . IMPLEMENTING CHARACTER FUNCTIONS USING FOX PRO

?IS UPPER To check if the given input written in brackets is in capitals or not. If it is in upper case then it gives T (TRUE) otherwise F (FALSE). ?IS LOWER To check if the given input written in brackets is in small letters or not. If it is in lower case then it gives T (TRUE) otherwise F (FALSE). ?IS ALPHA To check if the given input written in brackets is an alphabetic data or not. If it is alphabetic then it gives T (TRUE) otherwise F (FALSE). ?IS DIGIT To check if the given input written in brackets is numeric or not. If it is digital (numeral) then it gives T (TRUE) otherwise F (FALSE).

The above character functions are shown below by taking some examples:

ATUL SHARMA

90690363019

IBS LAB FILE ?LEFT This character function is used to trim the characters specified from left. ?RIGHT This character function is used to trim the characters specified from right. ?TYPE This character function is used to find that whether the given input is a character(C) , memo(M), digit (D), or undefined (U). ?AT This character function is used to find out that at what position a specified character in the given character set occurs again for a given number of times. Example: ?AT (a,xyabczaef,2) gives answer 7 because the character a comes twice at 7th position. Above functions are shown below:

ATUL SHARMA

90690363019

IBS LAB FILE

PRACTICAL-33 INTRODUCTION TO SPREADSHEETS


A spreadsheet is simply a grid of boxes, or cells, set up in rows and columns. Every cell has a unique address, corresponding to its row and column location. For example, the cell in the first column and first row is A1. The cell in the third column and four row would be C4. The computer can find its way around the spreadsheet by using those addresses, and perform functions on the numbers you enter in those cells. It sounds complicated, but it's not. Here is a typical blank spreadsheet grid:

Basically, we can use this grid to add, subtract, multiply and divide numbers. We can do percentages. Columns or rows can be sorted alphabetically, or numerically. That makes a spreadsheet a powerful tool that will make your life easier whenever you must deal with large blocks of information or numbers. If you have a large group of names, for example, a spreadsheet allows you to sort them or keep track of them. If you have a budget or financial data, the program can help you analyze the numbers. We've used spreadsheets here at The StarLedger on budget stories, analyzing state education numbers, looking at crime statistics, keeping track of non-profit groups, an examination of speeding tickets, stories on payroll padding and breaking down aviation safety data. Some editors also use it as a management tool, including keeping track of expenses and maintaining sortable lists of names and projects. Entering data To keep things simple, we're going to look at a spreadsheet with just a few columns and rows. With Excel Version 7, you actually have 16,000 rows and columns to play with. To enter a number or other information, just click in a cell with your left mouse. Let's start in cell A3 with some data from the Roseland municipal budget:

ATUL SHARMA

90690363019

IBS LAB FILE

As you can see, the cell is not large enough to fit the words. But we can make the columns larger by moving the mouse to the line between columns. You then click and hold on the line and drag it out to make it larger.

Now go to cell B3 and enter numbers the same way. Don't worry about putting in commas, percent signs or currency signs. We can format the whole column after we're finished:

ATUL SHARMA

90690363019

IBS LAB FILE

Formatting Data

To format the column, click on the column header, which in this case is the grey square with a B at the top. Click in the square with your left mouse button and the entire column will be highlighted. Then go to the top of the tool bar and click on Format, then click on Cells in the submenu, and click on Number to format the numbers in the cells. Here, we will click on Currency within the numbers submenu to put dollar signs and commas in the appropriate places:

Once we do that, however, you see something has happened to the cells: You get a #### in some of the cells. That's the program's way of telling you the column isn't wide enough. To fix it, click and drag on the | between B and C like we did earlier, and widen the column again.

Now let's add another column of numbers, again by simply clicking in the cell and working down. We already have the 1997 budget figures. Let's enter the 1996 numbers as a comparison:

ATUL SHARMA

90690363019

IBS LAB FILE

Calculating Changes Here's where we put the program to work. If you wanted to, you could take a calculator and add up those columns yourself. You could then subtract the difference between the two years of figures in each column, and get an idea of where expenses are heading. With Excel, the program will do it for you. Start by adding up each column. Click in cell B9. What we want to do is tell the program what numbers to add up. In Excel, we tell the computer we are about to enter a formula by starting with an = sign. Remember, every cell has a unique address. We want to add up cells B3, B4, and all the way to B8. We could do that by entering the formula =B3+B4+B5+B6+B7+B8. That will work, but it means entering a lot of numbers and the whole point of this program is to save us work. So we can tell the program to simply add up the column by entering =SUM(B3:B8) Another shortcut, and we love shortcuts, is to click on the bottom of the column and then click on the Sigma, or Summation sign in the top toolbar. That will enter the formula for you. Just make sure there isn't a data at the top of the column, or the date will be added to your total.

Do the same in both columns, and you get totals. Add the years to the top of the columns, to identify them. We can calculate the difference between the two years the same way by entering a formula in Column D. Click on D3. To subtract last year's Administration expenses from this year's, just enter the formula: =B3-C3.

ATUL SHARMA

90690363019

IBS LAB FILE

Once you enter the formula, you can repeat the formula for other rows without retyping it by clicking in the cell. You can copy the formula and the spreadsheet is smart enough to change the cell addresses automatically. To copy the formula in D3, click on the cell. Then look for the small square in the lower right corner of the cell border. This is called a Fill Handle. Click on the square and hold, and the drag it down through D9:

That tells us more than the town did when they gave us the budget, but let's look at it further. What is the percentage increase or decrease between the two years? Again, this is pretty simple to figure out. Enter a formula in the next column the same way. A percentage is a simple ratio. Here, we want to know the percentage increase, so the ratio would be the difference between the two years, over what the budget number had been. We've already calculated the difference in Column D. The budget figure for the previous year had been the number in Column C. The percentage, then, would be D3/C3. We format the box as a percentage, the same way we formatted earlier as currency.

ATUL SHARMA

90690363019

IBS LAB FILE

The next step is to pick out the area of greatest change. With a small spreadsheet like this example, it's pretty easy. But what if there were hundreds of numbers. Excel will handle that automatically with the sort function. To use it, highlight all the rows and columns you want sorted. Then click on Data in the top toolbar, and then Sort in the submenu. The program will prompt you, asking what column you want sorted, and whether it should be in ascending or descending order. Her, we will sort by Column D to find who got the biggest spending increase last year:

Charting Finally, there is one other tool in Excel's bag of tricks. You can chart numbers. This could help in analysis because it graphically shows you things you might miss if all you are doing is looking at numbers. This is also pretty simple to do. Simply highlight the cells you want charted, and then click on the upper toolbar on ChartWizard, a little icon that has a chart on it. The program will then guide you though the making of a chart. That's all there is to it. If we take this spreadsheet and chart the numbers, here is what we get:

Some last pointers


ATUL SHARMA 90690363019

IBS LAB FILE

Inserting columns. Click on the header where you want a column to be inserted. Then go to Insert in the upper toolbar, Column and presto, a Column appears. Do the same thing to put in a new row. Saving your spreadsheet. Go to File in the upper toolbar. Then Save As, name your spreadsheet and click OK Printing. Go to File, Print Preview, and then check how the spreadsheet looks. Then click on Print.

PRACTICAL-34

ATUL SHARMA

90690363019

IBS LAB FILE

Programming in Fox Pro:


Commands: MODIFY Command: This command is used to open a program window. The extension used to save a program is .prg.

DO command: This command is used to execute a particular program. In this we first write do followed by the name of the program to be executed. DO WHILE-END DO command: This command is used to execute a particular statement for a particular number of times. Example:

Output is:

ATUL SHARMA

90690363019

IBS LAB FILE

ACCEPT command: This command will accept a value from the user but it must be of character type. INPUT command: This command will also accept a value from the used but it can take value of any data type from the user. Example:

Output is:

ATUL SHARMA

90690363019

IBS LAB FILE

IF ELSE- END IFF loop: This loop is used to check the condition and perform according to the result of the condition. Example: To find out the larger of two numbers.

Output is:

ATUL SHARMA

90690363019

IBS LAB FILE

1.Program to find that number is even or odd.

Ouput is:

ATUL SHARMA

90690363019

IBS LAB FILE

FOR-END FOR loop: This command is used to execute a particular statement for a particular number of times. Example: To calculate the value of log of numbers from 100 to 111.

Output is:

ATUL SHARMA

90690363019

IBS LAB FILE

DO CASE-END CASE command: This command is used in the case when there are more than two conditions. This is similar to switch statement. Example: To construct a calculator using case statement.

Output is:

ATUL SHARMA

90690363019

IBS LAB FILE

ATUL SHARMA

90690363019

S-ar putea să vă placă și