Many Client-Library routines that process results or return information about results take an item number as a parameter. An item number identifies a result item in a result set, and can be a column number, a compute column number, a parameter number, or a return status number.
Item numbers start at 1 and never exceed the number of items in the current result set. An application can call ct_res_info with type as CS_NUMDATA to obtain the number of items in the current result set.
When the result set contains columns, item is a column number. Columns are returned to an application in select-list order.
When the result set contains compute columns, item is the column number of a compute column. Compute columns are returned in the order in which they are listed in the compute clause.
When the result set contains parameters, item is a parameter number. Stored procedure return parameters are returned in the same order in which the parameters were originally listed in the stored procedure’s create procedure statement. This is not necessarily the same order as specified in the Remote Procedure Call (RPC) command that invoked the stored procedure. In determining what number to pass as item, do not count nonreturn parameters. For example, if the second parameter in a stored procedure is the only return parameter, pass item as 1.
When the result set contains a return status, item is always 1, as there can be only a single status in a return status result set.