SET PATH

The SET PATH statement changes the value of the CURRENT PATH special register.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.

Authorization

No authorization is required to execute this statement.

Syntax

                               .-,----------------------.
            (1)                V                        |
>>-SET PATH---------+---+---+----+-collection-name---+--+-+----><
                    '-=-'   |    +-SYSTEM PATH-------+    |
                            |    +-USER--------------+    |
                            |    |              (2)  |    |
                            |    +-CURRENT PATH------+    |
                            |    +-host-variable-----+    |
                            |    '-string-constant---'    |
                            '-*LIBL-----------------------'
 

Notes:

  1. SET CURRENT FUNCTION PATH and SET CURRENT PATH may be used as a synonym for SET PATH.

  2. CURRENT_PATH or CURRENT FUNCTION PATH may be used as a synonym for CURRENT PATH.

Description

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

collection-name
Identifies a collection or library. No validation that the collection exists is made at the time the path is set.

SYSTEM PATH
This value is the same as specifying the collection names "QSYS","QSYS2".

USER
This value is the USER special register.

CURRENT PATH
The value of the CURRENT PATH special register before the execution of this statement.

host-variable
A host variable which contains one or more collection names, separated by commas.

The host variable:

string-constant
A character constant with 1 or more collection names that are separated by commas.

Notes

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.

Example

The following statement sets the CURRENT PATH special register.

  SET PATH = FUNC_XYZ, "NewFun98", QSYS2 


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]