SWITCH Service
The SWITCH service promotes the referenced thread to the current status.
The SWITCH service is used to promote the referenced thread to the current status. This means that the plan thread under which subsequent SQL and IFI requests will execute until your REXX application terminates or another thread is promoted to the current status.
>>---SWITCH---THREAD(:hv_handle)-------------><
Standard SQL syntax does not provide a means by which to identify a specific plan thread for a particular SQL request.
RLX
/CAF provides the SWITCH service for this purpose.The SWITCH request fails if the specified Db2 subsystem or application plan is not yet defined or if the thread handle specified by
:hv_handle
is not valid. After a successful SWITCH request, all subsequent SQL and IFI requests will be directed to this Db2 plan thread for execution.The CREATE THREAD call also establishes the 'current' thread.
The following example illustrates a CAF SWITCH request:
'CAF SWITCH THREAD(:THREAD1)'
Where
THREAD1
identifies a REXX variable which contains the thread handle that is returned by a successful ACTIVATE
or CREATE THREAD
call.