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
 

 

Empty a VSAM KSDS dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Tue Jan 26, 2010 8:31 pm    Post subject: Empty a VSAM KSDS dataset
Reply with quote

Hi, I am trying to empty a VSAM data set in below way but its not working
Code:
//STEP070  EXEC PGM=IDCAMS                         
//SYSPRINT DD  SYSOUT=*                             
//IN1      DD  DUMMY                               
//OUT1     DD  DSN=ABCD.DDDD.TEST,DISP=OLD   
//SYSIN    DD  *                                   
 REPRO  INFILE(IN1),OUTFILE(OUT1)                   
//*                                                 


Can anyone tel me is there any way.
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1746
Location: Bloomington, IL

PostPosted: Tue Jan 26, 2010 8:39 pm    Post subject:
Reply with quote

How is it "not working"?
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Tue Jan 26, 2010 8:52 pm    Post subject:
Reply with quote

Well not sure.. I have the same code written but the VSAM file has the same OLD data.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 26, 2010 9:02 pm    Post subject:
Reply with quote

I find that DELETE / DEFINE is the best way to do this.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Tue Jan 26, 2010 9:17 pm    Post subject:
Reply with quote

Once a record has been written to a VSAM file, the only way to get rid of that record is to delete it -- via IDCAMS, or via a program. The method of copying from DD DUMMY to the file, which works for sequential files, fails for VSAM files.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Jan 26, 2010 9:59 pm    Post subject:
Reply with quote

Has the dataset been defined with the optional REUSE parameter?
REUSE
Specifies that the cluster can be opened again and again as a reusable cluster. When a reusable cluster is opened, its high-used RBA is set to zero if you open it with an access control block that specifies the RESET attribute.
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: Tue Jan 26, 2010 10:20 pm    Post subject: Reply to: Empty a VSAM KSDS dataset
Reply with quote

This is a method using DFSORT.
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Tue Jan 26, 2010 10:41 pm    Post subject:
Reply with quote

so does it means if its defined with Optional REUSE parameter then only the above code will work ?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Jan 26, 2010 10:50 pm    Post subject:
Reply with quote

Frank Yaeger in Delete all records from KSDS wrote:
If the VSAM data set is defined for REUSE, I believe this DFSORT job will do what you want:

Code:

//SORTSTP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=SS5661.G5661.INTAS.TST3.PDIQUEUE,DISP=SHR
//SORTOUT DD DSN=SS5661.G5661.INTAS.TST3.PDIQUEUE,DISP=SHR
//SYSIN DD *
   RECORD TYPE=V
   OPTION VSAMIO,RESET
   OMIT COND=ALL
   SORT FIELDS=(5,1,BI,A)
/*
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Wed Jan 27, 2010 1:07 am    Post subject:
Reply with quote

will it work for VSAM files?
My requirement is for VSAM file
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 Jan 27, 2010 1:19 am    Post subject:
Reply with quote

Quote:
will it work for VSAM files?
My requirement is for VSAM file
Did you not read the quote?
Quote:
If the VSAM data set is defined for REUSE, I believe this DFSORT job will do what you want:
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


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