View previous topic :: View next topic
|
Author |
Message |
pradeep
New User
Joined: 31 Jan 2004 Posts: 10 Location: Surandai,India
|
|
|
|
Dear sir/madam
I am reading records in a sequential file. The last record is coming 2 times . What is the problem? Give a sample for retrieving the correct recordd only. plz give me program.
Thanks in advance.
pradeep |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Quote: |
What is the problem? |
Obviously, it's a logic problem.
Where is your program code? And why is this so urgent? |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi Pradeep,
I hope you are the beginner in coding COBOL programs. Because many people faces the same problem at their learning phase.
Might be you coded your program as follows:
Performing a loop until EOF where the loop contains read (at end set EOF) and write. If this is the way you have coded your program certainly it will write the last record again. Even though it is reaching the end of file as there is another write following, it will write the last record again.
Instead of this read the file and then in the loop keep a write and read. So when the EOF is reached without writing it comes out of the loop.
And pradeep one small suggestion is better provide your code instead of simply telling about your problem.
Thanks,
Anu |
|
Back to top |
|
|
muthukumarapandian
New User
Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
u change ur code as shown below definitely it will work properly.
Code: |
para.
Read filename record at end go to paraname1.
display recname.
go to para.
paraname1.
display "eof".
stop run. |
|
|
Back to top |
|
|
|