Description of the illustration image005.gif
The illustration shows how variables are set. The illustration uses the following example of a dynamic SQL statement: "SELECT ENAME FROM EMP WHERE EMPNO=:NUM". In the example, ENAME is the select-list item and :NUM is the placeholder for a bind variable. During a select SQLDA, the following assigments are made: SQLADR sets the addrss of the select-list item name buffer and the select-list item value buffer. DESCRIBE sets the length of the select-list item name and the datatype of the select-list item. Program sets the length of the select-list item name buffer, the length of the select-list item value buffer, and the datatype of the select-list item value buffer. The output buffer of DESCRIBE is the name of the select-list item, and the output buffer of fetch of the value of the select-list item. During a bind SQLDA, the following assignments are made: SQLADR sets the address of the placeholder name buffer and the address of the bind value value buffer. Describe sets the length of the placeholder name. Program sets the length of the placeholder name buffer and the bind value value buffer, and the datatype of the bind value value buffer. The input buffer for DESCRIBE is the name of the placeholder. The input buffer of FETCH is the value of the bind variable.