PRACTICAL FILE Department: Computer Science and Engineering Session: January - June Subject: Business System Subject Code: CS-320 Semester: 6 th
PRACTICAL
FILE
Department: Computer Science and Engineering
Session: January - June
Subject: Business System
Subject Code: CS-320
Semester: 6th
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
1· Laboratory exercises covering usage of COBOL for handling indexed sequential
and relative files.
2. COBOL screen management report management and report writing facilities.
3· Lab Experiments on data management packaged like DBASE, FoxPro.
4. Usage of Word processor.
Syllabus
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
Sr. No. Topic
1. Laboratory exercises
covering usage of COBOL
for handling indexed
sequential and relative
files.
2. COBOL screen
management report
management and report
writing facilities.
3. Lab Experiments on data
management packaged like
DBASE, FoxPro.
4. Usage of Word processor.
5. *Program to enter name
,DOB,age of a person
6. *Program to enter the marks
of student then calculate
their marks.
*Learning Beyond Syllabus Program to enter name ,DOB,age of a person.
*Learning Beyond Syllabus Program to enter the marks of student then calculate their
marks.
List of Practical
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM :- Laboratory exercises covering usage of COBOL for handling
indexed sequential and relative files.
PROGRAM:-
1) INDEX FILES:-
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTCOBL.
AUTHOR. TESTTEST.
DATE-WRITTEN. 19-NOV-2010.
DATE-COMPILED.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT WS-INFILE ASSIGN TO INFILE
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS INP-EMPID
FILE STATUS IS WS-INFILE-SW.
DATA DIVISION.
FILE SECTION.
FD WS-INFILE.
01 INP-EMP-REC.
Practical - 1
05 INP-EMPID PIC X(05).
05 INP-EMPNAME PIC X(12).
05 INP-EMP-LOB PIC X(03).
WORKING-STORAGE SECTION.
01 WS-INFILE-SW PIC X(02) VALUE SPACES.
88 WS-INFILE-SUCESS VALUE '00'.
88 WS-INFILE-EOF VALUE '10'.
01 WS-INP-EMP-REC PIC X(20).
01 WS-EOF-SW PIC X(01) VALUE 'N'.
88 WS-EOF-NO VALUE 'N'.
88 WS-EOF-YES VALUE 'Y'.
PROCEDURE DIVISION.
A1000-MAIN-PARA.
PERFORM A2000-OPEN-PARA THRU A200-EXIT.
PERFORM A3000-INPUT-PARA THRU A300-EXIT.
PERFORM A4000-INSERT-PARA THRU A400-EXIT.
PERFORM A5000-CLOSE-PARA THRU A500-EXIT.
STOP RUN.
A100-EXIT.
EXIT.
A2000-OPEN-PARA.
INITIALIZE WS-INFILE-SW WS-INP-EMP-REC WS-EOF-SW.
OPEN OUTPUT WS-INFILE.
IF WS-INFILE-SUCESS
DISPLAY "FILE OPEN SUCCESSFUL"
ELSE
DISPLAY "FILE OPENING ERROR"
GO TO A100-EXIT
END-IF.
A200-EXIT.
EXIT.
A3000-INPUT-PARA.
ACCEPT WS-INP-EMP-REC.
DISPLAY WS-INP-EMP-REC.
A300-EXIT.
EXIT.
A4000-INSERT-PARA.
WRITE INP-EMP-REC FROM WS-INP-EMP-REC.
A400-EXIT.
EXIT.
A5000-CLOSE-PARA.
CLOSE WS-INFILE.
A500-EXIT.
EXIT.
2). RELATIVE FILE:-
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTCOBL.
AUTHOR. TESTTEST.
DATE-WRITTEN. 19-NOV-2010.
DATE-COMPILED.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT WS-INFILE ASSIGN TO INFILE
ORGANIZATION IS RELATIVE
ACCESS MODE IS RANDOM
RELATIVE KEY IS RELKEY
FILE STATUS IS WS-INFILE-SW.
DATA DIVISION.
FILE SECTION.
FD WS-INFILE.
01 INP-EMP-REC.
05 INP-EMPID PIC X(05).
05 INP-EMPNAME PIC X(12).
05 INP-EMP-LOB PIC X(03).
WORKING-STORAGE SECTION.
01 WS-INFILE-SW PIC X(02) VALUE SPACES.
88 WS-INFILE-SUCESS VALUE '00'.
88 WS-INFILE-EOF VALUE '10'.
01 WS-INP-EMP-REC PIC X(20).
01 RELKEY PIC 9(02).
PROCEDURE DIVISION.
A1000-MAIN-PARA.
PERFORM A2000-OPEN-PARA THRU A200-EXIT.
PERFORM A3000-INPUT-PARA THRU A300-EXIT.
PERFORM A4000-INSERT-PARA THRU A400-EXIT.
PERFORM A5000-CLOSE-PARA THRU A500-EXIT.
STOP RUN.
A100-EXIT.
EXIT.
A2000-OPEN-PARA.
INITIALIZE WS-INFILE-SW WS-INP-EMP-REC.
OPEN OUTPUT WS-INFILE.
IF WS-INFILE-SUCESS
DISPLAY "FILE OPEN SUCCESSFUL"
ELSE
DISPLAY "FILE OPENING ERROR"
GO TO A100-EXIT
END-IF.
A200-EXIT.
EXIT.
A3000-INPUT-PARA.
ACCEPT WS-INP-EMP-REC.
DISPLAY WS-INP-EMP-REC.
A300-EXIT.
EXIT.
A4000-INSERT-PARA.
WRITE INP-EMP-REC FROM WS-INP-EMP-REC.
A400-EXIT.
EXIT.
A5000-CLOSE-PARA.
CLOSE WS-INFILE.
A500-EXIT.
EXIT.
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM:- COBOL screen management report management and report writing
facilities.
PROGRAM:-
IDENTIFICATION DIVISION.
PROGRAM-ID. HORO.
ENVIRONMENT DIVISION.
DATA DIVISION.
SCREEN SECTION.
01 CLEAN-SLATE.
05 BLANK SCREEN.
01 MY-SCREEN.
05 LINE 2 COLUMN 10 VALUE " HELLO SSIET " HIGHLIGHT.
05 LINE 5 COLUMN 12 VALUE " HELLO SSIET " BLINK.
05 LINE 8 COLUMN 19 VALUE " HELLO SSIET " REVERSE-VIDEO.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY CLEAN-SLATE.
DISPLAY MY-SCREEN.
STOP RUN.
Practical 2
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM:- Lab Experiments on data management packaged like DBASE, FoxPro.
Definition:-
DBase is a microcomputer database management system (DBMS) that runs on a
Windows platform. DBase is unique in that it allows for the hassle-free production
of a wide variety of applications, including middleware applications, Web apps
hosted on Windows servers and Windows rich client applications.
DBase is designed to manipulate relational databases. It is a versatile third-
generation language with non-procedural capability and is a very good debugger.
Data storage in DBase format is widely accepted and supported by numerous
database management systems. DBase uses procedural functions and commands
similar to the BASIC language. It uses simple commands for data manipulation
like USE and GO TOP to traverse records, STR() and SUBSTR() for string
manipulation, and REPLACE AND STORE for field value manipulation. Other
commands like STORE, DO, APPEND, and MODIFY are also used. The
underlying file format of DBase is .dbf.
DBase has many outstanding features that contribute to its prominence among
database management systems and tools, such as:
A just in time (JIT) compiler, which converts the source language into
machine language
A linker to create DBase applications (.exe files)
A runtime engine installer for Web servers and machines that need to
execute DBase runtime applications
Preprocessors for reading the program source file and producing
preprocessed files as output, which is fed into the compiler
An integrated development environment with a command window and
navigator
Two-way graphical user interface (GUI) design tools, which possess the
ability to switch back and forth between using a GUI design tool and a code
editor
A source code editor, which allows for the manual editing and entry of codes
Practical 3
DBase also has many visual classes and database classes. Visual classes include:
PushButton
Image
Grid
Scroll Bar
ActiveX
Report
ReportViewer
SpinBox
ComboBox
ListBox
Text
TextLabel
Form
SubForm
Notebook
Container
Entry field
RadioButton
Database classes include:
RowSet
Field
StoredProc
Datamodule
Session
Database
Introduction of FoxPro:-
FoxPro is a programming language. FoxPro is 4 GL language is used very
easy & very to learn. It is simple language because number of English word as
code in a FoxPro. FoxPro is used to create database table or database management
system. Father of FoxPro is Ashito Tate. FoxPro is developed in 1979- 1980.
FoxPro is two versions.
Ex: - 1) Database II,
2) Database III developed in 1984.
3) Database III+.
FoxPro is one of the leading DBMS(Database Management System)
software for pc. This is enhanced version of the FoxBASE+ Software
FoxPro is also called RDBMS software.
Extension of FoxPro:-
1) „.txt.‟
2) „.dbf‟
3) „.prg‟
4) „.scr‟
5) „.frx‟
Data types available in FoxPro:-
1. Numeric Numeric datatype is use to store numeric data into a field. We can store 0 to
9 digit, decimal, point and plus or minus sign. A numeric field can hold upto 20
digit wide. A numeric fields can also have a decimal part. The decimal part can
be upto 0 to 18 digit. To store a field like Roll_no, mobile_no, phone_no,
salary, pincode etc numeric field type is used.
2. Float :- Float datatype is similar to numeric. Difference between two is that for
arithmetic calculation numeric datatype is used while float is used for scientific
calculation. It can also hold upto 20 digit wide. We can store 0 to 9 digit,
decimal point and plus or minus sign. To store the fields like Rate, percentage,
average float is commonly used.
3. Character :- Character datatype is use to store string type information. It can store A to
Z , a to z alphabets 0 to 9 digit and underscore with special symbols etc. To
store the fields like name, address, result etc character is used. Character is
default datatype for all the fields. In Character data type we can store upto 254
character. Default size of character is 10 fix.
4. Date :- Date datatype is use to store date in any field. The default format of date is
(mm/dd/yy). The fix length of date is 8.To store the fields like Dob, doj,
ex_date etc date field is used.
5. Logical :- The length of logical field is 1. we can store „T‟ or F‟ or „Y‟ or „N‟ in
logical field. ‟T‟ or „Y‟ for true and „F‟ and „N‟ for False. To store the
information like pass/fail, absent/present etc. logical field type is used.
FoxPro based upon two versions.
1. Windows based FoxPro.
2. Dos Based FoxPro.
Fox Pro Command
1) Create: -
Create command is used to create a new database file in FoxPro. To
create database file structure defining create file to store specific information and
maintain FoxPro defined the structure to store information structure define it also
how many fill file. What is length of data how information will be store?
Syntax: - Create < File Name>.
Ex: - Create Student.
2) Locate: -
Locate is a FoxPro command this is used to find out the record form
file.
Locate searches the information from specified field of database file.
Ex: -Locate for city = “Beed”
FoxPro searches the city Beed it the Beed has found it will display the
contain of search record. Specifies the multiple conditions with command you can
locate record with city Beed & pin code number.
Ex: -Locate for city = “Beed”. and.pin =431122
Locate for Name = “Shubham”
It display the record Shubham in the field name “end of locate scope “.
It could searches the record the contain Shubham in the field.
3) Browse : -
Browse is different edit & change it display the record in horizontal
table each record occupy one record on the table when your database table does not
content many fields. Browse may be more efficient that edit or change the record.
If you want to change the record you more to the position & carry out editing „shift
+ Tab‟ move one field to another field.
Ex: - Use Address.
Browse field city, Pin code.
When you want to new record we can use the „Ctrl + T‟ delete the record
form browse menu. With indicated dot for the delete record.
Browse for city “Pune”
These commands record that content pune.
Browse next file
Display the next 5 Record.
4) Edit or Change: -
Edit is a FoxPro command it provide the change in the
data you change the data modify the data were you have need that some mistake
in data you may to need correct it.
FoxPro display first few records on the first field or first record FoxPro use
75% of Window for edit purpose.
Editing the data field in very simple move the circular then change data by
using delete key, Backspace key, various, editing key that you can use to move the
circular position or delete the character 1) Arrow key, 2) Delete Key, 3) Backspace
key, 4) Escape Key, 5) Ctrl + W, 6) Page up & Page down.
Ex: - Edit field Name, City.
If you wish to edit the particular command edit record 5. This command delete
record the person who us Beed city.
Edit for city = “Beed”
If you wish to edit name & city field of record that have so edit field Name, City =
“Delhi”.
5) Label Command : -
FoxPro provides a very powerful facility of designing and
printing of Mailing address label.
Label Command is used for printing of letters; it is achieved by creating and
using labels format file. These format files contain fields as well as these portion in
the mailing address level, that there file will generate in the label format.
The label that you will design has to be saved in a label format file. FoxPro
is user the extension names. LBX for label format files that it creates.
Syntax: - Create Label < Label File Name >
Ex: - Create Label Student.
6) Replace: -
You have to learn edit, change browse the processing making are
changes in very slow process. You need physically select each record before you
can make change the process become cumber son if you have make changes in
several of the database file know assume that bank of India issues and instruction
the reduce the rate of interest all on deposit by one percentage. It is very difficult
task manually change the rate of interest in all record of database file using edit,
change command.
Ex: - Replace all Rates with Rate- 1.
Replace all Rate with 10 for Rate>10.
Replace depositor with “Krushna”
Replace all name with name = “BCA III”.
Replace city with Beed.
Next 5.
7) Delete : -
Delete the record for your current data base. In case of Student
database file way the student for the leave the college then the record is not require
the record remove deleted from the database is the command it can delete for the
database gives the mark of deletion star „*‟ mark display before the record will not
delete permanently. Record are delete temporary.
Ex: - Delete for rate >10.
Delete for rate >10 next 3.
Delete all for rate =10.
Delete Record 4.
8) Pack: -
Pack command is permanently delete the record form the database file
& release the space occupied by display the record after removing delete record it.
Display the message indicating know present in the database file pack command
given after the delete command delete record not be recall.
Ex: - Pack
9) Append: -
Append command is used to add record at end of database file.
After entering data, if we want to add some records then use append command.
Syntax: - Append Command.
However before you can add record to database with append command the
database file must be in use open. Create new record & save the record in your
current file.
10) Recall:-
Recall command is used to recall the deleted record. The recall
command provides another way of recalling record form the command window.
Syntax: - Recall Record Number
Ex: - Use student
Recall Record 4
Recall for Rate>10
Recall for all for rate+20
11) List: -
List command is used to display content of all record on the screen. It
also displays the field names in the first row & recorded numbers on the left each
record.
Syntax: - List.
List for < Filed Name1, Filed Name2 >.
Ex: -List.
12) Accept: -
Accept command is used to display a specified message on the screen
and it also accepts the data entered through the keyboard in a character variable.
The name of the variable that holds the data is specified with Accept.
Ex: - Accept “Enter the student name” to ABC.
After that FoxPro displays a message “Enter the student name” on the screen
and waits for the user to enter data. You can type any name then press the other
key.
13) Input Command: -
Input command is a modified command form Accept
command. Input command displays the specified message on the screen and stores
the entered detain specifies variable.
Ex: - Input “Enter a number” to NVJ
14) Sort : -
Sort command is used to arrange data in Descending & Ascending or
record in specific manner or order.
Syntax: - Sort on < Filed Name > to < New File Name >
Ex: - Index on Name to Student.
15) Index:-
Index is command is used to arrange data or record in specific manner
or ascending order.
Syntax: - Index on < field Name > to same file name >
Ex: - Use Student
Index on Name to Student.
16) Modi Stru : -
Modi stru stand for modify structure. This command used to
create a new database file.
First open the structure database file. Then enter modify structure command
in command window. The FoxPro displays present structure of structure file.
Syntax: - Modi Stru
Ex: - Modi Stru.
17) Modi Comm: -
Modi comm stand for modify command. Modi comm is used
to create a program file or get the program screen.
Syntax: - Modify Command < File Name >
Ex: - Modi Comm Student.
18) Zap: -
Zap command is used to remove all record form the current or active
database file. Zap removes all record permanently form the database. Zap is similar
to delete all followed by pack command.
Ex: - Zap.
19) Clear Command: -
Clear Command is used to clear the background screen,
EX: - Clear.
20) Go to: -
The command is used to position the record pointer at the specified
record in the database file.
Syntax: - Go to Record Number.
Ex: - Go to Record – 6.
21) Find : -
Find command is used to search or find information with the help of
an index file.
You are use the find command and if FoxPro does not find the information in the
database file, if displays a message “No find”.
Ex: - Use Student.
Set Order to City
After that is screen displays record of “Beed” City.
22) Display: -
This is command is used to display information about the current
table in the main visual FoxPro Window or in the user defined window.
Syntax: - Go to Record Number.
Display
23) Seek: -
The seek Command is used to Find Command. It is also used for the
search purpose i.e. to search for information in an index database field.
The difference between Seek and Find command is that the Seek command
looks for content of a specified variable in the database file, the command Seek
with field name looks for the contents of field name whereas find with filed name
tries to search the word filed name in the database file.
Ex: - Store “Ramesh” To Name 1
Use Student Order Name
Seek Name.
24) Skip Command: -
This is command is used to moves the record pointer
forward or backward. The record specifies the number of record to move the
record pointer.
Syntax: - Skip Record Number.
Ex: - Skip – 6
25) Use Command: -
The Command is used to open an existing database file in
FoxPro.
Syntax: - Use < File Name >
Ex: - Use Student.
26) Delete File: -
Delete File Command is used to remove file form the disk.
Syntax: - Delete < File Name >
Ex: - Delete Student.
27) Copy File: -
The Copy File Command is used to make a copy of database or
any other file. We many need to copy a file to diskette for transferring our friend
following is the syntax of copy file command.
Syntax: - Copy < Old Name > To < New File Name >
Ex: - Copy File Student.DBF. To Student info
28) Report:-
Report generation means the presentation of record in the specific
format. Report file controls the display and printing of data. Report are very useful
any organization, because they can print summary of the transaction with the help
of report generation facility.
We can create are report format. FoxPro report file are created with FRM
extension.
Syntax: - Create Report < Report File Name >
Ex: - Use Student.
Create Report Student.
29) Dir: -
Dir Command stands for directory. The Command is used to displays
information about the directory in FoxPro window.
Syntax: - Dir Command
Ex: - Dir.
30) Do Command: -
Do Command is used to your program is complete then
command window type do your program is run.
Syntax: - Do < File Name >
Ex: - Do student.
31) Close All: -
Close all open databases and index in the current and any active
data work is closed all database file.
Syntax: - Close all command.
Ex: - Close All.
32) Wait Command: -
The Wait Command is used to stop the execution of
program or you wait in the command window it displays a message.
Press any key to continue...
FoxPro wait for key to be pressed use by user press any key, including Enter
key.
Syntax: -
Ex: - Wait “Press enter to any key”.
33) Store Command: -
Store Command is used to create memory variable and
specified value and program.
Syntax: - Store < Field Name > to Memory Variable.
Ex: - Store 10 to Num.
Store “Prashant” To Name.
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM:- Usage of Word processor.
DEFINITION:-
A word processor is an electronic device or computer software application that, as
directed by the user, performs word processing: the composition, editing,
formatting and sometimes printing of any sort of written material. Word processing
can also refer to advanced shorthand techniques, sometimes used in specialized
contexts with a specially modified typewriter .
HOW TO USE WORD PROCESSOR:-
Word processors are extremely common and easy to use. If you have used a
typewriter to write a letter or any other correspondence, using a word processor is
simple. If you haven't used a typewriter a word processor is easy to learn and you
can use it for many tasks such as writing a letter, doing your homework or
composing your resume, to name a few.
Word processor used to create, edit, and print documents. Of all computer
applications, word processing is the most common. To perform word processing,
you need a computer, a special program called a , Word processor and a printer. A
word processor enables you to create a document, store it electronically on a disk,
display it on a screen, modify it by entering commands and characters from the
keyboard, and print it on a printer.
Word processors vary considerably, but all word processors support the following
basic features:-
o insert text:Allows you to insert text anywhere in the document.
o delete text: Allows you to erase characters, words, lines, or pages as
easily as you can cross them out on paper
o cut and paste:Allows you to remove (cut) a section of text from one
place in a document and insert (paste) it somewhere else.
o copy :Allows you to duplicate a section of text.
Practical 4
o page size and margins :Allows you to define various page sizes and
margins, and the word processor will automatically readjust the text
so that it fits.
o Search and replace: Allows you to direct the word processor to
search for a particular word or phrase. You can also direct the word
processor to replace one group of characters with another everywhere
that the first group appears.
o Word Wrap:The word processor automatically moves to the next
line when you have filled one line with text, and it will readjust text if
you change the margins.
o Print: Allows you to send a document to a printer to get hardcopy.
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM:- Program to enter name ,DOB,age of a person.
PROGRAM:-
IDENTIFICATION DIVISION. PROGRAM-ID. ANINDYA. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 NAME PIC A(7) VALUE SPACES. 01 DAT PIC 99 VALUE 0. 01 MONTH PIC 99 VALUE 0. 01 YEAR PIC 99 VALUE 0. 01 AGE PIC 99 VALUE 0. 01 CurrentDate. 02 CurrentY PIC 99. 02 CurrentM PIC 99. 02 CurrentD PIC 99. PROCEDURE DIVISION. MAIN-PARA. DISPLAY " Enter Name: ". ACCEPT NAME. DISPLAY " Enter date of birth: ". ACCEPT DAT. DISPLAY " Enter month of birth: ". ACCEPT MONTH. DISPLAY " Enter year of birth: ". ACCEPT YEAR. ACCEPT CurrentDate FROM DATE. DISPLAY CurrentY "-" CurrentM "-" CurrentD. COMPUTE AGE = CurrentY - YEAR. DISPLAY NAME. DISPLAY AGE. STOP RUN.
Practical 5
SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY
Affiliated to PTU, & Approved by AICTE
AIM:- Program to enter the marks of student then calculate their marks. PROGRAM:- IDENTIFICATION DIVISION.
PROGRAM-ID. HO.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NAME PIC A(9) VALUE SPACES.
01 RN PIC 9(8) VALUE 0.
01 BRANCH PIC A(9) VALUE SPACES.
01 MARKS1 PIC 9(8) VALUE 0.
01 MARKS2 PIC 9(8) VALUE 0.
01 MARKS3 PIC 9(8) VALUE 0.
01 TOTAL PIC 9(4) VALUE 0.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER THE NAME ".
ACCEPT NAME.
DISPLAY "ENTER THE ROLL NO ".
ACCEPT RN.
DISPLAY " ENTER THE BRANCH ".
ACCEPT BRANCH.
DISPLAY " ENTER MARKS IN FIRST SUB".
ACCEPT MARKS1.
DISPLAY " ENTER MARKS IN SECOND SUB".
ACCEPT MARKS2.
DISPLAY " ENTER MARKS IN THIRD SUB".
ACCEPT MARKS3.
COMPUTE TOTAL = MARKS1 + MARKS2 + MARKS3 .
DISPLAY TOTAL.
STOP RUN.
Practical 6