CURRENT CLIENT_APPLNAME special register

CURRENT CLIENT_APPLNAME contains the value of the application name from the client information that is specified for the connection.

The data type is VARCHAR(255).

The default application name varies, depending on the connection:

  • If the connection is from a remote application client driver, the default is the application name as supplied by the driver. Default values set by the IBM® Data Server Driver for JDBC and SQLJ can be obtained from the DatabaseMetaData.getClientInfoProperties method.
  • If the connection is from a remote Db2 12 for z/OS® application, the default varies depending on which attachment facility is used:
    TSO attachment facility
    The default application name is one of the following cases:
    • The TSO logon user ID when the application runs in TSO foreground using TSO online applications like SPUFI.
    • The job name when the application runs in TSO background using TSO batch applications like DSNTEP2.
    RRS attachment facility interface
    The correlation ID that is provided at the call of the RRS DSNRLI SIGNON function.
    Call attachment facility
    The job name.
    CICS® attachment facility
    Start of changeIf the origin data for the CICS task contains adapter data that indicates the origin of the CICS task, the CICS attachment facility passes the following items to Db2:
    • An eye-catcher string
    • The ID of the adapter that set the origin data

    That information is used as the default application name. For example:

    CICS_ORIGIN_DATA:ADAPTER_ID:name

    name is one of the following values:

    • IBM_zOS_Connect_CICS_SP for a CICS task that was initiated as a result of an inbound request from z/OS Connect
    • IBM WebSphere MQ for z/OS for a CICS task that was initiated by the CICS-MQ trigger monitor or CICS-MQ bridge

    If there is no adapter data in the CICS origin data, no data is passed from CICS to Db2. Db2 uses the first 8 bytes of the correlation ID. In particular, the correlation ID is a 12-byte string for a CICS transaction, where the first 8 bytes are used as the default application name.

    End of change
    IMS Attachment facility
    An 8-byte string, the Program Specification Block (PSB) name, or the program name.

The value of the special register can be changed by using one of the following application programming interfaces (APIs):

  • SQLE_CLIENT_INFO_APPLNAME (sqleseti)
  • SQLSetConnectAttr (ODBC)
  • java.sql.Connection.setClientInfo (JDBC)
  • The RRS DSNRLI SIGNON, AUTH SIGNON, CONTEXT SIGNON, or SET_CLIENT_ID function
  • The WLM_SET_CLIENT_INFO stored procedure

When the client application name is explicitly set, it overwrites the default application name described above and is used as the client application name.

The application compatibility value of the package determines the length and blank padding of the CURRENT CLIENT_APPLNAME special register returned.

If one of these APIs is not used to set the value of the special register, an empty string is returned when the special register is referenced.

Start of change

Monitoring remote application statistics based on CURRENT CLIENT_APPLNAME (IFCID 411)

You can use start a trace that includes statistics class 10 (IFCID 411) to monitor statistics for remote DRDA applications based on the CURRENT CLIENT_APPLNAME special register. For more information, see Statistics trace.

Important: Monitoring of applications with IFCID 411 is limited to 6000 unique user ID values. If this limit is exceeded, Db2 issues DSNL030I with reason code 00D3105D and stops collecting the statistics for any new application names until DDF is restarted. For best results, use CLIENT_CORR_TOKEN special register to identify individual connections.
End of change

Example

Select the departments that are allowed to use the application that is being used in this connection.
  SELECT DEPT
    FROM DEPT_APPL_MAP
    WHERE APPL_NAME = CURRENT CLIENT_APPLNAME