AS computing

Cie AS Computing

Dear all,

            Welcome to AS computing class. I am Dr.Ravi your facilitator for this course. This course consists of two modules, theory and practicals. In theory we will have 12 chapters and in practicals we do have programming classes. You will sit for theory and practical exams at the end of the course, which is conducted by CIE.

All the best, keep moving, for there is always a helping hand above you to guide you.

Dr.Ravi

 

Views: 3404

Reply to This

Replies to This Discussion

tq for the posts asyraf and dain!

i forgot the commands halfway while i was doing the program

Dear All,

                  Today you would have seen how easy it is to access the stored values. However, what i wanted you all to understand is, "the concept of sequential files". Did you notice that the values what you stored in, were read in the same order as it got stored.

So now,

You should know what is a sequential file and what is a serial file.

 

Serial file is one where the data are stored in the same order as it arrives,

Sequential file is one where the records are access only in sequential order one after the other.

 

The the techniques what we used in todays class is to store sequential file. We should still know what is random file and indexed sequential file.

 

NOW I WANT ALL OF YOU TO TRY AND SEE HOW YOU CAN INPUT A NAME TO FIND THE CORRESPONDING PHONE NUMBER. WE WILL DISCUSS IN CLASS.

Dr.Ravi

Dain Razali said:

And to clear the screen, just type Form1.cls below Open "c:\asyraf" For Append As #1

Example:

Open "c:\asyraf" For Append As #1

Form1.cls

Write #1, "Donald", "0134563746"

Write #1, "Wilkison", "0199999999"

Write #1, "Mike", "0177777777"

 

Asyraf Naim bin Jamal Shahid said:

PROGRAMMING TODAY

 

STORE DATA

Open "c:\asyraf" For Output As #1

Write #1, "asyraf", "0134563746"

Write #1, "syahmi", "0199999999"

Write #1, "syakir", "0177777777"

Close
_________________________________________________________

 

ADDING DATA

Open "c:\asyraf" For Append As #1

Write #1, "Donald", "0134563746"

Write #1, "Wilkison", "0199999999"

Write #1, "Mike", "0177777777"

Close

 

_____________________________________________________

 

READ DATA

Open "c:\asyraf" For Input As #1

Form1.Print "Name            Phone No"

20 If EOF(1) Then GoTo 80

Input #1, x, y

Print Form1 x, y

GoTo 20

80 Close

 

 

 

Few question for you to answer.

 

1) What is the use of EOF ?

2) What is the use of the command INPUT #1

3) Can you try to explain FORM1.Print and Form1.cls. Why cannot we just use cls and print instead of Form1,cls and Form1.Print

Dr.Ravi

What will happen when you dont use EOF while accessing a sequential file records.

Dr.RAvi

 

Anybody wanted to install Visual basic 6 then please contact me. I will try to help you out.

Dr.Ravi



Afifah Ahmad said:

tq for the posts asyraf and dain!

i forgot the commands halfway while i was doing the program

the file cannot be read i think.because the computer reads only from the start of the file.when we last added a data, the pointer is situated at the EOF, therefore including EOF is a must when reading a file

 

I cant seem to get to do this even though i took the exact comman from what asyraf had posted. is there sumthing wrong in the commands?

Ravichandran said:

What will happen when you dont use EOF while accessing a sequential file records.

Dr.RAvi

 

1) EOF is used when we read a file, so that the computer closes the file properly first and the file could be read

2)command input #1 is for the computer to read the file

3)We use Form1.print and Form1.cls specifically to give commands to the form that we are using for the file. if we put only cls and print, the computer may not know which form are we referring to

 

this is my guess dr. ravi, forgive me if im wrong

Ravichandran said:

Few question for you to answer.

 

1) What is the use of EOF ?

2) What is the use of the command INPUT #1

3) Can you try to explain FORM1.Print and Form1.cls. Why cannot we just use cls and print instead of Form1,cls and Form1.Print

Dr.Ravi

You need to show what you have typed. When asking it. Just mentioning that you tried and did not get would not be a correct way to let us find what went worng with your code. So please cut and paste what you typed. Sure we will find the errors.

Dr.Ravi

 

Your answer 2 and 3 i can take it as correct answers Afifah, but sorry not the EOF one. Only the first half of your answer to EOF is correct. Any way let me wait for other and then do share my answer.

Dr.Ravi

Afifah Ahmad said:

1) EOF is used when we read a file, so that the computer closes the file properly first and the file could be read

2)command input #1 is for the computer to read the file

3)We use Form1.print and Form1.cls specifically to give commands to the form that we are using for the file. if we put only cls and print, the computer may not know which form are we referring to

 

this is my guess dr. ravi, forgive me if im wrong

Ravichandran said:

Few question for you to answer.

 

1) What is the use of EOF ?

2) What is the use of the command INPUT #1

3) Can you try to explain FORM1.Print and Form1.cls. Why cannot we just use cls and print instead of Form1,cls and Form1.Print

Dr.Ravi

1) EOF is used to detect end of each file , it will return as EOF(0) or EOF(1) , if it returns as 1 , it means that it has reached the end of the file and will then be closed , thus the command "If EOF(1) Then GoTo 80" , but when it returns as 0 , there's more files to be read, I think thats how I understand it, correct me if Im wrong.

Ravichandran said:

Your answer 2 and 3 i can take it as correct answers Afifah, but sorry not the EOF one. Only the first half of your answer to EOF is correct. Any way let me wait for other and then do share my answer.

Dr.Ravi

Afifah Ahmad said:

1) EOF is used when we read a file, so that the computer closes the file properly first and the file could be read

2)command input #1 is for the computer to read the file

3)We use Form1.print and Form1.cls specifically to give commands to the form that we are using for the file. if we put only cls and print, the computer may not know which form are we referring to

 

this is my guess dr. ravi, forgive me if im wrong

Ravichandran said:

Few question for you to answer.

 

1) What is the use of EOF ?

2) What is the use of the command INPUT #1

3) Can you try to explain FORM1.Print and Form1.cls. Why cannot we just use cls and print instead of Form1,cls and Form1.Print

Dr.Ravi


In computing, end of file (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.
Nadia Nadhira Airisal said:
1) EOF is used to detect end of each file , it will return as EOF(0) or EOF(1) , if it returns as 1 , it means that it has reached the end of the file and will then be closed , thus the command "If EOF(1) Then GoTo 80" , but when it returns as 0 , there's more files to be read, I think thats how I understand it, correct me if Im wrong.

Ravichandran said:

Your answer 2 and 3 i can take it as correct answers Afifah, but sorry not the EOF one. Only the first half of your answer to EOF is correct. Any way let me wait for other and then do share my answer.

Dr.Ravi

Afifah Ahmad said:

1) EOF is used when we read a file, so that the computer closes the file properly first and the file could be read

2)command input #1 is for the computer to read the file

3)We use Form1.print and Form1.cls specifically to give commands to the form that we are using for the file. if we put only cls and print, the computer may not know which form are we referring to

 

this is my guess dr. ravi, forgive me if im wrong

Ravichandran said:

Few question for you to answer.

 

1) What is the use of EOF ?

2) What is the use of the command INPUT #1

3) Can you try to explain FORM1.Print and Form1.cls. Why cannot we just use cls and print instead of Form1,cls and Form1.Print

Dr.Ravi

Use EOF to avoid the error generated by attempting to get input past the end of a file.

The EOF function returns False until the end of the file has been reached. With files opened for Random or Binary access, EOF returns False until the last executed FileGet function is unable to read an entire record.

With files opened for Binary access, an attempt to read through the file using the Input function until EOF returns True generates an error. Use the LOF and Loc functions instead of EOF when reading binary files with Input, or use Get when using the EOF function. With files opened for Output, EOF always returns True

Reply to Discussion

RSS

© 2025   Created by Ravichandran.   Powered by

Report an Issue  |  Terms of Service