On 5/06/2024 5:08 am, Billy Ashton wrote:
Hi all, this is a basic request, but I can't seem to find anything about it and hope you can help this poor old soul!

I would like to be able to generate a list of SMS classes, data, management, and storage classes, and the attributes with them, that I could somehow parse in a Rexx program.

Is there a command or program I could run and redirect the output to some sort of organized format file to get me this? For example, I would like to find all the Data classes with a RECFM/LRECL of FB/4096 that is also multi-volume or Management Classes with an expiration date < 90 days, etc.

How can I do that in a batch process I can run monthly?

This might be overkill for your requirements, but you can convert DCOLLECT information to JSON using the EasySMF Java API.

This Java program lists all SMS class information in JSON format:

import java.io.*;
import java.util.*;
import java.util.Map;
import java.util.stream.Collectors;

import com.blackhillsoftware.dcollect.*;
import com.blackhillsoftware.json.EasySmfGsonBuilder;
import com.blackhillsoftware.smf.VRecordReader;
import com.google.gson.Gson;

/**
 * Print details of SMF data, storage and management
 * classes in JSON format.
 *
 */
public class SmsClasses
{
    public static void main(String[] args) throws IOException
    {
        if (args.length < 1)
        {
            System.out.println("Usage: SmsClasses <input-name>");
            System.out.println("<input-name> can be filename, //DD:DDNAME or //'DATASET.NAME'");
            return;
        }

        try (VRecordReader reader = VRecordReader.fromName(args[0]))
        {
            Map<DcollectType, List<DcollectRecord>> smsClasses =
                    reader.stream()
                .map(DcollectRecord::from) // create DCOLLECT record
                .filter(r ->
                    r.dcurctyp().equals(DcollectType.DC)
                    || r.dcurctyp().equals(DcollectType.SC)
                    || r.dcurctyp().equals(DcollectType.MC))
                .collect(Collectors.groupingBy(r -> r.dcurctyp()));

            Gson gson = new EasySmfGsonBuilder()
                    // options to reduce the size of the output
                    .includeZeroValues(false)
                    .includeEmptyStrings(false)
                    .includeUnsetFlags(false)
                    // exclude some fields
                    .exclude("recordLength")
                    .exclude("dculeng")

                    .setPrettyPrinting()
                    .createGson();

            System.out.println(gson.toJson(smsClasses));
        }
    }
}

Sample output:

...

  "StorageClass": [
    {
      "dateTime": "2023-07-24T15:04:40.61",
      "dcollectType": "StorageClass",
      "dcudate": "2023-07-24",
      "dcurctyp": "SC",
      "dcusysid": "S0W1",
      "dcutime": "15:04:40.61",
      "dcutmstp": "2023-07-24T15:04:40.61",
      "dcuvers": 2,
      "dscacces": "CONTINUOUS",
      "dscavail": "DONTCARE",
      "dscdate": "2021-11-11",
      "dscdesc": "ZCX CONTAINER STORAGE CLASS",
      "dscdfacc": true,
      "dscdfavl": true,
      "dscdfgsp": true,
      "dscdirb": "DONTCARE",
      "dscflag2": 128,
      "dscflag3": 64,
      "dscflags": 194,
      "dscname": "CXROOTSC",
      "dscpavs": true,
      "dscseqb": "DONTCARE",
      "dscsyncd": true,
      "dsctime": "16:56:00",
      "dscuser": "IBMUSER"
    },
    {
      "dateTime": "2023-07-24T15:04:40.61",
      "dcollectType": "StorageClass",
      "dcudate": "2023-07-24",
      "dcurctyp": "SC",
      "dcusysid": "S0W1",
      "dcutime": "15:04:40.61",
      "dcutmstp": "2023-07-24T15:04:40.61",
      "dcuvers": 2,
      "dscacces": "NO_PREF",
      "dscavail": "DONTCARE",
      "dscdate": "2021-09-16",
      "dscdesc": "STORAGE CLASS FOR DB2 V12",
      "dscdfacc": true,
      "dscdfavl": true,
      "dscdirb": "DONTCARE",
      "dscflag2": 128,
      "dscflag3": 64,
      "dscflags": 64,
      "dscname": "DBCGSC",
      "dscpavs": true,
      "dscseqb": "DONTCARE",
      "dsctime": "10:11:00",
      "dscuser": "IBMUSER"
    },

...

This works for all DCOLLECT record types (and SMF record types supported by EasySMF) .

You can also do filtering by various fields, calculations etc - whatever is required.


--
Andrew Rowley
Black Hill Software

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to