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

COBOL program to delete datasets


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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

Global Moderator


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

PostPosted: Tue Apr 15, 2008 8:19 pm
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
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
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
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
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: 2358
Location: Israel

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

I would go for REXX.

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 16, 2008 11:01 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 16, 2008 11:25 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 16, 2008 11:40 am
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts DELETE SPUFI DB2 1
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts DSNTIAUL driven delete IBM Tools 0
Search our Forums:

Back to Top