DB2 accounting data attributes CPU, elapsed time, SQL activity, locking, and waits to plans, packages, and authorization IDs. On z/OS the primary external record is IFCID 3 in SMF type 101, with package detail in IFCID 239 when package classes are active. This tutorial shows how to ensure the right classes are on, how to extract readable reports, and how to interpret the numbers for tuning.
Accounting begins when a thread successfully allocates to Db2 and completes when the thread terminates, is reused, or the authorization ID changes in ways that cut an accounting interval. Class 1 produces the external IFCID 3 record. Classes 2 and 3 do not write separate SMF floods for every entry/exit; they populate in-Db2 time and wait-time buckets inside that accounting record. Class 1 must be active to externalize the enriched data.
Package-level accounting uses IFCID 239. Classes 7 and 8 build package CPU and wait information; class 10 adds richer package detail such as SQL and getpage-oriented metrics depending on release. Statistics traces (SMF 100) describe the subsystem; accounting (SMF 101) describes application units of work. You usually need both views, but this page focuses on reading accounting.
Confirm SMF is collecting type 101 for the Db2 subsystem, and that accounting was enabled at install (DSNTIPN SMF ACCOUNTING) or started with -START TRACE. Many shops keep accounting classes 1, 2, and 3 on continuously, and add 7, 8, and often 10 for package insight. Coordinate with performance and capacity teams before changing trace classes in production.
Identify how your site reads SMF: IBM Omegamon, BMC, CA/Broadcom, Omegamon Distributed Gateway, custom DFSORT/ICETOOL jobs, or vendor accounting reporters that understand DSNDQW* mappings. Have the plan name, package, authid, connection, and time window for the problem you are investigating.
Display active traces and verify accounting classes. If class 1 is missing, start it to SMF. Add classes 2 and 3 so class 2 CPU/elapsed in Db2 and class 3 suspension times are meaningful. For package rollups start classes 7 and 8, and class 10 when you need detailed package counters.
Avoid leaving high-volume performance trace classes on indefinitely. Accounting classes 1–3 (plus package classes) are the steady-state recommendation in many sites; performance traces are for scoped diagnosis.
123-DISPLAY TRACE(ACCTG) -START TRACE(ACCTG) CLASS(1,2,3) DEST(SMF) -START TRACE(ACCTG) CLASS(7,8,10) DEST(SMF)
Dump or select SMF 101 for the interval, then run your accounting reporter filtered by plan, package, authid, connection type, or correlation ID. Read class 1 elapsed and CP/specialty CPU first to see cost. Use class 2 to see time spent in Db2 versus application. Use class 3 waits—lock/latch, I/O, drain, service task, and others—to find where elapsed time went.
At package level, find the packages that dominate CPU or wait. Compare getpages, sync I/O, and SQL counts with buffer pool and access-path evidence. In data sharing, filter by member so you do not mix different LPAR CPU stories incorrectly. Always align the accounting interval with the business incident time, including local time versus GMT in the tool.
Verification means the report contains the expected plan or package for a controlled test transaction you just ran, with non-zero SQL counts and sensible elapsed times. If class 2/3 fields are zero or missing while class 1 exists, the enrichment classes were not active for that interval. If IFCID 239 is absent, package classes were off.
Cross-check a single thread’s accounting totals against an online monitor snapshot when possible. Document the trace classes in effect for the interval in your tuning note so others can reproduce the analysis.
No SMF 101 usually means accounting not started, SMF not collecting type 101, or records still in buffers not yet dumped. Empty class 2/3 wait sections mean those classes were off. Huge record volume after starting performance classes by mistake is a different problem—stop the extra traces.
Misinterpretation is common: comparing class 1 elapsed across different commit frequencies, ignoring thread reuse, blaming Db2 for application time outside class 2, or reading package CPU without class 7/10. In data sharing, forgetting member filters produces nonsense rankings. Fix collection first, then interpret.
Accounting data is Db2’s receipt for each visitor’s shopping trip. It says how long they stayed, how long they stood in Db2’s aisles, and whether they waited for locked doors or slow shelves. SMF keeps the receipts. Your report tool reads the receipts so you can see which shopping trips were expensive.
1. Which SMF type carries Db2 accounting IFCID 3?
2. Why start accounting classes 2 and 3?
3. What does IFCID 239 provide?