The syntax for the execute statement is:
exec sql [at connection_name] execute statement_name
[into {host_var_list | sql descriptor
descriptor_name | descriptor sqlda_name }]
[using {host_var_list | sql descriptor
descriptor_name | descriptor sqlda_name}]
end-exec
where:
statement_name is the name assigned in the prepare statement. into is used for a single-row select.
into is used for a single-row select.
using specifies the COBOL variables or descriptors that are substituted for dynamic parameter markers in variables in the host_var_list. The variables, which you must define in a declare section, are substituted in the order listed. You need only this clause when the statement contains variables using dynamic parameter markers.
descriptor_name represents the area of memory that holds a description of the dynamic SQL statement’s dynamic parameter markers.
host_var_list is a list of host variables to substitute into the parameter markers (“?”) in the query.
sqlda_name is the name of the SQLDA.