IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Delete VSAM File Records


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
amitc23

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Sun Apr 10, 2016 10:10 am
Reply with quote

Hi

I am facing some problem while deleting the records from a VSAM file in a COBOL/CICS program. I need to START the file at top , go on reading the records and send them to an outer system until I reach End of File. Then I get a message back from the other system when they receive all the records correctly and then I need to empty the file.

For delete How do I read each record sequentially and then go on deleting the records. I don't think I can Mass Delete all records in one CICS Command.

Thanks
Back to top
View user's profile Send private message
amitc23

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Sun Apr 10, 2016 10:18 am
Reply with quote

Just to add I can not do a STARTBR/READNEXT again as the file is not defined in RLS mode.
Back to top
View user's profile Send private message
amitc23

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Sun Apr 10, 2016 10:35 am
Reply with quote

The only solution I can think of as yet is to Start and Read the file again and store say first 100 records key in an array and then Read the file for update with key and Delete. Repeat this process until I delete all the records. icon_sad.gif
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Mon Apr 11, 2016 12:56 pm
Reply with quote

Hello,

amitc23 wrote:
.... then I need to empty the file.

For delete How do I read each record sequentially and then go on deleting the records. I don't think I can Mass Delete all records in one CICS Command....


If it is emptying the file that you're looking for, instead of reading and deleting records, why not try using the SET FILE command with EMPTY, note that once the file has been opened to CICS as EMPTY you'll have to programmatically handle the initialization of the 'empty' file (which would mean writing at least one record to the file, depending on your site regulations, it can be low-values or all '0' etc, your choice):

Code:

EXEC CICS SET             
          FILE (FILE-NAME)
          CLOSED         
          ENABLED         
          EMPTY           
          RESP (WS-RESP) 
          RESP2(WS-RESP2)
          NOHANDLE       
END-EXEC                 


Hth.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 11, 2016 5:24 pm
Reply with quote

Note; SET FILE API's only work on LOCAL files.
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Mon Apr 11, 2016 5:51 pm
Reply with quote

Thank you Bill for pointing it out; I missed it in the original post icon_redface.gif ; though on a curious notion it shouldn't matter if MRO is not inforce, should it?

amitc23,

As pointed out by Bill, before you perform a 'SET FILE' (provided, you go with the above solution) it would be better to do an INQUIRE FILE, use the SYSID received from the REMOTESYSTEM, use it to do an ASSIGN SYSID, once done, you should be good to go for the 'SET FILE' command.

Hth.
Back to top
View user's profile Send private message
amitc23

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Mon Apr 11, 2016 9:22 pm
Reply with quote

That looks great Abid and Bill. I am off for the day. Will try and let u know tomorrow.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top