Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Urgent - Sequential file program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pradeep

New User


Joined: 31 Jan 2004
Posts: 10
Location: Surandai,India

PostPosted: Sun Sep 12, 2004 8:00 pm    Post subject: Urgent - Sequential file program
Reply with quote

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
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Sep 13, 2004 1:41 am    Post subject: Re: Urgent - Sequential file program
Reply with quote

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
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Mon Sep 13, 2004 7:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Tue Mar 01, 2005 6:41 pm    Post subject: regarding files
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us