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

defining a dataset


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rashmi.ranjan75

New User


Joined: 20 Feb 2006
Posts: 34

PostPosted: Wed Mar 29, 2006 8:18 pm
Reply with quote

Hello,

How can i perform following step in a jcl for sequential dataset

Overwrite if exist and else create

Please suggest

regards
rashmi
Back to top
View user's profile Send private message
Lkmi

New User


Joined: 04 Mar 2005
Posts: 53
Location: Newyork

PostPosted: Wed Mar 29, 2006 9:21 pm
Reply with quote

include thE STEP 1 in your jcl before the step to delete the dataset(if it already exists)

//step1 EXEC UNCAT
//U.SYSIN DD *
DELETE DSN=dataset name
/*

this creates the dataset...Change values for parameters as required.
//step2 EXEC PGM= IEFBR14
//data1 DD DSN=datasetname
// DISP=(NEW,CATLG,DELETE,UNIT=SYSDA,
// RECFM=FB,LRECL=64,MGMTCLAS=MCEXP3MO,
// SPACE=(64,(1,1),RLSE)
Back to top
View user's profile Send private message
Lkmi

New User


Joined: 04 Mar 2005
Posts: 53
Location: Newyork

PostPosted: Wed Mar 29, 2006 9:27 pm
Reply with quote

BY THE WAY THE SOLUTION I GAVE WUD CREATE IF IT ALREADY EXISTS.
iam not sure if it can be overwritten
Back to top
View user's profile Send private message
rajakumar10

New User


Joined: 03 Aug 2005
Posts: 12

PostPosted: Wed Mar 29, 2006 10:03 pm
Reply with quote

use IDCAMS with the control card "LISTCAT ENT(datasetname)". This will lead to a RC of 4 if the dataset does not exist, and to a RC of 0 if it does exist.

If RC eq 0
overwrite
if RC eq 4
create

Hope this helps.
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Mar 30, 2006 5:00 pm
Reply with quote

Hi,

Adding to LKMI's solution just add following line after step1

If MAXCC=8 maxcc=0
If file does not exist it will create file in step2.

Regards
Rupesh
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 Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top