Page 1 of 1

Listing datasets with a particular management class

PostPosted: Tue Dec 10, 2019 5:27 pm
by jk819
Hi all. Sorry in forwards if I put this in the wrong place, but I think this problem needs to be fixed through using JCL.

I am looking for a way to tell the number of datasets which have a certain management class.
For example: MGMT01 -> 3456 datasets.
I'd like to check some management classes which are in scope for deletion, if they really have 0 datasets (in other words I want to make sure that no datasets use that management class).

Is it possible to do that? I looked at some listcat and idcams dcollect related stuff, but I don't seem to be able to find anything that can help me with this task.

Thank you in forwards for your time and tips (if you have any that could help). :)

Re: Listing datasets with a particular management class

PostPosted: Wed Dec 11, 2019 12:46 am
by vasanthz
The easiest solution is to run DCOLLECT and then process the D type records from the DCOLLECT output file.

The D type records will have information of datasets including their Management classes.
By summarizing the D type records you could identify the number of datasets in a Management Class.

Re: Listing datasets with a particular management class

PostPosted: Wed Dec 11, 2019 4:06 pm
by enrico-sorichetti
IMO... the fastest way should be to use the ISMF application

the permissions to use the ISMF application are certainly less than the permissions needed to run a DCOLLECT

Re: Listing datasets with a particular management class

PostPosted: Wed Dec 11, 2019 6:37 pm
by jk819
enrico-sorichetti wrote:IMO... the fastest way should be to use the ISMF application

the permissions to use the ISMF application are certainly less than the permissions needed to run a DCOLLECT


Could you specify a bit more in detail? I checked ISMF but I didn't find anything that could be used for this purpose. The management classes can be listed, you can't see if they are used by anything or not.

Re: Listing datasets with a particular management class

PostPosted: Wed Dec 11, 2019 7:11 pm
by enrico-sorichetti
ISMF provides a Dataset listing facility with a pretty sophisticated filtering capability

Re: Listing datasets with a particular management class

PostPosted: Thu Dec 12, 2019 6:02 pm
by jk819
I have found a solution, I'll post it here for everyone who would need something similar.

For the data collection part:

//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//OUTDS    DD DSN=&&DATASETS,
//            DCB=(RECFM=VB,LRECL=644,BLKSIZE=0),
//            SPACE=(CYL,(500,100),RLSE),DISP=(,KEEP,KEEP)
//SYSIN    DD     *
DCOL OFILE(OUTDS) ELIMIT(30) NOVOLUMEINFO -
STORAGEGROUP(<every storage group present on the system>)

//* This first part collects data from every storage group on the sytem and then puts it into a temporary data set.

//STEP2   EXEC PGM=IKJEFT01,DYNAMNBR=99,REGION=0M
//SYSEXEC  DD DSN=&SYSUID..DCOL.CNTL,DISP=SHR
//INDS     DD DSN=&&DATASETS,DISP=SHR
//OUTDS    DD DSN=<your output ds name>,DISP=(,CATLG),
//            SPACE=(CYL,(300,100),RLSE),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=1600)
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN  DD *
 %DCOLR

//* This second part "filters" the temporary dataset and creates a formatted dataset which will contain the list of datasets that use the management class(es) chosen in the "DCOLR", which is actually a REXX.
 

DCOLR:

/* REXX */
Z = 0
DO FOREVER
 IF RC > 0 THEN LEAVE
 "EXECIO 1 DISKR INDS "
 PULL RECORD
 MC = SUBSTR(RECORD,199,8)
 IF MC = "<mcname1>" !,
    MC = "<mcname2>" THEN DO         /* You can add as many management classes as you want, here I set 2 */
  NAME = SUBSTR(RECORD,25,44)
  Z = Z + 1
  IR.Z = NAME MC
 END
END
"EXECIO 0 DISKR INDS (FINIS"
"FREE F(INDS)"
"EXECIO * DISKW OUTDS (STEM IR. FINIS"
"FREE F(OUTDS)"
 


It might not be perfect, but in my current question it works (concerned about the larger number of storage groups).