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: 6966
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: 10210
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: 7931
Location: Bellevue, IA

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 Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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