Lesson Notes By Weeks and Term - Senior Secondary 2

Handling computer files

Term: 2nd Term

Week: 2

Class: Senior Secondary School 2

Age: 16 years

Duration: 40 minutes of 2 periods each

Date:       

Subject:      Computer studies and ICT

Topic:-       Handling computer files

SPECIFIC OBJECTIVES: At the end of the lesson, pupils should be able to

  1. Outline the basic operations we can carry out on computer files
  2. Highlight the steps in creating a sequential file
  3. Discuss the concept of file insecurity: effects and control
  4. Distinguish between manual and computer files

INSTRUCTIONAL TECHNIQUES: Identification, explanation, questions and answers, demonstration, videos from source

INSTRUCTIONAL MATERIALS: Videos, loud speaker, pictures, Data Processing for senior Secondary Education by Hiit Plc, WAPB Computer Studies for Senior Secondary II by Adekunle et  al, On-line Materials.

INSTRUCTIONAL PROCEDURES

PERIOD 1-2

PRESENTATION

TEACHER’S ACTIVITY

STUDENT’S ACTIVITY

STEP 1

INTRODUCTION

The teacher reviews the previous lesson on the concept of computer files

Students pay attention

STEP 2

EXPLANATION

He outlines the basic operations that could be carried out on computer files. He also highlights the steps in creating a sequential file

 

Students pay attention and participates

STEP 3

DEMONSTRATION

He discusses the concept of file insecurity; its effects and control and distinguishes between manual and computer files

Students pay attention and participate

STEP 4

NOTE TAKING

The teacher writes a summarized note on the board

The students copy the note in their books

 

NOTE

BASIC OPERATIONS WE CAN CARRY OUT ON COMPUTER FILES

  1. File creation: using an application package to create a file
  2. File deletion: an unneeded file can be removed (deleted) from the computer to free up disk space.
  3. File retrieval:  the file is brought out from where it is located for further processing
  4. File copy: process of making duplicate copies of a file
  5. File open: files are loaded (opened) before it can be used. The contents are being displayed on the screen
  6. File close: when you are done with a file and need to free up     main memory space, you close the file.
  7. File read: The file read operation is performed just to read the   data that are stored in the required file. No addition is done to the file.
  8. File Write: The file write operation is used to write the data to    the file, again, generally at the current position.
  9. File Update: making changes to the content/records of a file
  10. File Rename: The file rename operation is used to change the    name of the existing file.

 

STEPS IN CREATING SEQUENTIAL FILE:

The OPEN statement is used in writing information to a file. In general, the open statement follows this pattern;

OPEN file FOR OUTPUT AS 1

The file determines the filename to use

The FOR portion indicates how the file will be accessed or operated; it may be APPEND, BINARY, INPUT, OUTPUT, and RANDOM

The AS is the identifier used for the file handle in question.

The following opens a file, using mode OUTPUT and number 1, and then saves the text.

10        CLS

20        OPEN “textfile.dat” FOR OUTPUT AS 1

30        PRINT 1, “Hello World”

40        CLOSE 1

50        END

 

CODE

The combination of all these records forms a file. Thus, a file is a group of related records.

To facilitate the retrieval of specific records from a file, at least one field in each record is chosen as record key. Usually, the key is unique to every record to avoid duplication of records in a file.

BASIC File Processing statement to read and display files

The table below would be used in a BASIC program. The table would be stored in a file named “EXAMFILE.TXT” the content would be retrieved from the file and output to the screen

   

  MATHEMATICS

  ENGLISH

  TOTAL SCORE

01234

          50

         90

        140

01235

          70

         40

        110

01236

          80

         70

        150

Example

10        CLS

20        OPEN “EXAMFILE.TXT” FOR INPUT AS 1

30        PRINT 1 “MATRIC NO.  MATHS  ENG. LANG       TOTAL SCORE”

40        PRINT 1 “      0001             50          90                           140”

50        PRINT 1 “      0002             70          40                           110”

60        PRINT 1 “      0003             80          70                           150”

70        CLOSE 1

80        OPEN “EXAMFILE.TXT” FOR OUTPUT AS 1

90        DO WHILE NOT EOF(1)

100      INPUT 1, test

110      PRINT test

120      LOOP

130      CLOSE 1

140      END

Note that Free-File function is used to determine the next available file handle to be used in the OPEN statement. However, in a bigger project that uses many files, Free-file ensures that there is no conflicting File Handles used. It‘s a good practice to use it whenever you‘re not sure of the number of files your program might need to open.

  • OPEN “Examfile.txt” for output AS #File Number

This is the line that does the physical opening of file and assigns it #FileNumber as its file handle. The ‘FOR INPUT’ part tells QuickBASIC that you want to open the file in Read mode as you‘ll be reading the contents of the file later in the example.

 Next is the loop indicate by the DO WHILE NOT EOF (FileNumber) line. In QuickBASIC EOF () means End Of File. There is also BOF () for Beginning of File and LOF () for Length of File

Since you can’t go backwards on a sequential file, you won’t need BOF () at all.

  • The first line Gets a line of data

 

DESCRIBE FILE INSECURITY

Computer file insecurity refers to the concept that a computer system is vulnerable to attack, and that this fact creates a constant battle between those looking to improve security, and those looking to circumvent security.

 

EFFECTS OF INSECURITY OF FILE

Data loss refers to the unforeseen loss of data or information. An occurrence of data loss can be called Data Loss Event and there are several possible root causes.

 

Overwriting is a process of writing a binary set of data on a memory. Overwriting generally occurs when unused file system clusters are written upon with new data. In simple terms, it writes over the previous data.

 

METHODS FOR FILES SECURITY

  1. Backup

 Backup or the process of backing up a file refers to making copies of files so that these additional copies may be used to restore the original after the data loss event.

Backup has two distinct purposes. The primary purpose is to recover data as a reaction to data loss, be it by data deletion or corrupted data. The secondary purpose of backups it is recover data from historical period of time within the constraints of a user-defined data retention policy.

 

  1. Antivirus

An anti-virus program protects a computer file from malicious virus attack, detects and heals files that have been attacked.

  1. Password

It is a chosen secret string of characters that allows access to a computer, interface, files etc.  The use of password is at user’s discretion and caution must be exercised by the user to remember the password always.

 

Differences between computer files and manual files

Manual is using old method without the help of the technology or maybe less to perform certain task or work while; computerized file system is using latest technology of ICT to carry out various tasks that is more effective when compared with manual system in terms of the productivity and time usage.

 

 EVALUATION: 1. What are some basic operations that can be carried out on computer files?

  1. Outline how to create a sequential file
  2. Describe file insecurity, outlining its effect and how to      control it
  3. Distinguish between manual and computer files

CLASSWORK: As in evaluation

CONCLUSION: The teacher commends the students positively