Previous Topic Next topic Print topic


SET CURRENT PACKAGE PATH

This command is only supported syntactically by the XDB Server.

Invocation

This statement can be embedded only in an application program. It is an executable statement that cannot be dynamically prepared.

Authorization

None required.

Syntax

Bold text indicates clauses or options that are supported only syntactically.

SET CURRENT PACKGE PATH [=] 
     {collection-id | 
      USER | 
      CURRENT PACKAGE PATH | 
      host-variable | 
      string-constant} [,...]
Note: USER, CURRENT PACKAGE PATH, and CURRENT PATH can be specified only once on the right side of the statement.

Description

The value of CURRENT PACKAGE PATH is replaced by the values specified.

collection-id

Identifies a collection. collection-id must not be a delimited identifier that is empty or contains only blanks.

USER

Specifies the value of the USER special register.

CURRENT PACKAGE PATH

Specifies the value of the CURRENT PACKAGE PATH special register before the execution of the SET CURRENT PACKAGE PATH.

CURRENT PATH

Specifies the value of the CURRENT PATH special register.

host-variable

Specifies a host variable that contains one or more collection IDs, separated by commas. The host variable must:

  • Have a data type of CHAR or VARCHAR. The actual length of the contents of the host variable must not exceed the maximum length of the CURRENT PACKAGE PATH special register.
  • Not be the null value if an indicator variable is provided.
  • Contain an empty or blank string, or one or more collection IDs that are separated by commas.
  • Be padded on the right with blanks if the host variable is fixed-length, or if the actual length of the host variable is longer than the content.
  • Not contain a delimited identifier that is empty or contains only blanks.

string-constant

Specifies a string constant that contains one or more collection IDs, separated by commas. The string constant must:

  • Have a length that does not exceed the maximum length of the CURRENT PACKAGE PATH special register.
  • Contain an empty or blank string, or one or more collection IDs separated by commas.
  • Not contain a delimited identifier that is empty or contains only blanks.
Note:
  • The contents of a host variable or string constant are interpreted as a list of collection IDs if the value contains at least one comma. If multiple collection IDs are specified, they must be separated by commas. Each collection ID in the list must conform to the rules for forming an ordinary identifier or be specified as a delimited identifier.
  • No validation that the collections exist is made at the time that the CURRENT PACKAGE PATH special register is set. For example, a collection ID that is misspelled is not detected, which could affect the way subsequent SQL operates. At package execution time, authorization to the specific package is checked, and if this authorization check fails, an error is issued.
  • The special register string is built by taking each collection ID specified and removing trailing blanks, delimiting with double quotation marks, doubling any double quotation marks within the collection ID as necessary, and then separating each collection ID by a comma. If the same collection ID appears more than once in the list, the first occurrence of the collection is used. The length of the resulting list cannot exceed the length of the special register. For example, assume that the following statements are issued:
    SET CURRENT PACKAGE PATH = MYPKGS, "ABC E", SYSIBM
      SET :HVPKLIST = CURRENT PACKAGE PATH

    These statements result in the value of the host variable being set to: "MYPKGS", "ABC E", "SYSIBM". A collection ID that does not conform to the rules for an ordinary identifier must be specified as a delimited collection ID and must not be specified within a host variable or string constant.

  • A difference exists between specifying a single keyword, such as USER, as a single keyword or as a delimited identifier. To indicate that the current value of a special register that is specified as a single keyword should be used in the package path, specify the name of the special register as a keyword. If you specify the name of the special register as a delimited identifier, it is interpreted as a collection ID of that value. For example, assume that the current value of the USER special register is SMITH and that the following statement is issued:
    SET CURRENT PACKAGE PATH = SYSIBM, USER, "USER"

    The result is that the value of the CURRENT PACKAGE PATH special register is set to: "SYSIBM, "SMITH", "USER".

  • Because a host variable (SQL variable) in an SQL procedure does not begin with a colon, DB2 uses the following rules to determine whether a value that is specified in a SET PACKAGE PATH = name statement is a variable or a collection ID:
    • If name is the same as a parameter or SQL variable in the SQL procedure, DB2 uses name as a parameter or SQL variable and assigns the value in name to the package path.
    • If name is not the same as a parameter or SQL variable in the SQL procedure, DB2 uses name as a collection ID and assigns and the value in name is the package path.
  • The SET CURRENT PACKAGE PATH statement is executed by the database server and, therefore, is classified as a non-local SET statement in DRDA. The SET CURRENT PACKAGE PATH statement requires a new level of DRDA support. If SET CURRENT PACKAGE PATH is issued when connected to the local server, the SET CURRENT PACKAGE PATH special register at the local server is set. Otherwise, when SET CURRENT PACKAGE PATH is issued when connected to a remote server, the SET CURRENT PACKAGE PATH special register at the remote server is set.
Previous Topic Next topic Print topic