GET DESCRIPTOR statement
The GET DESCRIPTOR statement fetches the information set in the SQL descriptor area to a host variable. The data
type of the host variable must match data type of the corresponding fetch identifier.
An example of fetching the number of select column lists to host variable varcount is shown below.
The following is an example of fetching the contents of the select column lists set in the SQL descriptor area to host
variables vartypc, varleng, and varoctct. In this example, the values set in varwcount are assumed to be the element
numbers of the item descriptor areas whose information is being fetched.
When execution results are fetched from the SQL descriptor area, the data types of the host variables must
correspond to TYPE, LENGTH, OCTET_LENGTH, PRECISION, SCALE, and CHARACTER_SET_NAME of the
corresponding item descriptor area.
An example of fetching the execution results set in the SQL descriptor area to host variable vardata is shown below. In
this example, the value set in varwcount is assumed to be the element number of the item descriptor area whose
information is to be fetched.
SET DESCRIPTOR statement
The SET DESCRIPTOR statement sets the data type of the target specification used to fetch execution results in the
select column list of the SQL descriptor area. The data types of the host variables must correspond to the set
identifiers. An example of changing the data type of the select column list of the SQL descriptor area is shown below.
In this example, since CHARACTER(11) is assumed to be declared as the data type of host variable vardata, which
receives the execution results, change the data type of the select column list to CHARACTER(10). Also in this
example, the value set in varwcount is assumed to be the element number of the item descriptor area that will be set.
153