MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

delete the records from a vsam dataset

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Aug 06, 2007 1:58 am    Post subject: delete the records from a vsam dataset Reply with quote

Hai All,

I have a KSDS dataset and I want to delete some records from it.Please let me know how to do it through a JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 06, 2007 5:05 am    Post subject: Reply with quote

yadav2005,

Please SEARCH before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=9479#9479

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Sep 24, 2007 7:36 am    Post subject: Reply with quote

Kolusu,

I have a question as i want to delete the records in an existing KSDS cluster , the solution provided by you for deletion i am not quite clear as want u mean for //CON DD DSN=YOUR VSAM DELETE REC FILE, can you help me i want to delete the records from an existing dataset and lod the records from one more new dataset as initially went i loaded the records i missed out to keep one field blanks.
Code:
 

DELETE solution:

We first copy contents of the vsam file to a temp dataset. Now we concatenate this temp dataset along with the records to be deleted and load back to the original file.when we concate the records to be deleted file with the temp dataset, all the keys which we want to delete will be duplicates. So we use the SELECT operator with NODUPS option to eliminate all the records to be deleted. Note that the out vsam dataset is same as the input dataset. You can use the same input vsam file as output vsam file when it is defined with REUSE option.

Code:

//******************************************************************
//* THIS STEP WILL DELETE RECORDS IN AN EXISTING VSAM CLUSTER      *
//******************************************************************
//STEP0300 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//VSAMIN   DD DSN=YOUR INPUT VSAM FILE,         
//            DISP=SHR                                   
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//CON      DD DSN=YOUR VSAM DELETE REC FILE,                     
//            DISP=SHR                                           
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1                     
//OUT      DD DSN=YOUR INPUT VSAM FILE,         
//            DISP=OLD                                   
//TOOLIN   DD *                   
  COPY FROM(VSAMIN) TO(T1)                         
  SELECT FROM(CON) TO(OUT) ON(1,9,CH) NODUPS       
//DFSPARM  DD *                                     
  OPTION VSAMIO,RESET                               
/*
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Sep 24, 2007 11:49 am    Post subject: Reply with quote

Quote:
i am not quite clear as want u mean for //CON DD DSN=YOUR VSAM DELETE REC FILE


Kolusu's response was for this situation:

Quote:
Challenge 2:(Delete)
- Seq file having record keys
- VSAM file has around 100 records


Code:

//CON      DD DSN=YOUR VSAM DELETE REC FILE,                     
//            DISP=SHR                                           
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1     


The first file here (YOUR VSAM DELETE REC FILE) refers to the "seq file having record keys". The second file here (&T1) refers to the temporary file created by the COPY operator.

Quote:
can you help me i want to delete the records from an existing dataset and lod the records from one more new dataset as initially went i loaded the records i missed out to keep one field blanks.


It's not clear what you want to do. Do you want to remove all of the records from a VSAM data set, and then load new records from a sequential data set, or what?

What is the starting position and length of the KSDS key? Are all of the records in the KSDS the same length or does the length vary?

What is the RECFM and LRECL of the sequential data set you want to load the records from? Are the records to be loaded already in the correct key order for the KSDS file?

You need to explain more clearly what you're trying to do.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Sep 24, 2007 12:10 pm    Post subject: Reply with quote

Frank,

Thank you for your answer.

It's not clear what you want to do. Do you want to remove all of the records from a VSAM data set, and then load new records from a sequential data set, or what?

Ans: exactly yes

What is the starting position and length of the KSDS key? Are all of the records in the KSDS the same length or does the length vary?

Ans: starting pos is 1 and the length is 3 bytes

What is the RECFM and LRECL of the sequential data set you want to load the records from? Are the records to be loaded already in the correct key order for the KSDS file?

Ans: RECFM = FB LRECL = 50 , yes the records to be loaded are already in the correct key for the KSDS file.

You need to explain more clearly what you're trying to do.

Ans: I have already records in a ksds in sorted order , now i dot not have tools to delete the records , so i would like to delete the records by using Kolusu method and i would like to load the records once again from a sequential file.Hope i am clear.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Sep 24, 2007 12:11 pm    Post subject: Reply with quote

Frank,

Further more all records of the ksds have equal length.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Sep 24, 2007 1:12 pm    Post subject: Reply with quote

This is actually a much simpler case than those in the the post Kolusu responded to. In your case, you just want to delete all of the records from the VSAM KSDS and load new records from a sequential data set that has the records in the correct order, and all of the records are the same length (50 bytes). As long as the VSAM KSDS was defined with REUSE, you can use DFSORT's RESET option and just COPY the records into the VSAM KSDS directly. Here's the DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/50)
//SORTOUT DD DSN=...  output file (VSAM)
//SYSIN    DD    *
  RECORD TYPE=F
  OPTION COPY,RESET
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Sep 24, 2007 10:42 pm    Post subject: Reply with quote

Thanks Frank for your answer.

I still i have two questions:

a) if the vsam dataset is not defined as REUSE - how do we delete the records of the vsam dataset

b) how kolusu answer is different from the answer u have posted , are they doing the same purpose and i was unable to understand kolusu's post.

Thank You.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 25, 2007 11:22 am    Post subject: Reply with quote

a) I'm not a VSAM expert, but I suspect you need REUSE in order to keep the VSAM data set and reload it. Without REUSE, I'd guess you'd need to DELETE the KSDS and DEFINE it again before you load it. I'm sure somebody who knows VSAM better will correct me if I'm wrong (which I well might be).

b) Kolusu's post was in response to a request to only delete certain records based on a list of keys. Your request is to delete all of the records and then reload the file.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group