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

Deleting a member of a dataset through a jcl job


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Thu Sep 11, 2008 3:01 pm
Reply with quote

Hi ,

How can we delete a member in a dataset through a JCL job, not manually.



Thanks...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Sep 11, 2008 3:02 pm
Reply with quote

Look at IDCAMS DELETE
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Sep 11, 2008 3:10 pm
Reply with quote

Abhishek,

Got this after a search. See if it helps.

SCRATCH.





But best way is to follow what Expat had suggested.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 11, 2008 4:51 pm
Reply with quote

Hi,

the only thing I don't like about IDCAMS is that if the dataset is in use (not the member), the job fails as it wants exclusive access to the dataset

IKJ56225I type ALREADY IN USE, TRY LATER + DATA SET IS ALLOCATED TO
ANOTHER JOB OR USER


Gerry
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Thu Sep 11, 2008 5:20 pm
Reply with quote

even IKJEFT01 gives the same error message IKJ56225I when trying to delete the member of an allocated dataset.

something to do with address spaces?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 11, 2008 5:27 pm
Reply with quote

Hi,

you can always use IEHPROGM


Gerry
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Thu Sep 11, 2008 8:12 pm
Reply with quote

IEHPROGM also requires exclusive control.

Our solution was to write a utility that did ISPF-like END/DEQ around the delete. This allowed DISP=SHR to share the PDS with the TSO community. The ISPF Edit Guide describes the ENQ resource names.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 12, 2008 3:27 am
Reply with quote

Hi Bill.

I have to disagree with you Bill, IEHPROGM does not require exclusive control.

Gerry
Back to top
View user's profile Send private message
abhishek dadhichi

New User


Joined: 19 Apr 2007
Posts: 37
Location: Bangalore

PostPosted: Fri Sep 12, 2008 9:58 am
Reply with quote

Hi..

I tried with IDCAMS DELETE and it worked for me..Thanks all for the quick response..



Thanks..
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Sep 12, 2008 11:11 am
Reply with quote

Good that it is working and thanks for the follow-up.
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Sep 12, 2008 2:37 pm
Reply with quote

hi gcicchet,

Quote:
I have to disagree with you Bill, IEHPROGM does not require exclusive control.


can u please give an example of the jcl.. i couldn't find in the manual..
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 12, 2008 2:44 pm
Reply with quote

Hi,

tested example below
Code:
//SCRATCH  EXEC PGM=IEHPROGM                                     
//SYSPRINT DD SYSOUT=*                                           
//VOL1     DD UNIT=SYSDA,VOL=SER=DEV012,DISP=OLD                 
//SYSIN    DD *                                                   
  SCRATCH DSNAME=CSCSGLC.PDS1,VOL=SYSDA=DEV012,MEMBER=AA         
/*                                                               



Gerry
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Sep 12, 2008 2:45 pm
Reply with quote

Genesis,

Quote:
can u please give an example of the jcl.. i couldn't find in the manual..


Check the manual links shown below.

IEHPROGM EXAMPLES

Below link is for the OP's requirement

IEHPROGM - DELETING A MEMBER
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 12, 2008 2:46 pm
Reply with quote

Gerry - Are you sure that you should use DISP=OLD for the VOL1 DD ?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 12, 2008 3:01 pm
Reply with quote

Hi Expat,

the example I managed to dig up amongst some of my old JCL had DISP=OLD, I can't remember the exact reason for it but something tells me there was a reason for it although DISP=SHR seems to work ok.


I googled for some examples and sure enough, I found this example

Code:
//DELMEM   EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=*
//VOLUME   DD UNIT=SYSDA,VOL=SER=MYVOL1,DISP=OLD
//SYSIN    DD *
 SCRATCH DSNAME=MY.MEMBER.DATASET,VOL=SYSDA=MYVOL1,MEMBER=MYMEMBER
/*


This step deletes member MYMEMBER in dataset MY.MEMBER.DATASET if the member exists and if the dataset is located on volume MYVOL1. It is very irritating that you have to find out which volume the dataset is located on prior to execution of the job. It is in fact pretty ludicrous because you almost never worry about which volume a dataset is located on. IEHPROGM is the only IBM utility program that is able to delete members, so you have to care about volumes, if you want to use this program. The input line in SYSIN can be repeated as many times as you have members to delete, then all you need is to change the member names. This is straight forward if you have a list of the members to be deleted in another dataset or member.

Other examples had DISP=SHR


Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Sep 12, 2008 3:20 pm
Reply with quote

Hi Expat,

IBM manual shows all the examples with DISP=OLD

15.10.7 Example 7: Rename a Partitioned Data Set Member





In this example, a member of a partitioned data set is renamed.




//REN JOB ...
//STEP1 EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=A
//DD1 DD VOL=SER=222222,DISP=OLD,UNIT=disk
//SYSIN DD *
RENAME VOL=disk=222222,DSNAME=DATASET,NEWNAME=BC,MEMBER=ABC
/*


The control statements are discussed below:



DD1 DD defines a permanently mounted volume.


Gerry
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 12, 2008 3:27 pm
Reply with quote

OK, I trust you, just curious icon_wink.gif
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Tue Sep 23, 2008 7:20 pm
Reply with quote

found another way to do this using IDCAMS:

Code:

//DELMEM  EXEC PGM=IDCAMS,REGION=5M                     
//SYSPRINT DD SYSOUT=*                                 
//PDS DD DSN=MY.GENERAL.CLIST,DISP=SHR                 
//SYSIN DD *                                           
  ALLOC DDN(INFILE) SHR REUSE DSN('MY.GENERAL.CLIST') 
  DELETE MY.GENERAL.CLIST(MEM1) FILE(PDS)             
/*                                                     
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Deleting a Tape file JCL & VSAM 14
Search our Forums:

Back to Top