IBS Lab 2012

65
GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB GGS College of Modern Technology, Kharar (Mohali)-Punjab (Approved by AICTE & Affiliated to Punjab Technical University, Jalandhar) PRACTICAL FILE CSE DEPARTMENT 

Transcript of IBS Lab 2012

Page 1: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 1/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

GGS College of Modern Technology,

Kharar (Mohali)-Punjab(Approved by AICTE & Affiliated to Punjab Technical University, Jalandhar)

PRACTICAL FILE

CSE DEPARTMENT 

Page 2: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 2/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

GGS COLLEGE OF MODERN TECHNOLOGY,

KHARAR

Approved by AICTE& Affiliated to PTU, Jalandhar

CSE/IT DEPARTMENT 

LABORATORY REPORT  

(CS - 320 SOFTWARE LAB  –IX)

(Introduction to Business System) 

NAME OF STUDENT______________________

ROLL NO._______________________________

SEMESTER _____________________________

SESSION ________________________________

STUDENT SIGNATURE__________

FACULTY SIGNATURE_______

Page 3: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 3/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

COURSE OBJECTIVE

This Guide is designed for helping the students to perform better in various practical courses. It describes the

tructure of a good laboratory report, outlines the different sections of the report and explains the need for each

of them. It also introduces some standard conventions and rules for writing reports of professional quality. The

quality of your written report will strongly affect your grade for the course.

EVALUATION OF PRACTICAL WORK

  Each student will be required to perform the experiment individually.

  Student will be required to write theory, algorithm, program, outputs etc. during practical session

itself.

  Each experiment will be marked by the teacher on the basis of experiment performed and write up on

the same day. These marks will account for 40% of the sessional marks.

  Sessional marks will also include VIVA and Attendance marks as per rules.

GOOD LABORATORY PRACTICES

  You must develop good laboratory habits by keeping complete laboratory note books.

  Keep all your notes about the laboratory procedures and data in this notebook in pen.

  It is always better to read experiment in advance.

  The expectation is that you will work individually on separate computers. Each of you will write a

separate report.

  Please bring your laboratory manual to the lab on every turn.

THINGS TO DO AND DON’T DO IN THE LABORATORY

DO’S 

  Remember this is a practice laboratory & keep silence.

  Sit down in proper manner.

  Laboratory instructor can help to access software and printer.

  If require more in depth help you can concern lecturer.

  Proper shut down the computer system before leaving the laboratory.

  Exit laboratory quickly, if short circuit or any emergency occurs.

DON’T 

  Write anything on the furniture.

  Delete or change other student’s file. 

  Uninstall the software.

  Create, change or remove any password.

  Play computer games.

Page 4: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 4/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

List of ExperimentsSr.

No.List of Experiments  Date of 

performance

Teacher’s

signature

Marks

1

Introduction to FoxPro2 Understanding data bases: In this

practical we will discuss variouscomponents of FoxPro

3 Retrieving & Editing Databases: Toaccess record from FoxPro & viewspecific information from specifictables.

4 Removing data from Databases: Tofamiliarize with the operation whichare done to remove data from tables

5 Managing Databases: To managedatabase entries in ascending / descending order and assigning someindex value so that record can beidentified easily and searched at fastspeed.

6 Searching for the record in theDatabase: To use the operation oflocate to search record in the record.

7 Introduction to COBOL

8 Program for addition of two numbers.

9 Program for subtraction of twonumbers.

10 Program for multiplication of twonumbers.

11 Program for Division of two numbers.

12 Program for all arithmetic operation

between two numbers.

13 Program for checking a number isEven or odd.

14 PROGRAM FOR FINDINGGREATER BETWEEN TWONUMBERS.

15 Program Using Perform Clause.

Page 5: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 5/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

16 Program For Conversion Of

Temperature.

17 Program To Design Calculator InCOBOL

18 Introduction to different wordprocessors and their features.

Page 6: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 6/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 1 Date__/__/_____ 

AIM Introduction to FoxPro 

Visual FoxPro is a data-centric object-oriented and procedural programming language produced by Microsoft. It is

derived from FoxPro (originally known as FoxBASE) which was developed by Fox Software beginning in 1984. Fox

Technologies merged with Microsoft in 1992 and the software acquired further features and the prefix "Visual".

The last version of  FoxPro (2.6) worked under Mac OS, DOS, Windows, and Unix: Visual FoxPro 3.0, the first

"Visual" version, dropped the platform support to only Mac and Windows, and later versions were Windows-only.

The current version of Visual FoxPro is COM-based and Microsoft has stated that they do not intend to create a

Microsoft .NET version.

FoxPro originated as a member of the class of languages commonly referred to as "xBase" languages, which

have syntax based on the dBase programming language. Other members of the xBase language family include

Clipper and Recital. (A history of the early years of xBase can be found in the dBASE entry.)

Visual FoxPro, commonly abbreviated as VFP, is tightly integrated with its own relational database engine, which

extends FoxPro's xBase capabilities to support SQL query and data manipulation. Unlike most database

management systems, Visual FoxPro is a full-featured, dynamic programming language that does not require the

use of an additional general-purpose programming environment. It can be used to write not just traditional "fat

client" applications, but also middleware and web applications. 

Starting of FoxPro:

Page 7: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 7/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Features:

  In FoxPro we can link up multiple databases to give rise to pyramidal structure of database.

Queries can be made on a single or multiple databases being grouped by a field sorted on the fields

meeting user defined criteria.

  We can generate reports with fields of choice from a single or multiple databases grouped by some

column with suitable headings.

  We can make use of view window to view selected fields from single or multiple databases.

  We can design customized screens with FoxPro screen designer. We can save this and retrieve

respectively next time.

  We can generate our own applications and projects with FoxPro application generator

  We can organize our application through catalogues.

  We can import data from other databases and can export FoxPro database.

ConvEntions:

FoxPro provides various data types to store data of various sizes in the data bases some of these are discussed

here.

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

Page 8: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 8/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. What is the latest version of FoxPro available ?

2. What are the various datatypes used in FoxPro ?

3. Visual FoxPro is the combined product of which two companies ?

4. What are the various platforms for which FoxPro is available ?

Page 9: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 9/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 2 Date__/__/_____ 

AIM Understanding data bases: In this practical we will discuss various componentsof FoxPro

Objectives: Familiarization with Database and various components.

Data Base : It is defined as large collection of coherent, meaningful & interrelated data that is stored or

organized in such a way so that it can be accessed and process by authorized user at any time. Data in data base is

secure, less redundant & shared by multiple users. A data base contains number of tables.

 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.

FoxPro main Window:

Page 10: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 10/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

FoxPro window description:

View window : It is used to see the content of tables or the results of queries which are

entered 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.

Creating Tables: FoxPro 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 option 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.

Page 11: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 11/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

2. Then a table designer window will appear where we can specify attribute/column name there data type and

there size. Then a massage box will appear which will ask to enter entries at that time or later click yes to enter

entries.

Page 12: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 12/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

3. On clicking yes following record entry window will appear and one by one record can be entered. Record can be

later added by using append command. 

Page 13: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 13/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. What is the extension of table created in FoxPro ?

2. The queries are entered in which window of FoxPro ?

3. What is a Record ?

4. By which command the Record can be later added ?

Page 14: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 14/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 3 Date__/__/_____ 

AIM Retrieving & Editing Databases: To access record from FoxPro & view specificinformation from specific tables. 

Objective: To use the commands related to access & view records from FoxPro tables. We have followingcommands.

1. Display: This command is used to display the current record which is pointed by record pointer.

1.1 DISPLAY: This command displays single record which is pointed by record pointer.

Page 15: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 15/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

1.2 DISPLAY NEXT : This command is used to display specific number of records starting from current record

pointer position.

1.3 DISPLAY REST: This command is used to display all records up to last record starting

from current position of record pointer.

Page 16: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 16/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

1.4 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 

2. LIST: This command is used to display record in a table. It has various options as following are given.

2.1 LIST: To display all record in a table this command is used but it can only display record which comes in

single window. It doesn’t have option like in display all command to continue show of record in next window.

Page 17: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 17/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

2.2 LIST FIELD : This command is used to display specified column/fields in a table.

2.3 LIST FOR: This command is used to display a specific record based on the condition given in the

command.

Page 18: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 18/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

2.4 LIST OFF : This is used to display record with out Record# field.

3. EDIT : This command is used to update in the record of a table. It is desirable some time to change the

previously stored information. It has following options.

3.1 EDIT : It use index number to find specific record then it will display then it can be modified.

Page 19: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 19/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

3.2 EDIT FOR: In this command some value with column name can be specified to find a record that is to

be updated.

4. MODIFY STRUCTURE: This command can be used to made changes in the structure of table and when

we save these changes these become permanent. We can add new fields or can increase the size of there data

types.

Page 20: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 20/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

5.RECORD POINTER: This is special feature which is provided by FoxPro to indicate the current control on the

record. This is helpful to make any operation on the specific record such as to display, to edit, to view. We can

move the record pointer in forward or backward position to make any changes.

GOTO: This command is used to move pointer on any record specified in the command. Then we can see thelocation of pointer using browse command a arrow is used to indicate the position of the pointer.

Page 21: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 21/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

 SKIP: This is also used to move record pointer in some specific steps in the forward

direction

Page 22: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 22/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Page 23: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 23/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

BROWSE: This command is used to view the record of table in tabular form. It also display record pointer’s

current position.

Page 24: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 24/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. Give a brief idea about the following commands :

a. Display

(i) Display Next

(ii) Display Rest

(iii) Display All

b. List

(i) List

(ii) List Field

(iii) List For

(iv) List Off 

c. Edit

(i) Edit

(ii) Edit For

d. Modify Structure

e. Record Pointer

f. Goto

g. Skip

h. Browse

Page 25: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 25/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 4 Date__/__/_____ 

AIM Removing data from Databases: To familiarize with the operation which are doneto remove data from tables 

Objective: To use commands to delete data from tables. Fox provide various commands to mark record for

deleting, recovering records & permanent deleting.

1. 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.

2. 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.

Page 26: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 26/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

3. 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.

REPPLACE: This command is used to make changes in the field values it is kind of editing operation. We can

specify some column name and corresponding value to be changed.

Page 27: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 27/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. How can you delete a record from a table ?

2. What is the command for permanent deletion of the particular record from the table ?

3. For what purpose the command "RECALL" is used ?

4. For what purpose the command "REPLACE" is used ?

Page 28: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 28/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 5 Date__/__/_____ 

AIM Managing Databases: To manage database entries in ascending / descendingorder and assigning some index value so that record can be identified easily andsearched at fast speed.

Objective: To use sorting and indexing command available 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.

Page 29: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 29/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

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.

Page 30: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 30/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. By which command you can manage database entries in ascending / descending order ?

2. For what purpose the command "INDEX" is used ?

3. On which table is the value of INDEX stored?

4. Give syntax for the INDEX command.

Page 31: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 31/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 6 Date__/__/_____

AIM Searching for the record in the Database: To use the operation of locate to searchrecord in the record. 

Objective: To use searching records using locate.

LOCATE: This command is used to search a particular record based on some condition.

It has various options which are given below.

Page 32: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 32/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. Which command helps you in searching the records?

2. Give syntax for the specified command.

3. What are the various options you could use on it?

Page 33: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 33/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 7 Date__/__/_____ 

AIM Introduction to COBOL 

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

Page 34: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 34/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

  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

  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.

Page 35: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 35/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

COBOL coding sheet:

Page 36: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 36/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

 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;

Page 37: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 37/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

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.

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 PcostCOMPUTE B = Pcost * A.

Page 38: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 38/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

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:

IDENTIFICATION DIVISION.

PROGRAM-ID. NameOfProgram.

[AUTHOR. YourName.]

other entries here

Page 39: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 39/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

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 dependant 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 WORKING-STORAGE 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.

Page 40: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 40/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

QUESTIONS FOR VIVA

1. What does COBOL stands for ?

2. Give the structure of COBOL program.

3. What is the disadvantage of COBOL which OO-COBOL has eliminated.

4. What is the hardware platform to which COBOL has been ported to?

5. When was COBOL developed and by whom?

6. What does divison,section,paragraph mean in COBOL ?

7. What are the four divisons of COBOL ?

Page 41: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 41/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 8 Date__/__/_____ 

AIM Program for addition of two numbers.

Program for addition of two numbers.

IDENTIFICATION DIVISION.

PROGRAM-ID. ADDM.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 B PIC IS 99.

01 C PIC IS 999.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR ADDITION OF TWO NUMBERS.".

DISPLAY "************************************* ".

DISPLAY "ENTER FIRST NUMBER: ".

ACCEPT A.

DISPLAY "ENTER SECOND NUMBER: ".

ACCEPT B.

ADD A B GIVING C.

DISPLAY "RESULT IS: " C.

Page 42: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 42/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

OUTPUT:

Page 43: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 43/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 9 Date__/__/_____ 

AIM Program for subtraction of two numbers.

Program for subtraction of two numbers.

IDENTIFICATION DIVISION.

PROGRAM-ID. SUB1.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 B PIC IS 99.

01 C PIC IS 99.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR SUBTRACTION OF TWO NUMBERS.".

DISPLAY "************************************* ".

DISPLAY "ENTER 1ST NO: ".

ACCEPT A.

DISPLAY "ENTER 2ND NO: ".

ACCEPT B.

SUBTRACT B FROM A GIVING C.

DISPLAY "RESULT IS: " C.

DISPLAY "*********** END OF PROGRAM ***********".

Page 44: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 44/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

STOP RUN.

OUTPUT:

Page 45: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 45/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 10 Date__/__/_____ 

AIM Program for multiplication of two numbers.

Program for multiplication of two numbers.

IDENTIFICATION DIVISION. 

PROGRAM-ID. MULM.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 B PIC IS 99.

01 C PIC IS 999.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR MULTIPLICATION OF TWO NUMBERS.".

DISPLAY "************************************* ".

DISPLAY "ENTER 1ST NO: ".

ACCEPT A.

DISPLAY "ENTER 2ND NO: ".

ACCEPT B.

MULTIPLY B BY A GIVING C.

DISPLAY "RESULT IS: " C.

DISPLAY "*********** END OF PROGRAM ***********".

Page 46: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 46/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

STOP RUN.

OUTPUT:

Page 47: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 47/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 11 Date__/__/_____ 

AIM Program for Division of two numbers.

Program for Division of two numbers.

IDENTIFICATION DIVISION.

PROGRAM-ID. DIVM.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 B PIC IS 99.

01 C PIC IS 99.

01 D PIC IS 99.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR DIVISION OF TWO NUMBERS.".

DISPLAY "************************************* ".

DISPLAY "ENTER FIRST NO: ".

ACCEPT A.

DISPLAY "ENTER SECOND NO: ".

ACCEPT B.

DIVIDE A INTO B GIVING C REMAINDER D.

DISPLAY "RESULT IS: " C.

DISPLAY "REMAINDER IS: " D.

Page 48: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 48/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

OUTPUT:

Page 49: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 49/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 12 Date__/__/_____ 

AIM Program for all arithmetic operation between two numbers.

IDENTIFICATION DIVISION. 

PROGRAM-ID. AD1.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 999.

01 B PIC IS 999.

01 C PIC IS 999.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "************************************* ".

DISPLAY "ENTER 1ST NO = ".

ACCEPT A.

DISPLAY "ENTER 2ND NO = ".

ACCEPT B.

SUBTRACT B FROM A GIVING C.

DISPLAY "SUBTRACTION = " C.

ADD B A GIVING C.

DISPLAY "ADDITION = " C.

DIVIDE A BY B GIVING C.

DISPLAY "DIVISION = " C.

MULTIPLY B BY A GIVING C.

DISPLAY "MULTIPLICATION = " C.

Page 50: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 50/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

DISPLAY "************************************* ".

STOP RUN.

Output: 

Page 51: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 51/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 13 Date__/__/_____ 

AIM Program for checking a number is Even or odd.

Program for checking a number is Even or odd.

IDENTIFICATION DIVISION.

PROGRAM-ID. EVOD.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 C PIC IS 99.

01 D PIC IS 99.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR CHECKING A NO. IS EVEN OR ODD.".

DISPLAY "************************************* ".

DISPLAY "PLZ ENTER A NUMBER: ".

ACCEPT A.

DIVIDE A BY 2 GIVING C REMAINDER D.

IF D=0 DISPLAY "NUMBER IS EVEN.".

IF D NOT = 0 DISPLAY "NUMBER IS ODD. ".

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

Page 52: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 52/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Output:

Page 53: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 53/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 14 Date__/__/_____ 

AIM PROGRAM FOR FINDING GREATER BETWEEN TWO NUMBERS.

PROGRAM FOR FINDING GREATER BETWEEN TWO NUMBERS.

IDENTIFICATION DIVISION.

PROGRAM-ID. IFM.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 99.

01 B PIC IS 99.

01 C PIC IS 999.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR FINDING GREATER BETWEEN TWO NUMBERS.".

DISPLAY "************************************* ".

DISPLAY "ENTER 1ST NO: ".

ACCEPT A.

DISPLAY "ENTER 2ND NO: ".

ACCEPT B.

IF A>B DISPLAY "A IS GREATER.".

IF B>A DISPLAY "B IS GREATER.".

Page 54: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 54/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

Output:

Page 55: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 55/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 15 Date__/__/_____ 

AIM PROGRAM USING PERFORM CLAUSE.

PROGRAM USING PERFORM CLAUSE.

IDENTIFICATION DIVISION.

PROGRAM-ID. PRFM.

ENVIRONMENT DIVISION.

DATA DIVISION.

PROCEDURE DIVISION.

TOPLEVEL.

DISPLAY "PROGRAM USING PERFORM CLAUSE.".

DISPLAY "************************************* ".

DISPLAY "HIIIIIIII".

PERFORM MIDDLELEVEL 2 TIMES.

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

MIDDLELEVEL.

DISPLAY "R U THERE.".

PERFORM BOTTOMLEVEL 3 TIMES.

BOTTOMLEVEL.

DISPLAY "HOW R U?? ".

Page 56: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 56/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Output:

Page 57: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 57/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 16 Date__/__/_____ 

AIM PROGRAM FOR CONVERSION OF TEMPRATURE:

IDENTIFICATION DIVISION. 

PROGRAM-ID. CTOF.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 C PIC IS 99.

01 F PIC IS 99.

01 R PIC IS 999V99.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "PROGRAM FOR CONVERSION OF TEMPRATURE.".

DISPLAY "************************************* ".

DISPLAY "CELSIUS TO FAHRENHEIT...".

DISPLAY "ENTER TEMP. IN CELSIUS: ".

ACCEPT C.

COMPUTE R = 1.8 * C + 32.

DISPLAY "RESULT IS: " R.

DISPLAY " ".

DISPLAY "FAHRENHEIT TO CELSIUS...".

DISPLAY "ENTER TEMP. IN FAHRENHEIT: ".

ACCEPT F.

COMPUTE R = 0.55 * F - 32.

DISPLAY "RESULT IS: " R.

DISPLAY "*********** END OF PROGRAM ***********".

STOP RUN.

Page 58: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 58/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Output:

Page 59: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 59/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 17 Date__/__/_____ 

AIM PROGRAM TO DESIGN CALCULATOR IN COBOL

PROGRAM TO DESIGN CALCULATOR IN COBOL.

IDENTIFICATION DIVISION.

PROGRAM-ID. AD1.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 A PIC IS 999.

01 B PIC IS 999.

01 C PIC IS 999.

01 OP PIC IS X.

PROCEDURE DIVISION.

MAIN-PARA.

DISPLAY "CALCULATOR IN COBOL.".

DISPLAY "*************************************** ".

DISPLAY "ENTER 1ST NO = ".

ACCEPT A.

DISPLAY "ENTER 2ND NO = ".

ACCEPT B.

DISPLAY "ENTER OPERATOR SYMBOL = ".

ACCEPT OP.

IF OP='-'

SUBTRACT B FROM A GIVING C;

DISPLAY "SUBTRACTION = " C.

IF OP='+'

ADD A B GIVING C;

Page 60: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 60/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

DISPLAY "ADDITION = " C.

IF OP='/'

DIVIDE A BY B GIVING C;

DISPLAY "DIVISION = " C.

IF OP='*'

MULTIPLY B BY A GIVING C;

DISPLAY "MULTIPLICATION = " C.

DISPLAY "*********** END OF PROGRAM ************* ".

STOP RUN.

Page 61: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 61/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Output:

Page 62: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 62/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Experiment No 18 Date__/__/_____ 

AIM Introduction to different word processors and their features.

Introduction to different word processors and their features.

Word processing refers to the computer system that helps us to type, edit, store and print documents. Word

processor produces well looking documents as compare to a type writer. Which are very accurate and take less

time. Word processing can be defined as methods of translating ideas into words, putting the words into written

form and producing document through the use of automated equipment.

Software packages as word processors are:

MS-WORD, WORD STAR, WORD PERFECT.

Word processors helps to perform jobs such as letter drafting, mailing lists, producing reports etc.

It is very useful in Business Environment.

It is easy to use, fast and accurate.

Features of Word processor:-

Word wrapping:- Word processor will automatically take you to the next line depending on the width of the line

and accordingly arrange the text also.

Add or Delete text:- Text can be added or deleted from a document from a document very easily.

Select blocks of text:-Word processor allows you to copy or move text from one place to another. But before

copying the text one has to select it.

Page 63: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 63/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Copying a text:- You can copy text from one part o the document to other.

Moving a text:- Moving a text means copying the selected text to another place and removing it from the

original place.

Find and Replace:- find and replace used to find any character or word in the document or to replace some

character with other character.

Easier formatting:- Word offers great new ways to polish the formatting in your document. It includescharacter formatting, page formatting, margin setting, line spacing and justification of text.

Improved table and list formatting:- Word now offers drag and drop copying of tables, custom tables and

list styles, and improved sorting. You can also format bullets or number differently than the text in a list.

Multi-selection:- You can select noncontiguous areas of a document, which makes it easy to format text in

different places. You can also use the find feature to select and format similar text.

More convenient word count:- By using the “word count toolbar” you can check the current word count

document without heaving to repeatedly open the “Word Count Dialog Box”.  

Simplified mail merge:- Word takes advantage o the task pane to deliver a brand new way to connect to your

data source and create from letters, mailing labels, envelops, directories, and mass e-mail and fax distributions.

The Mail Merge Wizard is easy to use but still offers rich, advanced functionality.

Drawing Canvas:-The new Drawing Canvas helps you easily insert position, layers and resize drawing object in

your documents.

Page 64: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 64/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

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

Improved watermarks:- You can easily select a picture, logo, or custom text to apply as the background for your

printed document.

Checking a document:- It includes

Grammar check:- Grammatical error checking is done.

Thesaurus :- Adds variety to the document by suggesting alternative words and also suggest

opposite meanings.

Spell check:- Spelling errors are located and rectified.

Page 65: IBS Lab 2012

8/2/2019 IBS Lab 2012

http://slidepdf.com/reader/full/ibs-lab-2012 65/65

GGS COLLEGE OF MODERN TECHNOLOGY, KHARAR IBS LAB

Printing:- Word processor allows you to print your documents. It also permits background printing while editing

a file. It has the capability of printing multiple copies of the same documents.

QUESTIONS FOR VIVA

1. What does word processing stands for?

2. Give name of different types of word processsors.

3. What are the features of word processor?