Package com.blackhillsoftware.json.cics


package com.blackhillsoftware.json.cics
This package provides classes to summarize CICS transaction data. CICS transactions generate a lot of SMF data, so specific classes are provided to help summarize CICS transaction data.

CicsTransactionGroup summarizes information from a group of transactions.

CicsTransactionGroupFactory creates multiple CicsTransactionGroups using a shared configuration.

HashKey provides a class that can be used as a key when grouping transactions.

Usage

This example shows how to read and group CICS transaction data. It assumes you have created a SmfRecordReader to read the data and configured it to include only SMF type 110 records.

  1. Create the CicsTransactionGroupFactory and modify the configuration as required.
  2. Create a HashMap mapping HashKey to CicsTransactionGroup
  3. Read the SMF records and sections and:
    1. Create the key from fields as required
    2. Use computeIfAbsent to check for an existing entry for that key and create a new group if required
    3. Add the data to the group

Summarized Data

Data in a CicsTransactionGroup is summarized as follows:

Numeric field Count/Packed

  • min - minimum value
  • max - maximum value
  • total - the sum of values

Clock Field

  • min - minimum value in seconds
  • max - maximum value in seconds
  • total - the sum of values in seconds

    If CicsTransactionGroupFactory.clockDetail(boolean) equals true additional values are included:

  • count - the sum of count values from the clock entries, which is not necessarily the same as the number of transactions
  • flags - flag values from all the transactions in the group are ORed to give the group flag value

Byte String Field

  • values - an array of unique Strings

Timestamp Field

  • min - minimum value
  • max - maximum value

Errors

If errors were encountered reading data, an "errors" entry will be added with up to 3 different error messages.

Sample Code:

     // Create the CicsTransactionGroupFactory and setup the configuration
     CicsTransactionGroupFactory factory = new CicsTransactionGroupFactory()
          .exclude(Field.START)
          .exclude(Field.STOP);
     
     Map<HashKey, CicsTransactionGroup> txGroups = new HashMap<>();
        
     for (SmfRecord record : reader)
     {
         Smf110Record r110 = Smf110Record.from(record);
         for (PerformanceRecord txData : r110.performanceRecords())
         {
         
             // Create the key to group transactions as required
             HashKey key = HashKey.of("tran", txData.getField(Field.TRAN))
                     .and("applid", r110.mnProductSection().smfmnprn())
                     .and("time", 
                          txData.getField(Field.STOP).truncatedTo(ChronoUnit.MINUTES));
                          
             // Get an existing or new group from the factory 
             // and add the transaction information
             txGroups.computeIfAbsent(key, x -> factory.createGroup())
                     .add(txData);
         }
     }