Skip navigation links

EasySMF:JE Home

Package com.blackhillsoftware.smf.db2

This package provides support for DB2 SMF records.

See: Description

Package com.blackhillsoftware.smf.db2 Description

This package provides support for DB2 SMF records. The specific section mappings are in package com.blackhillsoftware.smf.db2.section

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 Smf100Record(record)
  4. Process information from the specific record as required

DB2 Record Compression

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

IFCID

The IFCID of the record can be determined using the SmfDb2Record.ifcid() method.

Accessing Record Data

DB2 records are typically made up of a varying number of sections of different types. 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. However, you may need to check the IFCID if the section is present in multiple IFCIDs but you want data from a specific IFCID.

Example

The following code reads all Qwos sections from type 100 SMF records from the DD INPUT.
 
 try (SmfRecordReader reader = 
         SmfRecordReader.fromDD("INPUT").include(100))  // include only type 100 records
 {                                                                                       
     for (SmfRecord record : reader)                    // read each record                                                    
     {
         Smf100Record r100 = new Smf100Record(record);  // construct a Smf100record
         for (Qwos qwos : r100.qwos())                  // process 0 or more Qwos sections
         {
             //...                                      // process Qwos sections here
         }          
     }
 }                                                      // reader automatically closed at end
                                                        // of try with resources block.
                                  
 
Of course the inner loop can be replaced with whatever processing you need to do with the record.

See SmfRecordReader for an example of code that will 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.