(Originally posted 2015-09-30.)
DB2 Accounting Trace names are a(n endless)  source of fascination to me.
As many of you know, bridging the gap between DB2 and callers and the environment is permanently an imperative for me. These names might be cryptic but they can usually be related to non-DB2 concepts. As I’m about to explain this to colleagues at work I thought I might as well explain it to the world (or at least my readership). So here goes.
(Note: I explained this for IMS Batch in Finding The DB2 Accounting Trace Records For an IMS Batch Job Step but now I want to do it for non-IMS Batch and CICS.)
DB2 Accounting Trace (SMF 101) has three fields of particular interest, which behave differently depending on the type of working coming into DB2.
- Connection Type (QWHCATYP) – a 1-byte integer
- Connection Name (QWHCCN) – a 8-byte character string
- Correlation ID (QWHCCV) – a 12-byte character string
Here’s a diagram, illustrating these 3 fields and how they behave for Batch (like) and CICS connection types.
Connection Type tells you which style of connection the SMF 101 refers to. For example TSO, BATCH, DB2CALL, CICS, DDF. 
Connection Name is interesting for CICS: It’s the CICS region name.
Correlation ID is interesting for CICS and for Batch, but each is differently treated:
- For CICS the middle 4 bytes are the CICS Transaction ID.
- For Batch the first 8 bytes are the Job name.
By the way Connection Types “TSO”, “DB2 Call”,“Utility” and “Batch” are often Batch, regardless of what they look like. They just represent different ways of getting to into DB2 from a batch job step.
I think I’ll add a slide for this to my “DB2 Through My Eyes” Presentation.
Oh, and this is just Batch and CICS. DDF has even more information in the QMDA and QLAC sections. Perhaps I should write about that some time.
25 years so far, but who’s counting? 🙂 ↩
Constant-value symbols are defined in the mapping macro for each supported type. For example QWHCCICS. ↩
The first four are strings such as “POOL” and “ENTR”, telling you what kind of CICS / DB2 Connection thread this is. The last four are the commit number. ↩