SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)

/* Set the input values of the two IN parameters in
* ordinal positions 1 and 2, which are the only entries
* in the input descriptor. */
printf("\nEnter the employee number: ";
scanf("%ld", &hv_empnum_param1);
hv_i = 1;
EXEC SQL SET DESCRIPTOR 'in_sda' VALUE :hv_i
VARIABLE_DATA = :hv_empnum_param1;
printf("\nEnter the percentage adjustment: ";
scanf("%f", &hv_percent_param2);
hv_i = 2;
EXEC SQL SET DESCRIPTOR 'in_sda' VALUE :hv_i
VARIABLE_DATA = :hv_percent_param2;
For the syntax of the SET DESCRIPTOR statement, see the SQL/MX Reference Manual.
NOTE: You cannot modify the PARAMETER_ORDINAL_POSITION and PARAMETER_MODE
descriptor items.
5. Execute the prepared CALL statement.
Issue an EXECUTE statement that has an input USING clause for the input SQL descriptor area
and an output INTO clause for the output SQL descriptor area:
EXEC SQL EXECUTE sqlstmt
USING SQL DESCRIPTOR 'in_sda'
INTO SQL DESCRIPTOR 'out_sda';
For the syntax of the EXECUTE statement, see the SQL/MX Reference Manual.
6. Retrieve the output parameter value by using GET DESCRIPTOR.
Use the GET DESCRIPTOR statement to retrieve information for the output parameter from the
output SQL descriptor area:
hv_i = 1;
EXEC SQL GET DESCRIPTOR 'out_sda' VALUE :hv_i
VARIABLE_DATA = :hv_newsalary_param3;
printf("\nThe new salary is %ld.\n", hv_newsalary_param3);
For the syntax of the GET DESCRIPTOR statement, see the SQL/MX Reference Manual.
7. Retrieve parameter descriptor information by using GET DESCRIPTOR.
Aside from obtaining data about the output dynamic parameters, you can also use the GET
DESCRIPTOR statement to retrieve the PARAMETER_MODE and
PARAMETER_ORDINAL_POSITION descriptor items for dynamic parameters.
In this example, the GET DESCRIPTOR statement stores the PARAMETER_MODE and
PARAMETER_ORDINAL_POSITION information in designated host variables for the OUT
parameter:
hv_i = 1;
EXEC SQL GET DESCRIPTOR 'out_sda' VALUE :hv_i
VARIABLE_DATA = :hv_newsalary_param3
PARAMETER_MODE = :pm_newsalary_param3
PARAMETER_ORDINAL_POSITION = :pop_newsalary_param3;
For more information about descriptor items, see the SQL/MX Reference Manual.
For more information about writing embedded SQL programs in C, C++, or COBOL, see the
SQL/MX Programming Manual for C and COBOL.
Argument Lists
You can execute an embedded dynamic CALL statement without input or output descriptors. Instead,
pass two argument lists in the input USING clause and the output INTO clause directly to the
EXECUTE statement.
Invoking SPJs Dynamically in an Embedded SQL Program in C, C++, or COBOL 79