The SET PATH statement changes the value of the CURRENT PATH special register.
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
No authorization is required to execute this statement.
.-,----------------------.
(1) V |
>>-SET PATH---------+---+---+----+-collection-name---+--+-+----><
'-=-' | +-SYSTEM PATH-------+ |
| +-USER--------------+ |
| | (2) | |
| +-CURRENT PATH------+ |
| +-host-variable-----+ |
| '-string-constant---' |
'-*LIBL-----------------------'
Notes:
The value of the CURRENT PATH special register is replaced by the values specified.
The host variable:
A collection name must not appear more than once in the path.
The SET PATH statement is not a commitable operation. ROLLBACK has no effect on the CURRENT PATH.
The number of collections that can be specified is limited by the total length of the CURRENT PATH special register. The special register string is built by taking each schema name specified and removing trailing blanks, delimiting with double quotes, and separating each schema name by a comma. An error is returned if the length of the resulting string exceeds 558 bytes.
The initial value of the CURRENT PATH special register is *LIBL if system naming was used for the first SQL statement run in the activation group. The initial value is "QSYS","QSYS2", "X" (where X is the value of the USER special register) if SQL naming was used for the first SQL statement.
The collections QSYS and QSYS2 do not need to be specified. If not included in the path, they are implicitly assumed as the first collections (in this case, it is not included in the CURRENT PATH special register.
The CURRENT PATH special register is used to resolve user-defined distinct types and functions in dynamic SQL statements. For more information see Collections and the SQL Path.
The following statement sets the CURRENT PATH special register.
SET PATH = FUNC_XYZ, "NewFun98", QSYS2