An EXEC TOOLS SET CONTEXT statement saves context information from one foreign function for use in subsequent foreign function invocations. Use EXEC TOOLS SET CONTEXT instead of creating a global variable to hold information. EXEC TOOLS SET CONTEXT allows you to assign a meaningful text name to a pointer representing a location in memory. You can retrieve the pointer using EXEC TOOLS GET CONTEXT.
EXEC TOOLS SET CONTEXT host_name[, ...]
BY context_name [, ...];
where:
host_name |
Specifies the host language variable containing the information to be saved. |
context_name |
Specifies the name of the saved context. |
The context_name can be a reference to one of the following items:
Example
/*
** Example: Save context information for later use
*/
EXEC SQL BEGIN DECLARE SECTION;
char my_context[20];
EXEC SQL END DECLARE SECTION;
strcpy(my_context, "context_1");
EXEC TOOLS SET CONTEXT :my_context BY appl_1;