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
 

 

Delete VSAM File Records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
amitc23

New User


Joined: 05 Nov 2014
Posts: 78
Location: India

PostPosted: Sun Apr 10, 2016 10:10 am    Post subject: Delete VSAM File Records
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: 78
Location: India

PostPosted: Sun Apr 10, 2016 10:18 am    Post subject:
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: 78
Location: India

PostPosted: Sun Apr 10, 2016 10:35 am    Post subject:
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: 65
Location: India

PostPosted: Mon Apr 11, 2016 12:56 pm    Post subject: Re: Delete VSAM File Records
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 11, 2016 5:24 pm    Post subject: Reply to: Delete VSAM File Records
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: 65
Location: India

PostPosted: Mon Apr 11, 2016 5:51 pm    Post subject:
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: 78
Location: India

PostPosted: Mon Apr 11, 2016 9:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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