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
 

 

How to delete/update records in a sequential file using COBO

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

New User


Joined: 17 Jun 2009
Posts: 35
Location: Denver

PostPosted: Wed Nov 25, 2009 10:38 pm    Post subject: How to delete/update records in a sequential file using COBO
Reply with quote

Hi

I am having an issue with processing a sequential file.
I have a sequential file which I am reading record by record.
I want to delete the record once my processing is done.
The reason I am doing this is to have the records which are not processed to be used for a different purpose.

I was thinking I can first read the file sequentially. Then process it. And delete the record after procerssing.
Once I reach EOF, I wanted to close the file and open it again in input mode and read it sequentially and process the other records. I cannot use a sort or anything since business logic is involved.

How can I do this.
Can we delete seq file records in COBOL.
If not can I update the records so that I have some value I can check to skip the record when I read it again.

Please help me with this

Manu
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: Wed Nov 25, 2009 10:44 pm    Post subject: Re: How to delete/update records in a sequential file using
Reply with quote

manugeorge2004 wrote:
Can we delete seq file records in COBOL.


No, nor in anything else that I'm aware of.

manugeorge2004 wrote:
If not can I update the records so that I have some value I can check to skip the record when I read it again.


Yes, I believe that COBOL supports the REWRITE function.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Nov 25, 2009 11:15 pm    Post subject:
Reply with quote

you will have to father-son the qsam file.
if after a read, you use the record, do not write it to the new qsam file.
if after a read, you do not use the record, write it to the new qsam file.

the new qsam file will only have records that you did not process.
Back to top
View user's profile Send private message
manugeorge2004

New User


Joined: 17 Jun 2009
Posts: 35
Location: Denver

PostPosted: Wed Nov 25, 2009 11:24 pm    Post subject: Reply to: How to delete/update records in a sequential file
Reply with quote

Actually..I will not be reading the record which I dont process.
I have two files which are sorted for the first few bytes.
I read the first file, read the second file.
I compare the sort keys and do some processing.
The first file is my driver.
After all the records from the first file are read, my loop terminates.
But there will be some extra records in the second file after this.
I need to process those records seperately in the same program.

Thats why i thought I can delete the records from the second file. Then close the file. Then I will open the second file again and process them seperately.

Any suggestions?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed Nov 25, 2009 11:29 pm    Post subject: Reply to: How to delete/update records in a sequential file
Reply with quote

why bother with a complex solution...
at end of file1 set a flag or a high key to stop the two file match process
and keep reading and processing the file2 records only
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed Nov 25, 2009 11:46 pm    Post subject:
Reply with quote

Manu, it sounds like you decided what you wanted to do before you posted here. COBOL can quite easily handle what you're wanting to do, and there's no reason to read either file a second time, nor to delete any records from either file -- unless you've decided you have to do so.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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