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

Empty VSAM of its data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mail_ssb

New User


Joined: 26 Mar 2005
Posts: 17

PostPosted: Fri Jun 16, 2006 7:25 am
Reply with quote

Hello,

I need to empty data from VSAM dataset (KSDS/ESDS), keeping the structure of VSAM intact.

One option is Delete and then Redefine. Is there any other way of doing this...? Following works for PS datasets, but I have problem in using this with VSAM:

DD1 DD DSN=MY.VSAM1,DISP=SHR
DD2 DD DSN=MY.VSAM1,DISP=SHR
SORT FIELDS=COPY
OMIT COND=ALL

(Appropriate symbols and syntax is assumed in above JCL statements)

Appreciate your guidance and attention.
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Jun 16, 2006 3:39 pm
Reply with quote

This might sound basic but I think you can always delete all the records using Fileaid or similar tool.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jun 16, 2006 8:46 pm
Reply with quote

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=MY.VSAM1,DISP=SHR
//SORTOUT DD DSN=MY.VSAM1,DISP=SHR
//SYSIN DD *
  SORT FIELDS=COPY
  OMIT COND=ALL
/*


This won't work, because you can't do a COPY using the same VSAM data set as input and output.

You can do a SORT using the same VSAM data set as input and output, but you also need to use DFSORT's VSAMIO option which:

Quote:

specifies that DFSORT can use the same VSAM data set for input and output when all of the following conditions are met:

o The application is a sort
o RESET is in effect
o The VSAM data set was defined with REUSE

These conditions ensure that the VSAM data set is processed as NEW for output and will contain the sorted input records, that is, it will be sorted in-place.

DFSORT terminates if the same VSAM data set is specified for input and output and any of the above conditions are not met.


So if your VSAM data set was defined with REUSE, something like this might work:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=MY.VSAM1,DISP=SHR
//SORTOUT DD DSN=MY.VSAM1,DISP=SHR
//SYSIN DD *
  OPTION VSAMIO,RESET
  OMIT COND=ALL
  SORT FIELDS=(p,m,BI,A)
 /*


where p is the starting position of the key and m is the length of the key (since you're deleting all of the records, it probably doesn't matter what you use for p and m).
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top