SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
3-85
C Examples of SET DESCRIPTOR
VARIABLE_POINTER is not supported in COBOL. Embedded COBOL does not 
support the pointer type. 
Processing Items in a Descriptor Area 
You can retrieve the number of filled-in descriptor items for input parameters and set 
fields for a specific item. Use the number of filled-in descriptor items to construct a loop 
to set values for individual parameters. 
When a DESCRIBE statement executes, NonStop SQL/MX identifies parameters by 
the context in which they appear in a prepared statement.
If you execute a DESCRIBE statement before a SET DESCRIPTOR statement, you 
need not include TYPE in the SET DESCRIPTOR statement.
Version Differences for TYPE and TYPE_FS
In SQL/MX Release 1.0, the FS type (an SQL/MX extension) was equivalent to the 
item TYPE, and the ANSI type was equivalent to the item TYPE_ANSI. In SQL/MX 
Release 1.5 and later, to comply with ANSI standards, these equivalents have 
changed. TYPE returns the ANSI type, and TYPE_FS returns the FS type (an SQL/MX 
extension).
C Examples of SET DESCRIPTOR
•
Allocate a descriptor area, describe the input parameters of a dynamic SQL 
statement, and use the descriptor area to set values for the parameters:
desc_max = 1;
EXEC SQL ALLOCATE DESCRIPTOR 'in_sqlda' WITH MAX :desc_max;
...
strcpy (hv_sql_statement, "UPDATE employee" 
 " SET salary = salary * 1.1" 
 " WHERE jobcode = CAST(? AS NUMERIC(4) unsigned)");
...
EXEC SQL PREPARE sqlstmt FROM :hv_sql_statement; 
EXEC SQL DESCRIBE INPUT sqlstmt 
 USING SQL DESCRIPTOR 'in_sqlda'; 
...
scanf("%ld",&in_jobcode); 
desc_value = 1;
EXEC SQL SET DESCRIPTOR 'in_sqlda' VALUE :desc_value 
 VARIABLE_DATA = :in_jobcode, 
 ...; 
EXEC SQL EXECUTE sqlstmt USING SQL DESCRIPTOR 'in_sqlda';










