Session Global Variables in CLPPlus

CLPPlus has support for setting the value of the Session Global Variable from the db2dsdriver.cfg file.

A global variable is a named memory variable that is retrieved or modified through SQL statements. Global variables enable applications to share relational data among SQL statements without the need for extra application logic to support this data transfer.

Authorization
No special authorization is required.
Declaration
When the global variables are created by using the CREATE VARIABLE and these variables exist at the server, users can set their value in the sessionglobalvariables section in db2dsdriver.cfg file.
Scope
The value of a session global variable is uniquely associated with each session that uses this particular global variable.
Restrictions
None.
Sample db2dsdiver.cfg file
<configuration>
   <dsncollection>
      <dsn alias="sample" name="sample"  host="localhost" port="50000"/>
         <sessionglobalvariables>
            <parameter name="EMPID" value="12345"/>
                <parameter name="SQL_COMPAT" value="NPS"/>
         </sessionglobalvariables>
      </dsn>
   </dsncollection>
   <databases>
      <database name="sample" host="localhost" port="50000">
        <sessionglobalvariables>
                <parameter name="SQL_COMPAT" value="NPS"/>
        </sessionglobalvariables>
      </database>
      </databases>
   <parameters>
      <sessionglobalvariables>
         <parameter name="EMPID" value="100"/>
      </sessionglobalvariables>
   </parameters>
</configuration>