Listing datasets with a particular management class



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Listing datasets with a particular management class

Postby jk819 » Tue Dec 10, 2019 5:27 pm

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). :)
jk819
 
Posts: 3
Joined: Tue Dec 10, 2019 5:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Listing datasets with a particular management class

Postby vasanthz » Wed Dec 11, 2019 12:46 am

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.
User avatar
vasanthz
 
Posts: 27
Joined: Thu Aug 05, 2010 2:53 pm
Has thanked: 8 times
Been thanked: 0 time

Re: Listing datasets with a particular management class

Postby enrico-sorichetti » Wed Dec 11, 2019 4:06 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Listing datasets with a particular management class

Postby jk819 » Wed Dec 11, 2019 6:37 pm

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.
jk819
 
Posts: 3
Joined: Tue Dec 10, 2019 5:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Listing datasets with a particular management class

Postby enrico-sorichetti » Wed Dec 11, 2019 7:11 pm

ISMF provides a Dataset listing facility with a pretty sophisticated filtering capability
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Listing datasets with a particular management class

Postby jk819 » Thu Dec 12, 2019 6:02 pm

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).
jk819
 
Posts: 3
Joined: Tue Dec 10, 2019 5:20 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post