Change Dynamic Default Collection (QSQCHGDC) API



  Required Parameter Group:

1 Default collection name Input Char(18)

  Optional or Omissible Parameter:

2 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: Yes

The Change Dynamic Default Collection (QSQCHGDC) API defines a default collection for unqualified table names in dynamically prepared statements or in dynamically executed statements. The default collection is defined only for the job issuing the API call. The default collection will take precedence over the naming convention and default collection specified when the SQL program was created.


Authorities and Locks

None.


Required Parameter

Default collection name
INPUT; CHAR(18)

The name of the default collection. The following values are allowed:

*CURLIB The current library at the time the API is called is used as the default collection. Subsequent changes of the current library will not change the default collection. If no current library is defined, library QGPL is used.
*PGM The default collection is determined by the attributes specified when the SQL program was created. If DYNDFTCOL(*YES) was specified, the default collection is the library name specified on the DFTRDBCOL keyword. If DYNDFTCOL(*NO) was specified, dynamically prepared and executed statements will use the default collection rules based on the naming convention. For further information about naming conventions, see the DB2® for IBM® i SQL reference topic collection.
default collection name The name of the default collection. This value must be uppercase and not delimited.

The API does not validate the existence or the user's authority to the specified default collection. These validations occur on the execution of subsequent SQL prepare or execute operations.


Optional or Omissible Parameter

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter. If this parameter is omitted, diagnostic and escape messages are issued to the application.


Usage Notes

  1. If a package is created with a DFTRDBCOL, QSQCHGDC has no effect.

  2. In V5R2, the scope of QSQCHGDC was changed from job scoped to activation group scoped.

Error Messages

Message ID Error Message Text
CPF3CF1 E Error code parameter not valid.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V4R5

[ Back to top | Database and File APIs | APIs by category ]