Skip navigation links

EasySMF:JE Home

Package com.blackhillsoftware.smf.cics

Provides support for CICS SMF records.

See: Description

Package com.blackhillsoftware.smf.cics Description

Provides support for CICS SMF records. The specific section mappings are in packages com.blackhillsoftware.smf.cics.statistics and com.blackhillsoftware.smf.cics.monitoring

Using the Package

Typical steps to use the package are:

  1. Read SMF records using the SmfRecordReader class
  2. Check the record type and other relevant attributes of each SmfRecord to see whether it is one you are interested in
  3. Create the specific record type from the SmfRecord e.g.
    new Smf110Record(record)
  4. Process information from the specific record as required

CICS Record Compression

Records compressed with CSRCESRV will be automatically expanded when the Smf110Record is constructed.

Accessing Record Data

Monitoring Performance Records

Accessing data from CICS monitoring performance records is slightly different to other SMF records because the data needs to be accessed via a Dictionary.

Dictionary records are handled automatically, however you cannot access the data from a record before a related dictionary record has been seen. You can check whether a dictionary record is available using Smf110Record.haveDictionary() or simply concatenate all required dictionary records ahead of the data records in the input data.

Specific fields are defined by name and type using entries from com.blackhillsoftware.smf.cics.monitoring. Then Performance records are read from the SMF record, and specific fields accessed using getField(...) methods or variations.

Example
 
 
 ByteStringField transactionField = ByteStringField.define("DFHTASK","C001");
 TimestampField startField = TimestampField.define("DFHCICS","T005");
 TimestampField stopField = TimestampField.define("DFHCICS","T006");
 ClockField dispatchField = ClockField.define("DFHTASK","S007");
 
 try (SmfRecordReader reader = 
         SmfRecordReader
             .fromDD("INPUT")
             .include(110, Smf110Record.SMFMNSTY))  // include only type 110 subtype 1 records
 {                                                                                       
     for (SmfRecord record : reader)                    // read each record                                                    
     {
         Smf100Record r110 = new Smf110Record(record);  // construct a Smf110record
         if (r110.haveDictionary())
         {
             for (PerformanceRecord perfdata : 
                 r110.performanceRecords())              // process 0 or more PerformanceRecord sections
             {
                 String txName = perfdata.getField(transactionField);
                 ZonedDateTime start = perfdata.getField(startField);
                 ZonedDateTime stop = perfdata.getField(stopField);
                 double dispatch = perfdata.getFieldTimerSeconds(dispatchField);
             
                 //...  process data                                    
             }      
         }    
     }
 }                                                      // reader automatically closed at end
                                                        // of try with resources block.
                                  
 

Statistics Records and other Monitoring Data

CICS records typically contain multiple data sections. Sections of a specific type are returned in a List<E> of that type. If there are no sections of the type in the record an empty List is returned. This allows you to iterate over the sections without explicitly checking whether the sections exist in the record - an empty list will iterate 0 times.

Example

The following code reads all FileControlStatistics sections from type 110 SMF records from the DD INPUT.
 
 try (SmfRecordReader reader = 
         SmfRecordReader
             .fromDD("INPUT")
             .include(110, Smf110Record.SMFSTSTY))  // include only type 110 subtype 2 records
 {                                                                                       
     for (SmfRecord record : reader)                    // read each record                                                    
     {
         Smf100Record r110 = new Smf110Record(record);  // construct a Smf110record
         for (FileControlStatistics fc : 
             r110.fileControlStatistics())              // process 0 or more FileControlStatistics sections
         {
             //...   process FileControlStatistics sections here
         }          
     }
 }                                                      // reader automatically closed at end
                                                        // of try with resources block.
                                  
 

See SmfRecordReader for an example of code to automatically select between reading from a filename passed on the command line, or from the DD named INPUT if no file is passed.

Data Conversion

The API aims to provide a consistent interface across different types and sections, and converts values to standard Java types for simple programming.

Dates and Times

Dates and times are converted to java.time classes. Java.time can represent dates and times with a precision of 1 nanosecond.

The raw numeric value of date and time fields is also provided.

Numeric Values

String Values

EBCDIC and UTF8 string/character values are converted to String. Java uses Unicode internally - values are converted from EBCDIC or UTF8.

Flags

Flag bits within a byte are converted to a boolean value indicating whether the bit is set.

If you discover a field with an incorrect data type, please report it as a problem instead of programming around it. Changing the data type will require modifications to any existing programs that refer to the field.

Skip navigation links

EasySMF:JE Home

Copyright © 2018 Black Hill Software Pty Ltd. All rights reserved.