DB2 Connect User's Guide

Implementing Charge-Back Accounting on DB2 Universal Database for OS/390

Many DB2 Universal Database for OS/390 installations implement resource monitoring practices that allow systems administrators to associate resource usage with individual user access. This can be used to charge individual users or their departments for the resources they consume. This practice is commonly referred to as charge-back accounting.

DB2 Connect products allow system administrators to monitor mainframe resources consumed by users accessing databases through DB2 Connect. You can use accounting strings to send accounting data from DB2 Connect to the DB2 for database server. An accounting string combines system-generated data with user-supplied data. This data lets system administrators associate resource usage with each user's access, and charge the users accordingly.

The accounting string is sent using the DRDA parameter PRDDTA. Because the content of this parameter is not architected in DRDA, there is no guarantee that your application server will recognize the data as accounting data. Currently, PRDDTA is only supported on MVS and OS/390 systems. The string is stored as an accounting record.

The accounting string consists of 56 bytes generated by DB2 Connect (the prefix) followed by up to 199 bytes specified by the user (the suffix), for a maximum length of 255.

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

Table 3. Accounting String Fields Generated by DB2 Connect
Field Name Length Description.
acct_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 Universal Database Version 7 is SQL07010.
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.

The user-defined suffix is one of the following:

If the suffix is longer than 199 characters, it is truncated. To be sure that the accounting string is converted correctly when it is transmitted to the host or AS/400 database server, you should use only the characters A to Z, 0 to 9 and underscore (_).

The API method of setting the accounting string is recommended. Your application should call the API before connecting to a database. If you want to change the accounting string within the application (for example, to send a different string when you connect to a different database), call the API again. Otherwise, the value remains in effect until the end of the application.

If the sqlesact() API is not called before the first database connection request, the DB2ACCOUNT environment variable is read. This value remains in effect until the end of the application or background command line processor process. To specify a new accounting string suffix after the first database connection, either use the sqlesact() API or end the application or background CLP process and restart it with DB2ACCOUNT set to its new value.

If no DB2ACCOUNT value exists, the value of the DFT_ACCOUNT_STR system configuration parameter is used. This default can be useful for database clients that do not have the ability to forward an accounting string to DB2 Connect. If this does not exist, a null string is used.

The following are examples of accounting strings:

 
   x'3C'SQL07010OS/2              cheque              SMITH   x'05'DEPT1
 
   x'37'SQL07010OS/2              cheque              SMITH   x'00'
 

In the first example, the user-defined suffix is DEPT1. In the second example, it is a null string.


[ Top of Page | Previous Page | Next Page ]