Db2 for z/OS on IBM Z

Db2 for z/OS on IBM Z

Db2 for z/OS on IBM Z

Leading enterprise data server technology powering business critical transactions and analytics

 View Only

SMF Generation Records for IBM Change Data Capture for Db2 for Z/OS version 11.4

By Diego de Franco Matos posted Thu September 30, 2021 01:33 PM

  

Abstract:

The purpose of this document is to demonstrate, in a technical way, the configuration of the writing process of User SMF type records as well as their Layout generation (the subsequent reading of the records will not yet be covered in the scope of this document) for the IBM Change solution Data Capture for Db2 for Z/OS version 11.4, which will from now on be designated by the abbreviations of its initials: CDC

General considerations:

The following examples were run in an emulated environment using IBM zDT version 13 software, whose z/OS version is 02.03

zos_v03.02



Two steps will be covered, namely:

  1.  Write SMF user records for CDC
  2.  Generate Layout of SMF Records for CDC
Records SMF General Consideration


1.1 - Setting to Enable Writing:

First of all, two parameters are necessary to indicate to the CDC to start the writing process of the SMF records: SMFTYPE and SMFINTERVAL
Such parameters must be declared in member CHCCFGxx belonging to target dataset SCHCDATA

CDC - SMF Parameters
SMFTYPE represents a valid value between 128 to 255, taking care that the chosen value is not in use by another SMF writing process, so this value must be unique

SMFINTERVAL
the interval in s(seconds), m(minutes), or h(hours) at which CDC starts writing the SMF record at each given time interval


1.2 - Confirming that the SMF Record is being written:

- Now you can start the CDC Started-Task
- To make sure that CDC recognized correctly the SMF parameters passed before when it is Startup, take a look at the Joblog, in the CHCCFG member section, you should find both SMF Parameters there as below:

CDC_SMS_STC_SYSOUT


Now, on the SDSF: Enter /D SMF to see the Active Dataset been recorded at that moment

D_SMF_DATASETS


Ok, to check out the CDC SMF TYPES being recorded to this VSAM, you can run the Job below, passing the Dataset Name on the DSN JCL statement

//IBMUSERT JOB ('ALEXDOM'),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*
//*------------------------------------------------------------------
//* THIS PROCEDURE WILL CLEAR SMF DATA SETS OF YOUR SYSTEM
//* USING THE SMF UTILITY PROGRAM IFASMFDP.
//*------------------------------------------------------------------
//SMFCLEAR EXEC PGM=IFASMFDP
//SYSPRINT DD SYSOUT=*
//DUMPINA  DD DISP=SHR,  
//            DSN=SYS1.S0W1.MAN1
//DUMPOUT  DD DUMMY
//SYSIN    DD *
INDD(DUMPINA,OPTIONS(DUMP))
/*

Note: Thanks to Alexandre Domingues de Martino for delivery this JCL code

Looking at the JCL output, we can see that SMFTYPE=250 previously chosen for the CDC is being written:

JCL_SMF_TYPE_OUTPUT



2.1 Layout Generation

To generate the Layout, whose purpose is to display all SMF fields records for CDC, their respective types and sizes, it is necessary to invoke a Macro through an Assembly program

This macro is found in the Target-Lib SCHCMAC, and it is called CHCSMFRC:

JCL - ASM Macro
Below you find a sampled JCL for the macro invocation:


2.2 Running The Macro:

Submit this JCL below, passing the TLIB SCHCMAC and Macro CHCSMFRC into DD statements:

//ASMCHC   JOB (),,CLASS=A,MSGCLASS=H,TIME=1440, RESTART=RUN,
//         NOTIFY=&SYSUID,MSGLEVEL=(1,1),REGION=0M,COND=(4,LT)
/*
//COMPILE  EXEC ASMACL,PARM.L='MAP,LET,LIST,CALL'
//C.SYSLIB DD
//         DD DISP=SHR,DSN=CDC.V11R4.SCHCMAC
//L.SYSLIB DD DISP=SHR,DSN=CDC.V11R4.LINKLIB
//L.SYSLMOD DD DISP=SHR,DSN=CDC.V11R4.LINKLIB(CHCSMF)
//C.SYSIN  DD *
         TITLE 'PROGRAM ASMCHC'
         PRINT GEN
ASMCHC   CSECT 
         YREGS                     EQUATE DE REGS.
         STM   R14,R12,12(R13)     SALVA REGISTRADORES
         LR    R12,R15             CARREGA R15 EM R12
         USING ASMCHC,R12          SETA REG. BASE
         LA    R10,SAVEAREA        SETA LINKAGE
         ST    R13,4(,R10)         "
         ST    R10,8(,R13)         "
         LR    R13,R10             "
*PROGRAMA FONTE
*FIM
         LA    R15,0               ZERA RETURN-CODE
         LR    R1,R13              PREPARA SAIDA DO PROGRAMA
                     L     R13,4(,R13)         "
         L     R14,12(,R13)        RESTAURA R14
         LM    R2,R12,28(R13)      RESTAURA R2 - R12
         BR    R14                 SAIDA DO PROGRAMA
         LTORG
         DS    0F
SAVEAREA DS    18F                 SAVEAREA
         CHCSMFRC LIST=YES,NOTES=NO
         END
/*
//

Note: Thanks to Gustavo Lozano for delivery this JCL code

The above JCL generates as a result the Layout for the SMF records written by the CDC

2.3 LAYOUT

The fields are grouped into task names categories where each has a type of responsibility

https://www.ibm.com/docs/en/idr/11.4.0?topic=records-cdc-tasks-referenced-in-smf

To calculate the length of each segment it is necessary to apply hexadecimal arithmetic, subtracting the Offset value from the previous Offset value

Task data segments that describe the data written by the different task types do not appear in the SMF user record in any particular order. When coded logic is "walking" over the task data segments in a record, each segment must be identified by the segment header's content and not by its position in the SMF record

OSC Task segment:

Layout

Summary:

In this tutorial, you learned how to:
1 - How CDC is configured to start recording SMF records
2 - Check if these Records are being recorded
3 - How to generate the Layout for these Records

Thank you
1 comment
20 views

Permalink

Comments

3 days ago

Hello Diego, 

thanks for this, it's very interesting.

Do you know if this SMF data could help for auditing for example, who/what/when is using this CDC?

Thanks!