100% found this document useful (1 vote)
2K views48 pages

Com 214 File Organization and Management Practical

The document provides instructions for students to create a program over two weeks that first writes a simple program to create and update records in a file, and then creates an input form to maintain the records in a file. Students are guided to use text boxes and command buttons to enter, save, retrieve, and print data from a sequential text file. The document also includes review questions for students to assess their understanding of key concepts related to file organization and management.

Uploaded by

Adeneye Ayomide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views48 pages

Com 214 File Organization and Management Practical

The document provides instructions for students to create a program over two weeks that first writes a simple program to create and update records in a file, and then creates an input form to maintain the records in a file. Students are guided to use text boxes and command buttons to enter, save, retrieve, and print data from a sequential text file. The document also includes review questions for students to assess their understanding of key concepts related to file organization and management.

Uploaded by

Adeneye Ayomide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

1

Practical Work – File Organization & Management

UNESCO
UNESCO-NIGERIA TECHNICAL & VOCATIONAL
EDUCATION REVITALISATION PROJECT
PROJECT-PHASE II

NATIONAL DIPLOMA IN
COMPUTER TECHNOLOGY

File Organization and


Management
YEAR II- SE MESTER I
PRACTICAL
Version 1: December 2008
2
Practical Work – File Organization & Management

Contents
Week 1-2: Program that creates and updates records of a file. ................................................................... 4
Week 3: To create an input form to maintain records of a file. ................................................................ 10
Week 4: To write a program that create and maintaining different file organization. .............................. 14
Weeks 5 – 6: To write a program that create and maintaining file organization. ...................................... 20
Week 7: To load and retrieve documents to and from different storage media. .............................. 25
Week 8: To load and retrieve documents to and from different storage media. .............................. 29
Week 9: To be able to write simple programs involving sequential and random access methods. .......... 32
Week 10: To write programs involving sequential and random access methods. ..................................... 34
Week 11: To write program involving 1 dimensional arrays. ..................................................................... 37
Week 12: To write program involving 2 dimensional arrays.. .................................................................... 40
Week 13: The techniques of stacks and Queues in file organization. ...................................................... 43
Week 14: To write a file access protection and security program. ............................................................ 46
Week 15: To write a file access protection and security program. ............................................................ 48
3
Practical Work – File Organization & Management

WEEK 1

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write a simple program that creates and updates records of a file.
4
Practical Work – File Organization & Management

Program that creates and updates records of a file.

During this week students are to complete a project named “Week1” to use text boxes to enter
data into a text file created and later access the content of the file back. The main form looks
like this form

How to write a simple program that creates and updates records of a file.

1. Open project and name it week1


2. Double-click on " The form" and write this code

Private Sub Form_Load()

Dim intmsg As String

Open "c:\documents and settings\student.txt" For Output As #1

intmsg = MsgBox("file student.txt opened")

End Sub
5
Practical Work – File Organization & Management

3. Double-click on " command Exit" and write this code


Private Sub Cmdexit_Click()

Close #1

End

End Sub

4. Double-click on " Command Report" and write this code


• Before then add another form name it Frmprint”
Private Sub cmdprint_Click()

'section to echo the file back

Dim Name As String

Dim Address As String

Dim sex As String

Dim age As Integer

'Kill "c:\documents and settings\student.txt"

Open "c:\documents and settings\student.txt" For Input As #1

Do While Not EOF(1)

Input #1, Name, Address, sex, age

Frmprint.Print "Student Name is ......."; Name

Frmprint.Print "Address is ........"; Address

Frmprint.Print "Sex is ..........."; sex

Frmprint.Print "Age is ............"; age

Loop

End Sub
6
Practical Work – File Organization & Management

5. Double-click on " Command Save Rec" and write this code


Private Sub Cmdsave_Click()

Dim Name As String

Dim Address As String

Dim sex As String

Dim age As Integer

Dim sntmsg As String

Name = Txtname

Address = Txtaddress

sex = Txtsex

age = Txtage

Print #1, Name, Address, sex, age

Close #1

Txtname.Text = ""

Txtaddress.Text = ""

Txtsex.Text = ""

Txtage.Text = ""

sntmsg = MsgBox("file student.txt opened")

End Sub

6. Save your project with the name “week1-2”.


7. Run the program
7
Practical Work – File Organization & Management

Students’ Practical Assessment

1. Write short notes on;

i. File

ii. Bit

iii. Nibble

iv. Byte

v. Character

vi. Field

vii. Record

viii. Database

2. In what unit is bit, byte and computer memory measured?

3. Clearly differentiate between;

i. File and record

ii. File and directory

iii. Record and database

iv. File and character

4. Explain what you understand by file extension and give appropriate examples.

5. Mention what make implementation of database necessary.

_______________________________________________________________________

________________________________________________________________________

________________________________________________________________________

6. Draw a diagram to illustrate file processing system environment.


8
Practical Work – File Organization & Management

7. What is file organization?

________________________________________________________________________

_______________________________________________________________________

_______________________________________________________________________

8. State the main objectives of database implementation

9. With the aid of a diagram, explain a centralized database.


9
Practical Work – File Organization & Management

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to create an input form to maintain records of a file.


10
Practical Work – File Organization & Management

WEEK 2:
To create an input form to maintain records of a file.

During this week students are to create an input Form named “Week3” to use text boxes to
enter data into a sequential text file created. The Form should contain command buttons to
enable user to maintain the data/contents of the file as shown in the diagram below.

How to do this

1. Start Visual Basic 6


2. In the New Project box, Click Standard.EXE and then Click OK.
3. Double-click the Label control. Visual Basic puts a new label in the center
of your Form window. Move the control to the approximate place on your form.
Repeat this until all the labels are placed on the form.
4. Double-click the textbox. Visual Basic puts a new label in the center of
your Form window. Move the textbox to approximate label on your form. Repeat
this until all the textboxes are placed on the form.
5. Double-click the Command Button control to place a command button on
your Form window as shown on the form above.
6. Save the Form as ‘week 3’
11
Practical Work – File Organization & Management
12
Practical Work – File Organization & Management

Students’ Practical Assessment

1. What is file system?

________________________________________________________________________

________________________________________________________________________

2. Describe the basic services of a file system.

________________________________________________________________________

________________________________________________________________________

3. Clearly differentiate between file manager and file system.

________________________________________________________________________

________________________________________________________________________

4. Compare and contrast file system and operating system.

________________________________________________________________________

________________________________________________________________________

5. Identify the characteristics of a file system under Mac O/S X and file under Microsoft

Windows.

________________________________________________________________________

________________________________________________________________________

6. Enumerate the qualities of a good file system.

________________________________________________________________________

________________________________________________________________________

7. What is the relevance of file sharing in a file processing system?

________________________________________________________________________
13
Practical Work – File Organization & Management

WEEK 3

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write a simple program for creating and maintaining different file
organization.
14
Practical Work – File Organization & Management

To write a program that create and maintaining different file organization.

During this week students are to complete a project named “Week4” to use text boxes to enter
data into a sequential text file created. The user should be able to maintain the data/content of
the file. The main form should looks like this form

How to write a simple program that creates and updates records of a file.

1. Open project and name it week4


2. Double-click on " The form" and write this code

Private Sub Form_Load()

Dim intmsg As String

Open "c:\studentRecord\students.txt" For Output As #2

intmsg = MsgBox("file students.txt opened")

End Sub

3. Double-click on " command Quit Application" and write this code

Private Sub Command16_Click()


15
Practical Work – File Organization & Management

On Error GoTo Err_Command16_Click

DoCmd.Quit

Exit_Command16_Click:

Exit Sub

Err_Command16_Click:

MsgBox Err.Description

Resume Exit_Command16_Click

End Sub

4. Double-click on " Create file" and write this code:

Private Sub Command10_Click()

On Error GoTo Err_Command10_Click

DoCmd.GoToRecord , , acNewRec

Exit_Command10_Click:

Exit Sub

Err_Command10_Click:

MsgBox Err.Description

Resume Exit_Command10_Click

5. Double-click on " Delete record" and write this code:

Private Sub Command11_Click()

On Error GoTo Err_Command11_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


16
Practical Work – File Organization & Management

Exit_Command11_Click:

Exit Sub

Err_Command11_Click:

MsgBox Err.Description

Resume Exit_Command11_Click

End Sub

6. Double-click on " Edit record" and write this code:

Private Sub Command12_Click()

On Error GoTo Err_Command12_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2, acMenuVer70

Exit_Command12_Click:

Exit Sub

Err_Command12_Click:

MsgBox Err.Description

Resume Exit_Command12_Click

End Sub

7. Double-click on " Modify record" and write this code:

Private Sub Command13_Click()

On Error GoTo Err_Command13_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command13_Click:

Exit Sub

Err_Command13_Click:

MsgBox Err.Description
17
Practical Work – File Organization & Management

Resume Exit_Command13_Click

End Sub

8. Double-click on " Refresh record" and write this code:


Private Sub Command14_Click()

On Error GoTo Err_Command14_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command14_Click:

Exit Sub

Err_Command14_Click:

MsgBox Err.Description

Resume Exit_Command14_Click

End Sub

9. Double-click on " Refresh record" and write this code:


Private Sub Command15_Click()

On Error GoTo Err_Command15_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command15_Click:

Exit Sub

Err_Command15_Click:

MsgBox Err.Description

Resume Exit_Command15_Click

End Sub

10. Save your project with the name “week4”.

11. Run the program


18
Practical Work – File Organization & Management

Students’ Practical Assessment

1. Enumerate various file processing operations.

2. Explain data processing.

3. Identify two types of data processing.

________________________________________________________________________

_______________________________________________________________________

________________________________________________________________________

4. Differentiate between file processing and data processing.

________________________________________________________________________

________________________________________________________________________
19
Practical Work – File Organization & Management

WEEK 4 -6

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write a simple program for creating and maintaining different file
organization.
20
Practical Work – File Organization & Management

To write a program that create and maintaining file organization.

During this week students are to complete a project named “Week 5-6” to use text boxes to
enter data into a sequential text file created. The user should be able to maintain the
data/content of the file. The main form should looks like this form

How to write a simple program that creates and updates records of a file.

1. Open project and name it week 5-6


2. Double-click on " The form" and write this code

Private Sub Form_Load()

Dim intmsg As String

Open "c:\studentRecord\students.txt" For Output As #2

intmsg = MsgBox("file students.txt opened")

End Sub

3. Double-click on " command Quit Application" and write this code

Private Sub Command16_Click()


21
Practical Work – File Organization & Management

On Error GoTo Err_Command16_Click

DoCmd.Quit

Exit_Command16_Click:

Exit Sub

Err_Command16_Click:

MsgBox Err.Description

Resume Exit_Command16_Click

End Sub

4. Double-click on " Create file" and write this code:

Private Sub Command10_Click()

On Error GoTo Err_Command10_Click

DoCmd.GoToRecord , , acNewRec

Exit_Command10_Click:

Exit Sub

Err_Command10_Click:

MsgBox Err.Description

Resume Exit_Command10_Click

5. Double-click on " Delete record" and write this code:

Private Sub Command11_Click()

On Error GoTo Err_Command11_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


22
Practical Work – File Organization & Management

Exit_Command11_Click:

Exit Sub

Err_Command11_Click:

MsgBox Err.Description

Resume Exit_Command11_Click

End Sub

6. Double-click on " Edit record" and write this code:

Private Sub Command12_Click()

On Error GoTo Err_Command12_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2, acMenuVer70

Exit_Command12_Click:

Exit Sub

Err_Command12_Click:

MsgBox Err.Description

Resume Exit_Command12_Click

End Sub

7. Double-click on " Modify record" and write this code:

Private Sub Command13_Click()

On Error GoTo Err_Command13_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command13_Click:

Exit Sub

Err_Command13_Click:

MsgBox Err.Description
23
Practical Work – File Organization & Management

Resume Exit_Command13_Click

End Sub

8. Double-click on " Refresh record" and write this code:

Private Sub Command14_Click()

On Error GoTo Err_Command14_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command14_Click:

Exit Sub

Err_Command14_Click:

MsgBox Err.Description

Resume Exit_Command14_Click

End Sub

9. Double-click on " Refresh record" and write this code:

Private Sub Command15_Click()

On Error GoTo Err_Command15_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command15_Click:

Exit Sub

Err_Command15_Click:

MsgBox Err.Description

Resume Exit_Command15_Click

End Sub

10. Save your project with the name “week 5-6”.

11. Run the program


24
Practical Work – File Organization & Management

WEEK 7

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to load and retrieve documents to and from different storage media.
25
Practical Work – File Organization & Management

To load and retrieve documents to and from different storage media.

During this week students are to load and retrieve documents to and from different
storage media, such as diskette, flash disk, HDD, etc

How to load or save documents into diskette, hard disk, etc:

i. Click on File menu


ii. Select Open option to display open dialog box as shown below;

iii. Select the folder/drive in the look in where you want to save your document (that is,
specify the drive – diskette or flash disk or folder in the local disk (HHD))
Note that the diskette or flash disk must be slot/plug onto the appropriate
computer port and recognized by the computer before this operation.
iv. Type the file name in the file name (e.g week 7 Practical) text box.
26
Practical Work – File Organization & Management

Note that the Microsoft word will give file extension to your file name depending
on the type of file specified.
v. Click on the save button

Students’ Practical Assessment

1. What do you observe when saving or storing data into different storage media?

_______________________________________________________________________

_______________________________________________________________________

2. Why is that, the computer is slower when accessing the external disk compared to when

accessing hard disk?

_______________________________________________________________________

_______________________________________________________________________

3. Briefly describe;

i. Primary storage

ii. Secondary storage

4. What are the characteristics of internal memory of a computer?

5. Outline the characteristics of ROM and RAM.

6. Explain the performance of computer storage with respect to;

i. Latency

ii. Throughput.

7. What do you understand by off-line storage?

______________________________________________________________________

______________________________________________________________________
27
Practical Work – File Organization & Management

______________________________________________________________________
28
Practical Work – File Organization & Management

WEEK 8

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to load and retrieve documents to and from different storage media.
29
Practical Work – File Organization & Management

Week 8: To load and retrieve documents to and from different storage media.

During this week students are to load and retrieve documents to and from
different storage media, such as diskette, flash disk, HDD, etc

How to retrieve documents into diskette, hard disk, etc:

i. Click on File menu

ii. Select Open option to display open dialog box as shown below;

iii. Select the folder/drive in the look in from where you want to retrieve your
document (that is, specify the drive – diskette or flash disk or folder in the local
disk (HHD))
Note that the diskette or flash disk must be slot/plug onto the appropriate
computer port and recognized by the computer before this operation.
iv. Type the file name in the file name (e.g week 7 Practical.docx) text box.
Note that you can select the file name from the list of file names displayed.
v. Click on the save button
30
Practical Work – File Organization & Management

Students’ Practical Assessment

1. What do you understand by off-line storage?

_______________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. What do you observe when saving or storing data into different storage media?

_______________________________________________________________________

_______________________________________________________________________

3. Why is that, the computer is slower when accessing the external disk compared to

when accessing hard disk?

______________________________________________________________________

_______________________________________________________________________

4. Briefly explain the characteristics of the following storage devices:

i. CD-ROM

ii. Hard Disk

iii. Flash Disk

iv. Diskette

v. Magnetic tap
31
Practical Work – File Organization & Management

WEEK 9

LEARNING OUTCOMES

To understand:

 To be able to write simple programs involving sequential and random


access methods.
32
Practical Work – File Organization & Management

Week 9: To be able to write simple programs involving sequential and random access methods.

During this week students are to complete a project named “Week 9” to create sequential file.
The user should be able to maintain the data/content of the file.

How to do this

1. Open project and name it week 9


2. Double-click on " The form" and write this code
Private Sub Form_Load()

Dim intmsg As String

Open "c:\studentsRec\student.txt" For Output As #3

intmsg = MsgBox("file student.txt opened")

End Sub
3. Save your project with the name “week 9”.
33
Practical Work – File Organization & Management

WEEK 10

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 To be able to write simple programs involving sequential and random


access methods.
34
Practical Work – File Organization & Management

Week 10: To write programs involving sequential and random access methods.

During this week students are to complete a project named “Week 10” to create random file.
The user should be able to maintain the data/content of the file.

How to do this

1. Open project and name it week10


2. Double-click on " The form" and write this code

Private Sub Form_Load()

Open “stud.dat” for random as #2 len=len(myrecord)

Private sub form_load()

Type single-Record

Record-key as integer

Sname As String*20

Snum as string*10
35
Practical Work – File Organization & Management

End type

Dim myrecord As single-record

Open”stud.txt”for random as #2, Len = len(myrecord)

End sub

3. Save your project with the name “week10”.


36
Practical Work – File Organization & Management

WEEK 11

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write simple program involving 1,2,3 dimensional arrays, stacks and Queues.
37
Practical Work – File Organization & Management

Week 11: To write program involving 1 dimensional arrays.

During This Lab we want to Complete a project “Week11” to add the numbers
(0,2,4,………36,38 ) to one dimension array and display it in a text box. The main form looks
like this form

1. Open project week11


2. Double-click the " Traverse Array" Command button and write this code

Dim i As Integer

Dim iMyArray(19) As Integer

Dim BeginMsg As String

Dim MidMsg As String

Dim LoopMsg As String


38
Practical Work – File Organization & Management

Dim FullMsg As String

For i = 0 To 19

iMyArray(i) = i * 2

Next i

BeginMsg = "The element is: "

MidMsg = "The value is: "

FullMsg = "The elements of array are : " & vbCrLf

For i = 0 To 19

LoopMsg = LoopMsg & BeginMsg & i & "," & vbTab

LoopMsg = LoopMsg & MidMsg & iMyArray(i)

FullMsg = FullMsg & LoopMsg & vbCrLf

LoopMsg = ""

Next i

Text1.Text = FullMsg

3. Save your project with the name “week11”.


4. Run the program
39
Practical Work – File Organization & Management

WEEK 12
THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write simple program involving 1,2,3 dimensional arrays, stacks and Queues.
40
Practical Work – File Organization & Management

Week 12: To write program involving 2 dimensional arrays..

During This Lab we want to Complete a project “Week12” to add the numbers (0,38) (2,36)
………(36,2) (38,0 ) to two dimension array and display it in a text box. The main form looks
like this form

1. Open project week12


2. Double-click the " Traverse Array" Command button and write this code

Dim i As Integer

Dim j As Integer

Dim iMyArray(19, 1) As Integer

Dim BeginMsg As String


41
Practical Work – File Organization & Management

Dim MidMsg As String

Dim LoopMsg As String

Dim FullMsg As String

For i = 0 To 19

iMyArray(i, 0) = i * 2

iMyArray(i, 1) = 38 - i * 2

Next i

BeginMsg = "The element is: "

MidMsg = "The value is: "

FullMsg = "The elements of array are : " & vbCrLf

LoopMsg = ""

For i = 0 To 19

For j = 0 To 1

LoopMsg = LoopMsg & BeginMsg & "( " & i & "," & j & " )"

LoopMsg = LoopMsg & vbTab & MidMsg & iMyArray(i, j)

LoopMsg = LoopMsg & vbTab

Next j

FullMsg = FullMsg & LoopMsg & vbCrLf

LoopMsg = ""

Next i

Text1.Text = FullMsg

3. Save your project with the name “week12” in your folder.


4. Run the program
42
Practical Work – File Organization & Management

WEEK 13

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 The techniques of stacks and Queues in file organization.


43
Practical Work – File Organization & Management

Week 13: The techniques of stacks and Queues in file organization.

Students are to study the stacks illustrated by railroad spur in diagrams below and briefly
explain the push and pop operations represented in the diagram

C D C D
B

A A

Push Pop

________________________________________________________________________

________________________________________________________________________

_______________________________________________________________________

1. Define Stack.

________________________________________________________________________

________________________________________________________________________

_______________________________________________________________________

2. Differentiate between stack and queue systems.

________________________________________________________________________

________________________________________________________________________

_______________________________________________________________________
44
Practical Work – File Organization & Management

3. What do understand by the term – queue?

__________________________________________________________________________________

__________________________________________________________________________________

__________________________________________________________________________________

4. Explain the queue system represented in the diagram below;

Service
Input source Queue mechanism Served

Process

5. Enumerate and briefly explain five file processing techniques you know.

________________________________________________________________________

________________________________________________________________________

_______________________________________________________________________
45
Practical Work – File Organization & Management

WEEK 14
THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write a file access protection and security program.


46
Practical Work – File Organization & Management

Week 14: To write a file access protection and security program.

At the end of this week students are expected write simple program using any of the file

security techniques to protect unauthorized persons from gaining access to data file.

Students Assessment

1. Define file security.

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. Give five (5) reasons why file security is important

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

3. Enumerate the various file security techniques you know

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________
47
Practical Work – File Organization & Management

WEEK 15

THIS WEEK SPECIFIC LEARNING OUTCOMES

To understand:

 How to write a file access protection and security program.


48
Practical Work – File Organization & Management

Week 15: To write a file access protection and security program.

At the end of this week students are expected write simple program using any of the file

security techniques to protect unauthorized persons from gaining access to data file.

Students Assessment

1. Identify clearly the difference between file dumping and archiving.

2. Identify and briefly explain problems associated with;

i. File access,

ii. File achieving

iii. File security

iv. File back-up

You might also like