Direct Known Subclasses:
Smf100Record, Smf101Record, Smf102Record

public class SmfDb2Record extends SmfRecord
Base for SMF 100, 101 and 102 DB2 records. Provides methods to determine the IFCID and get the common DB2 headers.

Typically you would not create SmfDb2Records directly, instead create the specific type e.g. Smf100Record

DB2 section mappings are in package com.blackhillsoftware.smf.db2.section

Processing DB2 Records

Typical steps to process DB2 records 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.
    Smf100Record.from(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 for 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 = Smf100Record.from(record); // construct a Smf100record
         // Example : process QWOS sections
         for (Qwos qwos : r100.qwos())                  // process 0 or more sections
         {
             //...                                      // do stuff
         }          
     }
 }                                                      
 // reader automatically closed at end of try with resources block
                                  
 
  • Field Details

  • Constructor Details

    • SmfDb2Record

      public SmfDb2Record(byte[] data)
      Constructs an SmfDb2Record from the specified byte array.
      Parameters:
      data - a byte array containing the SMF record data
    • SmfDb2Record

      public SmfDb2Record(SmfRecord record)
      Constructs a new SmfDb2Record from an existing SMF record. The 2 records share the same data byte array.
      Parameters:
      record - an existing SMF record
  • Method Details

    • from

      public static SmfDb2Record from(SmfRecord record)
      Constructs a new SmfDb2Record from an existing SMF record. The 2 records share the same data byte array.
      Parameters:
      record - an existing SMF record
    • from

      public static SmfDb2Record from(byte[] data)
      Constructs an SmfDb2Record from the specified byte array.
      Parameters:
      data - a byte array containing the SMF record data
    • decompress

      public SmfDb2Record decompress()
      Decompress the data and return a new SmfDb2Record created from the uncompressed data. Useful if you want to write the uncompressed record to a new file.
      Returns:
      a SmfDb2Record without CSRCESRV compression
    • usedCompression

      public boolean usedCompression()
      Was the data used to create this DB2 SMF Record compressed using CSRCESRV?
      Returns:
      true if the record data was compressed
    • smfDb2len

      public int smfDb2len()
      SMFDB2LEN value.
      Returns:
      int SMFDB2LEN value
    • smfDb2sgd

      public int smfDb2sgd()
      SMFDB2SGD value.
      Returns:
      int SMFDB2SGD value
    • smfDb2flg

      public int smfDb2flg()
      SMFDB2FLG value.
      Returns:
      int SMFDB2FLG value
    • smfDb2rty

      public int smfDb2rty()
      SMFDB2RTY value.
      Returns:
      int SMFDB2RTY value
    • smfDb2tme

      public LocalTime smfDb2tme()
      SMFDB2TME as a LocalTime.
      Returns:
      LocalTime SMFDB2TME Time
      See Also:
    • smfDb2tmeRawValue

      public long smfDb2tmeRawValue()
      SMFDB2TME raw value
      Returns:
      long SMFDB2TME value
    • smfDb2dte

      public LocalDate smfDb2dte()
      SMFDB2DTE as a LocalDate.
      Returns:
      LocalDate SMFDB2DTE Date
      See Also:
    • smfDb2dteRawValue

      public int smfDb2dteRawValue()
      SMFDB2DTE raw value.
      Returns:
      int SMFDB2DTE value
    • smfDb2sid

      public String smfDb2sid()
      SMFDB2SID value.
      Returns:
      String SMFDB2SID value
    • smfDb2ssi

      public String smfDb2ssi()
      SMFDB2SSI value.
      Returns:
      String SMFDB2SSI value
    • smfDb2stf

      public int smfDb2stf()
      SMFDB2STF value.
      Returns:
      int SMFDB2STF value
    • smfDb2seq

      public long smfDb2seq()
      SMFDB2SEQ value.
      Returns:
      long SMFDB2SEQ value
    • smfDb2cmp

      public boolean smfDb2cmp()
      Return true if SMFDB2CMP bit in smfDb2seq() is set.
      Returns:
      boolean SMFDB2CMP bit is set in smfDb2seq()

      SMFDB2CMP = 0x80

    • smfDb2buf

      public long smfDb2buf()
      SMFDB2BUF value, with mask 0x7FFF.
      Returns:
      long SMFDB2BUF value & 0x7FFF
    • ifcid

      public int ifcid()
      Get the IFCID from the standard header
      Returns:
      int IFCID value
    • qwhs

      public Qwhs qwhs()
      Get the standard header (QWHS) for this record
      Returns:
      DB2 standard header
    • qwhc

      public Qwhc qwhc()
      Get the Correlation header (QWHC) for this record
      Returns:
      DB2 Correlation Header or null if it is not found
    • qwht

      public Qwht qwht()
      Get the Trace header (QWHT) for this record
      Returns:
      DB2 Trace Header or null if it is not found
    • qwhu

      public Qwhu qwhu()
      Get the CPU header (QWHU) for this record
      Returns:
      DB2 CPU Header or null if it is not found
    • qwhd

      public Qwhd qwhd()
      Get the Distributed header (QWHD) for this record
      Returns:
      DB2 Distributed Header or null if it is not found
    • qwha

      public Qwha qwha()
      Get the Data Sharing header (QWHA) for this record
      Returns:
      DB2 Data Sharing Header or null if it is not found