Session Switching
To switch from one open session to another, use the SET_SQL statement. To open a new session, issue the CONNECT statement. To determine the session identifier for the current session, use the INQUIRE_SQL statement.
Applications can switch sessions freely. Note that session switching is supported under the following circumstances:
• In a transaction.
• While cursors are open.
• In OpenSQL statement blocks (such as select loops).
The code for the nested session must be inside a host language subroutine. If it is not, the SQL preprocessor will issue an error.
• In subroutines called by a WHENEVER statement.
After an application switches sessions, the error information obtained from the SQLCA or the INQUIRE_SQL statement is not updated until an OpenSQL statement has completed in the new session.
Last modified date: 04/03/2024