In dynamic SQL, varying-list SELECT statements are ones for which the number and format of result columns to be returned are not predictable; that is, you do not know how many variables you need, or what the data types are.
Therefore, you cannot define host variables in advance to accommodate the result columns returned.
In REXX, steps 5.b,
6, and 7 are not applicable. REXX only supports SQL descriptors defined using
the SQLDA structure; it does not support allocated SQL descriptors.
If your application accepts varying-list SELECT statements, your program has to:
For an allocated SQL descriptor, run an ALLOCATE DESCRIPTOR
statement to define the descriptor you intend to use.
If using an SQLDA and the SQLDA is not large enough to contain column descriptions for each retrieved column, the program must determine how much space is needed, get storage for that amount of space, build a new SQLDA, and reissue the DESCRIBE statement.
If using
an allocated SQL descriptor and the descriptor is not large enough, deallocate
the descriptor, allocate it with a larger number of entries, and reissue the
DESCRIBE statement.
FETCH a row.
For an allocated SQL descriptor, run a DEALLOCATE
DESCRIPTOR statement to delete the descriptor.