Black Hill Software

  • Home
  • Products
    • EasySMF
      • Release Notes and Latest Version
      • Online Manual
      • License Agreement
    • EasySMF:JE
      • EasySMF:JE Java Quickstart
      • Release Notes and Latest Version
      • Javadoc
      • EasySMF JSON Javadoc
      • License Agreement
    • 30 Day Trial
  • Purchase
    • How to Buy
    • Purchase a License
  • Support
    • EasySMF Support
    • Get the latest version of EasySMF
    • EasySMF:JE Support
    • Get the latest version of EasySMF:JE
  • News
  • Contact
    • Support
    • Sales

Java API for DB2 SMF Records

May 19, 2016 by Andrew

Version 1.2.0 of the EasySMF:JE Java API is now available.

Major Changes

  • SMF Type 89 Support
  • SMF type 42 Support
  • DB2 SMF type 100 and 101 support

Java API for DB2 SMF Records

This support is currently experimental while we learn more about the specifics of DB2 SMF data. Breaking changes to the API are more likely while it is in experimental status.

Using the API

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.

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. Conversions are the same as for other SMF record types.

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.

  • Times representing a duration e.g. CPU or elapsed time are converted to Duration.
  • Dates and times of day are converted to LocalDate, LocalTime, LocalDateTime or ZonedDateTime depending on exactly what information is in the field. Typically, times based on UTC(GMT) are converted to ZonedDateTime with ZoneOffset.UTC. Other dates and times are converted to LocalDate/Times.
    Java has time zone rules so it is possible to apply a ZoneId to a LocalDateTime and perform date aware conversions between time zones.

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

Numeric Values
  • 1, 2 and 3 byte integer values and 4 byte signed integer values are converted to int (32 bit signed) values.
  • 4-7 byte integer values and 8 byte signed values are converted to long (64 bit signed).
  • 8 byte unsigned values are available as both long (64 bit signed) and as a BigInteger. The long value may provide better performance if the value will not exceed the maximum value for a long. If a value does exceed the maximum value (i.e. the high order bit is set) an exception will be thrown.
    If the field value might exceed the maximum value for a long, use the BigInteger version.
  • Integer values greater than 8 bytes are converted to BigInteger.
  • Floating point values are converted to Java double.

Filed Under: Uncategorized

30 Day Trial

EasySMF and EasySMF:JE are available for a free 30 day trial. Download now and start using them immediately.
30 Day Trial

Information

EasySMF:JE Java API for SMF Quickstart

EasySMF:JE Sample 1 : SMF Records by type and subtype

Systems Programmer Friendly Java

Sending Email from z/OS using Java

Sign up for EasySMF News

Stay up to date. Enter your email address to receive updates about EasySMF.
unsubscribe from list

Black Hill Software

Suite 10b, 28 University Drive, Mt Helen, VIC 3350, Australia
PO Box 2214, Bakery Hill, VIC 3354, Australia
+61 3 5331 8201
+1 (310) 634 9882
info@blackhillsoftware.com

News

  • Finding UID 0 work on z/OS using SMF Data
  • Apache Log4j CVE-2021-44228 Information
  • Java vs C++ : Drag Racing on z/OS

Twitter

My Tweets

Copyright © 2023 · Enterprise Pro Theme on Genesis Framework · WordPress · Log in