Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Empty VSAM of its data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Empty VSAM of its data
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    Post subject:
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 Moderator


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

PostPosted: Fri Jun 16, 2006 8:46 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us