SET_CLIENT_ID function for RRSAF

The RRSAF SET_CLIENT_ID function sets new values for the client user ID, the application program name, the workstation name, the accounting token, the DDF client accounting string, the correlation token, and the long name. The function then passes this information to Db2 when the next SQL request is processed.

These values can be used to identify the end user. The calling program defines the contents of these parameters. Db2 places the parameter values in the output from the DISPLAY THREAD command and in Db2 accounting and statistics trace records.

The following diagram shows the syntax of the SET_CLIENT_ID function.

DSNRLI SET_CLIENT_ID function

Read syntax diagramSkip visual syntax diagramCALL DSNRLI(function, accounting-token0 , user0 , appl0 , ws0 ,
Read syntax diagramSkip visual syntax diagram retcode0,reascode0,accounting-string0,corr-token0,long-name )

Parameters point to the following areas:

function
An 18-byte area that contains SET_CLIENT_ID followed by 5 blanks.
accounting-token
A 22-byte area in which you can put a value for a Db2 accounting token. This value is placed in the Db2 accounting and statistics trace records in the QWHCTOKN field, which is mapped by DSNDQWHC DSECT. If accounting-token is less than 22 characters long, you must pad it on the right with blanks to a length of 22 characters.

You can omit this parameter by specifying a value of 0 in the parameter list.

Alternatively, you can change the value of the Db2 accounting token with the RRSAF functions SIGNON, AUTH SIGNON, or CONTEXT SIGNON. You can retrieve the Db2 accounting token with the CURRENT CLIENT_ACCTNG special register only if the DDF accounting string is not set.

user
A 16-byte or 128-byte area that contains the user ID of the client end user. You can use this parameter to provide the identity of the client end user for accounting and monitoring purposes. Db2 places this user ID in the output from the DISPLAY THREAD command and in Db2 accounting and statistics trace records. If user is less than 16 characters long, you must pad it on the right with blanks to a length of 16 characters.

You can omit this parameter by specifying a value of 0 in the parameter list.

If the long-name parameter is specified, the maximum length of the user parameter is 128 bytes. If user is less than 128 characters long, you must pad it on the right with blanks to a length of 128 characters.

You can also change the value of the client user ID with the RRSAF functions SIGNON, AUTH SIGNON, or CONTEXT SIGNON. You can retrieve the client user ID with the CLIENT_USERID special register.

appl
An 32-byte or 255-byte area that contains the application or transaction name of the end user's application. You can use this parameter to provide the identity of the client end user for accounting and monitoring purposes. Db2 places the application name in the output from the DISPLAY THREAD command and in Db2 accounting and statistics trace records. If appl is less than 32 characters, you must pad it on the right with blanks to a length of 32 characters.

You can omit this parameter by specifying a value of 0 in the parameter list.

If the long-name parameter is specified, the maximum length of the appl parameter is 255 bytes. If appl is less than 255 characters long, you must pad it on the right with blanks to a length of 255 characters.

You can also change the value of the application name with the RRSAF functions SIGNON, AUTH SIGNON, or CONTEXT SIGNON. You can retrieve the application name with the CLIENT_APPLNAME special register.

ws
An 18-byte or 255-byte area that contains the workstation name of the client end user. You can use this parameter to provide the identity of the client end user for accounting and monitoring purposes. Db2 places this workstation name in the output from the DISPLAY THREAD command and in Db2 accounting and statistics trace records. If ws is less than 18 characters, you must pad it on the right with blanks to a length of 18 characters.

You can omit this parameter by specifying a value of 0 in the parameter list.

If the long-name parameter is specified, the maximum length of the ws parameter is 255 bytes. If ws is less than 255 characters long, you must pad it on the right with blanks to a length of 255 characters.

You can also change the value of the workstation name with the RRSAF functions SIGNON, AUTH SIGNON, or CONTEXT SIGNON. You can retrieve the workstation name with the CLIENT_WRKSTNNAME special register.

retcode
A 4-byte area in which RRSAF places the return code.

You can omit this parameter by specifying a value of 0 in the parameter list.

This parameter is optional. If you do not specify retcode, RRSAF places the return code in register 15 and the reason code in register 0.

reascode
A 4-byte area in which RRSAF places the reason code.

You can omit this parameter by specifying a value of 0 in the parameter list.

This parameter is optional. If you do not specify reascode, RRSAF places the reason code in register 0.

If you specify reascode, you must also specify retcode.

accounting-string
A one-byte length field and a 255-byte area in which you can put a value for a Db2 accounting string. This value is placed in the DDF accounting trace records in the QMDASUFX field, which is mapped by DSNDQMDA DSECT. If accounting-string is less than 255 characters, you must pad it on the right with zeros to a length of 255 bytes. The entire 256 bytes is mapped by DSNDQMDA DSECT.

You can omit this parameter by specifying a value of 0 in the parameter list.

This parameter is optional. If you specify this accounting-string, you must also specify retcode, reascode, user, and appl. If you do not specify this parameter, no accounting string is associated with the connection.

You can also change the value of the accounting string with RRSAF functions AUTH SIGNON, CONTEXT SIGNON, or SET_CLIENT_ID.

You can retrieve the DDF suffix portion of the accounting string with the CURRENT CLIENT_ACCTNG special register. The suffix portion of accounting-string can contain a maximum of 200 characters. The QMDASFLN field contains the accounting suffix length, and the QMDASUFX field contains the accounting suffix value. If the DDF accounting string is set, you cannot query the accounting token with the CURRENT CLIENT_ACCTNG special register.

corr-token
An 255-byte area where you specify a client correlation token. You can specify a unique value to correlate your business process within Db2 and your entire business enterprise. The value of corr-token is displayed by the DISPLAY THREAD DETAIL command. The CURRENT CLIENT_CORR_TOKEN special register contains the client correlation token. If corr-token is less than 255 characters, you must pad it on the right with blanks to a length of 255 bytes.

You can omit this parameter by specifying a value of 0 in the parameter list. If you specify corr-token you must also specify long-name.

You can also change the value of the client correlation token with the RRSAF SIGNON function.

long-name
An 8-byte area that contains the value LONGNAME.

This optional parameter is used to indicate to the RRSAF function that the input parameters user, appl, ws, accounting-string, and corr-token can accept longer lengths. You cannot selectively associate the long-name parameter with any individual parameter.

Example of RRSAF SET_CLIENT_ID calls

The following table shows a SET_CLIENT_ID call in each language.

Table 1. Examples of RRSAF SET_CLIENT_ID calls
Language Call example
Assembler
CALL  DSNRLI,(SECLIDFN,ACCT,USER,APPL,WS,RETCODE,REASCODE,
ACCOUNTINGSTRING,CORRTOKEN,LONGNAME)
C1
fnret=dsnrli(&seclidfn[0], &acct[0], &user[0], &appl[0], &ws[0], &retcode, 
&reascode, &accountingstring[0], &corrtoken[0], &longname[0]);
COBOL
CALL  'DSNRLI' USING SECLIDFN ACCT USER APPL WS RETCODE REASCODE 
ACCOUNTING-STRING CORR-TOKEN LONG-NAME.
Fortran
CALL  DSNRLI(SECLIDFN,ACCT,USER,APPL,WS,RETCODE,REASCODE,
ACCOUNTINGSTRING,CORRTOKEN,LONGNAME) 
PL/I1
CALL  DSNRLI(SECLIDFN,ACCT,USER,APPL,WS,RETCODE,REASCODE,
ACCOUNTINGSTRING,CORRTOKEN,LONGNAME);
Note:
  1. For C, C++, and PL/I applications, you must include the appropriate compiler directives, because DSNRLI is an assembler language program. These compiler directives are described in the instructions for invoking RRSAF.