ClientAccountingString IBM data server driver configuration keyword

The ClientAccountingString keyword is used to set the client accounting string that is sent to a database. Applications that do not specify the accounting string by default can use the ClientAccountingString keyword to provide the accounting string information.

Equivalent CLI keyword
ClientAcctStr
Equivalent IBM® data server provider for .NET connection string keyword
ClientAccountingString
IBM data server driver configuration file (db2dsdriver.cfg) syntax
<parameter name="ClientAccountingString" value="accounting string"/>
Default setting:
None
Equivalent environment or connection attribute:
SQL_ATTR_INFO_ACCTSTR
Usage notes:
Db2® for z/OS® uses the ClientAccountingString keyword value to classify work.

 The CLI driver and .NET provider has limit of 255 characters for the ClientAccountingString keyword.

Database servers enforce different limitation in the length of the value and can truncate it. Note the following conditions:
  • Db2 for z/OS Version 11 servers in new function mode (NFM) support a length of up to 255 characters for the CURRENT CLIENT_ACCTNG special register.
  • Db2 for z/OS Version 10 and earlier servers support a length of up to 200 characters.
  • Db2 for IBM i V6R1 and later servers support a length of up to 255 characters.
To ensure that the data is converted correctly when transmitted to Db2 for z/OS Version 9 and earlier server, use only the characters A-Z and 0-9 and the underscore (_) or period (.).

The ClientAccountingString keyword must be set before the start of a transaction. Changes to the ClientAccountingString keyword after the start of a transaction do not take effect until the start of the next transaction.

For connection to Db2 for z/OS servers, the ClientAccountingString keyword is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

You can use accounting strings to send accounting data from the IBM Data Server Driver to the Db2 database derver. An accounting string combines system-generated data with user-supplied data. The accounting string consists of 56 bytes. These bytes are generated by the Db2 Client (the prefix), and are followed by up to 199 bytes specified by the user (the suffix), for a maximum length of 255.

Table 1 shows the system-generated fields. Each of these fields is padded to the right with blanks.

Table 1. Accounting String Fields Generated by Db2 Connect
Field Name Length Description
cct_str_len 1 A hexadecimal value representing the length of the accounting string minus 1. For example, X'3C'.
client_prdid 8 The product ID of the client software. For example, the product ID for Db2 products, Db2 Connect products, and their clients Version 9.1 is SQL09120.  
client_platform 18 The platform the client is on, for example AIX, OS/2, DOS, or Windows.
client_appl_name 20 The first 20 characters of the user's application name, for example, payroll.
client_authid 8 The authid of the user's application, for example, SMITH.
suffix_len 1 A hexadecimal value representing the length of the user-supplied suffix. X'00' means that there is no user-supplied suffix.
A change in any of the prefix parameters causes the Db2 client to flow a new value of accounting string to the server. The user-defined suffix can be provided by using one of the following values:
  • The db2dsdriver.cfg parameter ClientAcctStr.
  • An equivalent environment or connection attribute, SQL_ATTR_INFO_ACCTSTR.
  • The value specified by an application with the sqlesact() API.
  • A null string.

If the suffix is longer than 199 characters, it is truncated. You must use only the alphabetical characters A to Z, the numerical characters 0 - 9, and underscore (_). These characters ensure that the accounting string is converted correctly when it is transmitted to database server. The following are examples of accounting strings:

The first example is of a user-defined suffix, DEPT1.
 x'3C'SQL07010OS/2              cheque              SMITH   x'05'DEPT1
The second example is of a null string.
x'37'SQL07010OS/2              cheque              SMITH   x'00'