API Accounting

API accounting tells you which applications are hammering IBM MQ—not just which queues are full. When ORDERS.IN depth spikes, queue statistics show the backlog; API accounting shows whether PAYMENT_SVC opened ten thousand connections or BATCH_JOB issued a burst of MQPUT calls. Enterprise teams use accounting for chargeback, capacity planning, and security audits proving which service accounts touched production queues overnight. Beginners enable ACCTMQI, never read the accounting queue, and wonder why SYSTEM.ADMIN.ACCOUNTING.QUEUE OFLOW appears during month-end. This tutorial explains enabling MQI accounting on the queue manager, accounting interval and rollover, what fields typically appear in accounting messages, building consumers for Splunk or databases, comparing accounting to STATQ and channel statistics, privacy and retention policy, and operational practices that turn raw accounting into decisions.

Accounting vs Statistics vs Events

Three observability streams
StreamGranularityAnswers
API accountingApplication / connection over intervalWho called MQ and how much?
Queue statisticsPer queue objectHow busy is this queue?
Performance eventsThreshold crossingDid depth cross the red line now?

Enabling API Accounting

shell
1
2
3
4
5
6
ALTER QMGR ACCTMQI(ENABLED) DISPLAY QMGR ACCTMQI ACCTINT * ACCTINT — accounting interval; verify meaning in 9.3 docs DISPLAY QLOCAL('SYSTEM.ADMIN.ACCOUNTING.QUEUE') CURDEPTH MAXDEPTH * Queue names vary by version — DISPLAY QMGR ACCTMQI help

Attribute names and default accounting queue names differ between MQ 9.x fix packs and z/OS. After ALTER, generate test traffic from one application and confirm accounting messages arrive within one interval. Increase accounting queue MAXDEPTH before high-volume load tests.

What Accounting Messages Contain

Accounting messages are special-format MQ messages, not business payloads. Parsers extract identifiers such as application name, user ID, connection handle class, counts of opens, puts, gets, bytes transferred, and interval start/end timestamps. Exact field layout is in the IBM Application Programming Reference for your version—write parsers against documented structures, not guesswork. Store parsed rows in a time-series database for dashboards: top ten applications by put count per hour, connect storms after deployments, unusual get volume on audit queues.

Building a Consumer

  1. Long-running service GET from accounting queue with appropriate wait interval.
  2. Parse message into JSON with qmgr, interval, appl, user, operation counts.
  3. Insert into warehouse table partitioned by day.
  4. Grafana or BI tool reads warehouse for chargeback reports.
  5. Alert on anomaly: connect count ten times baseline for one appl tag.

Chargeback and Governance

Map accounting application tags to cost centers. Monthly report: team A drove forty percent of put volume on shared QM_FINANCE. Negotiate sizing funding or require efficiency improvements. Security governance: detect unexpected application names connecting to production—accounting complements security events; events fire on failure, accounting shows success volume from odd names.

Performance Impact

  • Accounting adds CPU and messages on interval boundaries—usually small versus workload.
  • Very short ACCTINT increases message rate to accounting queue—tune interval versus resolution.
  • Full accounting queue blocks or slows accounting—monitor CURDEPTH like any system queue.
  • Disable accounting on performance lab QM when measuring bare-metal throughput.

z/OS Considerations

z/OS queue managers may integrate accounting with SMF or operations tools. Coordinate with mainframe capacity teams; MQI counts may feed LPAR sizing decisions differently than distributed Kubernetes scale-out. Document which queue sharing group members emit accounting and where consolidated reports land.

Privacy and Retention

Accounting messages may include user IDs and application names revealing business functions. Restrict warehouse access. Apply retention policies matching GDPR or internal standards—purge parsed rows after thirteen months if policy requires. Mask user IDs in non-production exports.

Explainer: Itemized Phone Bill

API accounting is the itemized phone bill—queue statistics tell you one number called hotline five thousand times; accounting lists which extensions dialed.

Explain Like I'm Five: API Accounting

A teacher writes down which kid talked to the marble box most today, not only how many marbles are inside the box.

Practice Exercises

Exercise 1

Design a warehouse schema with five columns for parsed accounting records and explain each.

Exercise 2

Incident: queue depth high but accounting shows zero puts from expected app—list three hypotheses.

Exercise 3

Compare when you would enable STATQ versus ACCTMQI on a new payment queue manager.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. API accounting primarily tracks:

  • MQI call usage by application
  • Only log file size
  • JCL job cards
  • CICS mapsets

2. Queue statistics (STATQ) track:

  • Per-queue put and get totals
  • Only TLS handshakes
  • FTP transfers
  • SMF type 14

3. Accounting queues need:

  • A consumer process reading messages
  • No MAXDEPTH
  • Disabled listeners
  • CLEAR QLOCAL daily

4. Chargeback use case uses accounting to:

  • Bill teams by MQ usage
  • Delete DLQ
  • Change MAXDEPTH
  • Stop channels
Published
Read time21 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation