Ibs Lab File
-
Upload
karan-kochar -
Category
Documents
-
view
231 -
download
0
Transcript of Ibs Lab File
-
8/2/2019 Ibs Lab File
1/41
1
PRACTICAL NO- 1
Introduction to FoxPro
Visual FoxPro is a data-centric object-oriented and procedural programminglanguage 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 furtherfeatures 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 wereWindows-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 supportSQL 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 middlewareand web applications
Starting of FoxPro:
http://en.wikipedia.org/wiki/Object-orientedhttp://en.wikipedia.org/wiki/Procedural_programminghttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/FoxPro_2http://en.wikipedia.org/wiki/FoxPro_2http://en.wikipedia.org/wiki/Mac_OShttp://en.wikipedia.org/wiki/DOShttp://en.wikipedia.org/wiki/Microsoft_Windowshttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Component_Object_Modelhttp://en.wikipedia.org/wiki/Microsoft_.NEThttp://en.wikipedia.org/wiki/XBasehttp://en.wikipedia.org/wiki/DBASEhttp://en.wikipedia.org/wiki/Clipper_programming_languagehttp://en.wikipedia.org/w/index.php?title=Recital_%28database%29&action=edit&redlink=1http://en.wikipedia.org/wiki/DBASEhttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/Database_management_systemshttp://en.wikipedia.org/wiki/Dynamic_programming_languagehttp://en.wikipedia.org/wiki/Fat_clienthttp://en.wikipedia.org/wiki/Middlewarehttp://en.wikipedia.org/wiki/Web_applicationhttp://en.wikipedia.org/wiki/Web_applicationhttp://en.wikipedia.org/wiki/Middlewarehttp://en.wikipedia.org/wiki/Fat_clienthttp://en.wikipedia.org/wiki/Dynamic_programming_languagehttp://en.wikipedia.org/wiki/Database_management_systemshttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/DBASEhttp://en.wikipedia.org/w/index.php?title=Recital_%28database%29&action=edit&redlink=1http://en.wikipedia.org/wiki/Clipper_programming_languagehttp://en.wikipedia.org/wiki/DBASEhttp://en.wikipedia.org/wiki/XBasehttp://en.wikipedia.org/wiki/Microsoft_.NEThttp://en.wikipedia.org/wiki/Component_Object_Modelhttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Microsoft_Windowshttp://en.wikipedia.org/wiki/DOShttp://en.wikipedia.org/wiki/Mac_OShttp://en.wikipedia.org/wiki/FoxPro_2http://en.wikipedia.org/wiki/FoxPro_2http://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Procedural_programminghttp://en.wikipedia.org/wiki/Object-oriented -
8/2/2019 Ibs Lab File
2/41
2
Features
In FoxPro we can link up multiple databases to give rise to pyramidalstructure of database.
Queries can be made on a single or multiple databases being grouped by afield sorted on the fields meeting user defined criteria. We can generate reports with fields of choice from a single or multipledatabases grouped by some column with suitable headings. We can make use of view window to view selected fields from single ormultiple databases.
We can design customized screens with FoxPro screen designer. We cansave this and retrieve respectively next time.
We can generate our own applications and projects with FoxProapplication 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 basessome 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 handlevery large data
-
8/2/2019 Ibs Lab File
3/41
3
PRACTICAL NO- 2
Aim: Understanding data bases: In this practical we will discuss
various components of FoxPro.
Objectives: Familiarization with Database and various components.
Data Base: It is defined as large collection of coherent, meaningful & interrelateddata 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 & sharedby multiple users. A data base contains number of tables.
Tables: A table is a database object that holds users data. It consists of rows andcolumns. 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 anentity. A row makes a record.
FoxPro main Window:
-
8/2/2019 Ibs Lab File
4/41
4
FoxPro window description
View Window: It is used to see the content of tables or the results of querieswhich 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 accessinformation from the labels. This window can be moved to any place in mainwindow and can be resized.
Menu Bar: This bar conation various menu items (e.g. 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. Theprocedure 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 newfile. A create dialog box will appear. Then enter the table name and click on save.
-
8/2/2019 Ibs Lab File
5/41
5
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 willappear which will ask to enter entries at that time or later click yes to enter entries.
-
8/2/2019 Ibs Lab File
6/41
6
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.
-
8/2/2019 Ibs Lab File
7/41
7
PRACTICAL NO- 3
Aim: Retrieving & Editing Databases: Toaccess record from FoxPro &
view specific information from specific tables.
Objective: To use the commands related to access & view records from FoxProtables. We have following commands.
1. Display:This command is used to display the current record which is pointedby record pointer.
1.1 DISPLAY: This command displays single record which is pointed by recordpointer.
-
8/2/2019 Ibs Lab File
8/41
8
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.
1.4 DISPLAY ALL: This command is used to display the all record in the specifiedtable. 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.
-
8/2/2019 Ibs Lab File
9/41
9
2. LIST: This command is used to display record in a table. It has variousoptions 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 doesnt have option like in displayall command to continue show of record in next window.
-
8/2/2019 Ibs Lab File
10/41
10
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.
-
8/2/2019 Ibs Lab File
11/41
11
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 desirablesome 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.
-
8/2/2019 Ibs Lab File
12/41
12
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 inthe 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.
-
8/2/2019 Ibs Lab File
13/41
13
5. RECORD POINTER: This is special feature which is provided by FoxProto 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 recordpointer 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 the location of pointer using browse command a arrowis used to indicate the position of the pointer.
-
8/2/2019 Ibs Lab File
14/41
14
SKIP:This is also used to move record pointer in some specific steps in theforward direction.
-
8/2/2019 Ibs Lab File
15/41
15
-
8/2/2019 Ibs Lab File
16/41
16
BROWSE:This command is used to view the record of table in tabular form. It
also displays record pointers current position.
-
8/2/2019 Ibs Lab File
17/41
17
PRACTICAL NO- 4
Aim: Removing data from Databases:To familiarize with the operation
which are done to remove data from tables.
Objective: To use commands to delete data from tables. Fox provide variouscommands 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 wehave marked any wrong record then this command can recover that record.
-
8/2/2019 Ibs Lab File
18/41
18
3. PACK: This command is use to delete only those records permanently which aremarked for deletion. If we execute this command than that record can never be
recovered.
4. REPLACE: This command is used to make changes in the field values it is
kind of editing operation. We can specify some column name and correspondingvalue to be changed.
-
8/2/2019 Ibs Lab File
19/41
19
PRACTICAL NO-5
Aim: Managing Databases:To manage database entries in ascending /
descending order and assigning some index value so that record can beidentified easily and searched 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.
-
8/2/2019 Ibs Lab File
20/41
20
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.
-
8/2/2019 Ibs Lab File
21/41
21
PRACTICAL NO- 6
Aim: Searching for the record in the Database: To use the operation
of locate to search record 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.
-
8/2/2019 Ibs Lab File
22/41
22
PRACTICAL NO- 7
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 computerprofessionals 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 publishedstill 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 COBOL97, 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 aresult, 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 tounderstand when you come back to them six months later.
COBOLis 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 itslimitations, 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 nowincludes -
http://en.wikipedia.org/wiki/CODASYLhttp://en.wikipedia.org/wiki/CODASYL -
8/2/2019 Ibs Lab File
23/41
23
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 TypesCOBOL 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 everyhardware 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 theprogram 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 theEnvironment Division.
-
8/2/2019 Ibs Lab File
24/41
24
COBOL coding sheet:
-
8/2/2019 Ibs Lab File
25/41
25
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 andStatements.
A Division may contain one or more Sections, Section one or more Paragraphs,
Paragraph one or more Sentences and 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 startswhere the division name is encountered and ends with the beginning of the nextdivision or with the end of the program text.
Sections:
A section is a block of code usually containing one or more paragraphs. A section
-
8/2/2019 Ibs Lab File
26/41
26
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 statementsA 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.
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.
-
8/2/2019 Ibs Lab File
27/41
27
1. IDENTIFICATION DIVISION:
The IDENTIFICATION DIVISION supplies information about the program to theprogrammer and the compiler.
The IDENTIFICATION DIVISION has the following structure: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 dependant upon a specific computer, device
or encoding sequence. In the ENVIRONMENT DIVISION, aliases are assigned toexternal 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:
-
8/2/2019 Ibs Lab File
28/41
28
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.
-
8/2/2019 Ibs Lab File
29/41
29
PRACTICAL NO- 8
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.
DISPLAY "*********** END OF PROGRAM ***********".
STOP RUN.
Out put:
-
8/2/2019 Ibs Lab File
30/41
30
PRACTICAL NO- 9
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 ***********".
STOP RUN.
Output:
-
8/2/2019 Ibs Lab File
31/41
31
PRACTICAL NO- 10
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 ***********".
STOP RUN.
Output:
-
8/2/2019 Ibs Lab File
32/41
32
PRACTICAL NO- 11
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.
DISPLAY "*********** END OF PROGRAM ***********".
STOP RUN.
Output:
-
8/2/2019 Ibs Lab File
33/41
33
PRACTICAL NO- 12
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.
Output:
-
8/2/2019 Ibs Lab File
34/41
34
PRACTICAL NO- 13
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.
Output:
-
8/2/2019 Ibs Lab File
35/41
35
PRACTICAL NO- 14
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.
STOP RUN.
BOTTOMLEVEL.
DISPLAY "HOW R U?? ".
Output:
-
8/2/2019 Ibs Lab File
36/41
36
PRACTICAL NO- 15
PROGRAM FOR DEMONSTRATING THE USE OF
PERFORMTIMES COMMAND
IDENTIFICATION DIVISION.
PROGRAM-ID. PerformFormat2.
DATA DIVISION.WORKING-STORAGE SECTION.
01 NumofTimes PIC 9 VALUE 5.
PROCEDURE DIVISION.Begin.
DISPLAY "Starting to run program"
PERFORM 3 TIMES
DISPLAY ">>>>This is an in line Perform"END-PERFORM
DISPLAY "Finished in line Perform"
PERFORM OutOfLineEG NumOfTimes TIMESDISPLAY "Back in Begin. About to Stop".
STOP RUN.
OutOfLineEG.
DISPLAY ">>>> This is an out of line Perform".
-
8/2/2019 Ibs Lab File
37/41
37
PRACTICAL NO- 16
PROGRAM FOR DEMONSTRATING THE USE OF
PERFORMUNTIL COMMAND
IDENTIFICATION DIVISION.
PROGRAM-ID. PerformFormat3.DATA DIVISION.
WORKING-STORAGE SECTION.
01 IterCount PIC 99 VALUE ZEROS.
88 MaxCountReached VALUE 99.01 UserInput PIC 99 VALUE ZEROS.
88 EndOfUserInput VALUE ZEROS.
01 RunningTotal PIC 999 VALUE ZEROS.
01 AverageValue PIC 99 VALUES ZEROS.
PROCEDURE DIVISION.Begin.
PERFORM UNTIL IterCount = 5
DISPLAY "IterCount = " IterCountADD 1 TO IterCount
END-PERFORM
DISPLAY "Finished in line Perform."
INITIALIZE Itercount
DISPLAY "Enter a stream of up to 99 numbers."DISPLAY "Each number must be in the range 1-99. Enter 0 to stop."
DISPLAY "Enter number :- " WITH NO ADVANCING
ACCEPT UserInputPERFORM GetUserInput UNTIL EndOfUserInput OR MaxCountReached
DISPLAY "The final total is - " RunningTotal
DISPLAY "The final count is - " IterCount
COMPUTE AverageValue = RunningTotal / IterCountDISPLAY "The average value entered is - " AverageValue
STOP RUN.
GetUserInput.
ADD UserInput TO RunningTotalON SIZE ERROR DISPLAY "Error - new total too large for data-item."
NOT ON SIZE ERROR ADD 1 TO IterCount END-ADD
END-ADD
-
8/2/2019 Ibs Lab File
38/41
38
DISPLAY "Total so far is - " RunningTotal
DISPLAY "Count so far is - " IterCountDISPLAY "Enter number :- " WITH NO ADVANCING
ACCEPT UserInput.
-
8/2/2019 Ibs Lab File
39/41
39
PRACTICAL NO -17
PROGRAM TO IMPLEMENT CALCULATOR IN COBOL.
IDENTIFICATION DIVISION.
PROGRAM-ID.CALENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.A PIC 99
B PIC 99
C PIC 99
OPERATOR PIC XPROCEDURE DIVISION.
DISPLAY ENTER IST NUMBER
ACCEPT A
DISPLAY ENTER 2NDNUMBERACCEPT B
DISPLAY ENTER THE OPERATOR +, - , * , /
IF OP=+THEN
ADD A TO B GIVING C
IF OP=-
THEN
SUBTRACT A FROM B GIVING C
IF OP=*THEN
MULTIPLY ABYB GIVING C
IF OP=/
THEN
DIVIDE ABYB GIVING C
DISPLAY RESULT IS C.
DISPLAY "*********** END OF PROGRAM ***********".
STOP RUN.
-
8/2/2019 Ibs Lab File
40/41
40
PRACTICAL NO -18
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 bedefined 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 adocument very easily.
Select blocks of text:-Word processor allows you to copy or move text from oneplace to another. But before copying the text one has to select it.
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 includes character 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.
-
8/2/2019 Ibs Lab File
41/41
Multi-selection:- You can select noncontiguous areas of a document, which makesit 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 checkthe current word count document without heaving to repeatedly open the WordCount 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 MergeWizard 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.
Diagramming:- You can add variety of diagrams using the diagramming tools on
the drawing toolbar.
Diagram (Radial type)
Diagram toolbarDrawing sizing handle
Drawing border
Improved watermarks:- You can easily select a picture, logo, or custom text toapply 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 wordsand also suggest opposite meanings.
Spell check:- Spelling errors are located and rectified.
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.