Re: Generic delete




Mark,
this is what I use to mass-delete datasets from a catalog:

/* REXX MASS DELETE ALL DATASETS BEGINNING WITH THE PREFIX YOU */
/* ENTER AS ARGUMENT */
ARG DSNPREFIX
IF DSNPREFIX = '' THEN DO
SAY A DATASET NAME PREFIX (E.G. ABC.DEF ) IS REQUIRED. REENTER
EXIT 16
END
X = OUTTRAP('OUT.')
"LISTC LEV("DSNPREFIX")"
X = OUTTRAP('OFF')
DO I = OUT.0 TO 1 BY -1
PARSE VAR OUT.I NV . WORD3 WORD4
SAY OUT.I
IF NV = 'NONVSAM' THEN "DEL '"WORD3"'"
IF NV = 'CLUSTER' THEN "DEL '"WORD3"'"
IF NV = 'GDG' THEN "DEL '"WORD4"' GDG"
END

It's rough and rudimentary, but it works for the deletions that I usually need
to perform.
It works by listing the catalog entries of the specified datasetname prefix and
then goes backwards thru the listing looking for VSAM cluster names, nonVSAM
names and GDGbases. By going backwards thru the catalog, GDG datasets are
deleted first, then the GDGbase entry is deleted (won't work otherwise) If a
VSAM cluster is found, any alternate indexes, paths, etc. are deleted
automatically, too.

Use it like this: %MASSDEL userid _or_ %MASSDEL hlq.ABC
You can use it to delete all datasets of a userid or high-level qualifier. You
can also use it to delete all datasets beginning with a certain 2 (or
more)-level dataset prefix. Anything that a LISTCAT with the LEVEL option
accepts is fair game.

Disclaimer: Be careful what DSNlevel you specify ... there's no UNDO if you make
a mistake !!!


Regards,
Ulrich Krueger
Mainframe Systems Services
National Semiconductor Corp.
Santa Clara, CA 95051
Tel:(408)721-8071 Fax:(408)721-6526
Email: ulrich.krueger@xxxxxxx
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


.



Relevant Pages

  • Re: Speed up ado updates
    ... Select FilePath from catalog WHERE ParentDirectory Is Null ... puts sql_update ... I'd make data_source and prefix constants (capital letters, ... can find out yourself using Benchmark class) ...
    (comp.lang.ruby)
  • RE: create hyperlink from predefined string+number field
    ... (The prefix is ... "Uriel TK" wrote: ... > web site catalog, that opens the web browser when clicked ... the hyperlink consists of a constant string which is ...
    (microsoft.public.access.formscoding)