Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COBOL program to delete datasets

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Tue Apr 15, 2008 8:02 pm    Post subject: COBOL program to delete datasets
Reply with quote

I'm in the process of automating a daily proces that happens , I have around 4000 datasets to be deleted, but they are with different qualifiers.
I just want to know is there any way to write a COBOL program to delete the datasets.

Regards,
Mohan
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 15, 2008 8:15 pm    Post subject:
Reply with quote

you could use dynamic allocation for a cobol program.

easier would be:

1. generate a list of datasets.
2. use this list as input to (anything - rexx, sort, cobol) to build DD statements for a step with IEFBR14, with disp=old,delete,delete.

keep in mind there are limits to the number of dd statements for a step and a job.

a cobol program with dynamic allocation might be quicker to write, but
a generated job that would have a dd statement for each ds would leave an easy audit trail to follow.

my personal opinion (no technical grounds) would be that the IEFBR14 job would run quicker.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Apr 15, 2008 8:19 pm    Post subject: Reply to: COBOL program to delete datasets
Reply with quote

I'm confused! icon_confused.gif

How would a COBOL program delete datasets, and more importantly, why would you write a program to do this? Usually you'd use Access Method Services (IDCAMS) to delete a given list of datasets.
Back to top
View user's profile Send private message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Tue Apr 15, 2008 8:28 pm    Post subject: Thanks to every one !! Lemme give my full requirement now!!
Reply with quote

Hi all,

1) i have 4000 DSN s copied in a dataset.
2) I jus want to know is there any utility or program or code to delete the datasets(4000) that are located in a dataset.

could u assist me which process would b simple , JCL iefbr14 r IDCAMS or is there any COBOL prog.

Thanks,
Mohan
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Apr 15, 2008 8:36 pm    Post subject:
Reply with quote

What is the format of the dataset that contains the list of datasets. If you can format it properly then you can use IDCAMS to do the deletes.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Apr 15, 2008 11:03 pm    Post subject:
Reply with quote

Is this intended as a production job? Test? Where does the file get updated? Prod? Test?

Some solutions are OK in test; not OK in prod. Please provide ALL details for the best answer.
Back to top
View user's profile Send private message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Wed Apr 16, 2008 10:10 am    Post subject: HI MMwife,
Reply with quote

It s all gonna be a test datasets , that we have used during our testing process.It s of no use absolutely in future. So we want to delete it , since the count is very high around 4000 datasets , i need a jcl code or cobol code to delete the all 4000 datasets at a single stretch , will it be possible.

Kindly help me in this regard.

thanks in advance,

regards,
Mohan
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Apr 16, 2008 10:52 am    Post subject:
Reply with quote

I would go for REXX.

O.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Apr 16, 2008 11:01 am    Post subject: Reply to: COBOL program to delete datasets
Reply with quote

if all the datasets with the same high level qualifier can be deletete

idcams delete hlq1.hlq2.hlq3.*
wiil do the job
the star is a generic placeholder for just one qualifier

another solution could be to run a dfdss job wit a dummy output

(the filtering capabilities of dfdss are quite sophisticated)
check the manual
Back to top
View user's profile Send private message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Wed Apr 16, 2008 11:07 am    Post subject: hi ENRICO
Reply with quote

In my requirement I have hlq1.hlq2.****.*** here hlq1 and hlq2 alone is common in all my datasets, the 3rd and 4th qualifier differs in all datasets.

Can you please gimme the sample JCL to get through this process.

Thanks ,
Mohan
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Apr 16, 2008 11:25 am    Post subject: Reply to: COBOL program to delete datasets
Reply with quote

here is a link to the filterin specs for dfdss
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dgt2u261/3.2.1?ACTION=MATCHES&REQUEST=filtering&TYPE=FUZZY&SHELF=DGT2BK70&DT=20080128192112&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

here is the link to the dfdss reference
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2S261/CCONTENTS?SHELF=DGT2BK70&DN=SC26-7402-09&DT=20080128160125


sample jcl
Code:
//JOB      JOB   ACCOUNTING INFORMATION,REGION=NNNNK   
//STEP1    EXEC  PGM=ADRDSSU                           
//SYSPRINT DD    SYSOUT=A                             
//DUMMYDS  DD    DUMMY,
//               DCB=(RECFM=VB,LRECL=27994,BLKSIZE=27998)
//SYSIN    DD    *                                     
  DUMP DATASET(INCLUDE(YOUR_FILTERING_SPECS) 
       OUTDDNAME(DUMMYDS) -                               
       DELETE PURGE                                   
/*                                                     


check the manual anyway
Back to top
View user's profile Send private message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Wed Apr 16, 2008 11:36 am    Post subject:
Reply with quote

Thanks enrico!!

Lemme try this , alsoI want to know is there any other simple way of doing it .

Regards,
Mohan
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Apr 16, 2008 11:40 am    Post subject: Reply to: COBOL program to delete datasets
Reply with quote

No ( or at least I have no reason/time to investigate other solutions )
isn' t the dfdss job simple enough icon_eek.gif

the filtering capabilities of idcams delete are not sophisticated as dfdss' s
(with dfdss You can filter aon substrings of a qualifier )

furthermore with dfdss has a very powerful approach to check for results

Quote:
TYPRUN=NORUN
For copy, dump, restore, compress, and release operations, only input data set selection is done without actually processing data sets. Printed output for the run indicates the data sets selected. For a defragmentation operation, the initial volume statistics are printed without actually relocating any extents. For a CONVERTV operation, a full report is produced, but no volumes or data sets are actually converted. For CGCREATE operation, only control card syntax checking is done. The task is not processed.
Back to top
View user's profile Send private message
MoganaKumaran

New User


Joined: 26 Jun 2007
Posts: 20
Location: Chennai

PostPosted: Wed Apr 16, 2008 11:50 am    Post subject:
Reply with quote

Thanks enrico.

I can go with this ...

Thannk u very much...
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Apr 17, 2008 8:39 pm    Post subject:
Reply with quote

Probably too late, but here's another:
3.4 hlq1.hlq2.*
in cmd line: SAVE list4k
This creates yrTSOid.list4y.datasets

Using EDIT delete everything except the DSN; insert " DELETE " at pos 1 of each line. e.g.:

C ALL 46 140 P'¬' '';res chg;C ALL 1 P'=' 'bDELETEb' (note: b = space)

save the results

Use following JCL:
Code:
//*                             
//STEP010  EXEC PGM=IDCAMS       
//SYSPRINT DD SYSOUT=*           
//SYSIN    DD  disp=shr,dsn=yrTSOid.list4k.datasets               
 
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DUMP DATASETS VS TRACE DATASETS! lind sh CICS 4 Tue Dec 06, 2016 11:31 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us