Random Files& Writing or Storing records

Specific Objectives: At the end of this lesson a student will be able to:

  • Student will be able to solve problems.
  • Be able to ask questions according to lecture.
  • Be able to improve our mind ability.

Introduction:

  • (RANDOM FILES)

If the solution to the problem, we are working with deals with directly accessing a particular record in a file. Random files have the capability of accessing a record with in a file without the need to access all preceding records like in sequential file.

Random file OPEN statement has the following:

OPEN “filename. ext.” FOR RANDOM AS # [buffer]LEN=LEN (record Variable)

 

  • (WRITING OR STORING RECORDS)

Random files let you send the contents of the entire record to the file in one statement. This is accomplished by using the PUT statement, and the PUT statement also specify the location in the file where the record is being sent. The PUT statement has the following form:

PUT#[buffer], record Number, record Variable

 

Presentation (Method of teaching):

Firstly, introduce our self-secondly to motivate students and then implement our lecture planning (theoretical works with book references).

Tool:­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­white board, computer.

 

 

Contents Key points Time allocation
Computer Software

 

ü  Random files

 

ü  Writing or Storing records

 

 

 

 

 

 

 

 

OPEN “fileName.ext” FOR RANDOM AS #[buffer ]LEN=LEN (recordVariable)

PUT#[buffer ],record Number ,record Variable

 

20 minutes

15 minutes

 

Activity/Feedback:

Question Answering

Assignment:

What is random files and define the writing or storing records.

Reference:

  • Text book of computer science (10th)

 

 

 

 

 

 

 

About Author

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *