I'm trying to return multiple rows in a result set rather than having to iterate one at a time. When I do what I think all the examples and documentation tell me, I fill the first array element successfully, but all the others are filled with a repeating pattern of nonsense (see below the code). Here is the relevant code, and then the array values from the debugger:

/////////////////////////////////////////
//structure used for results
typedef struct {
LONG orguntsid;
LONG orguntsidLen;
LONG dptsid;
LONG dptsidLen;
double value;
LONG valueLen;
} rsltInfo;

////////begin the actual code...

/* Set Size of One row, Used for Row-Wise Binding Only */
rc = SQLSetStmtAttr( _gBldHData->gCursor->hstmt,SQL_ATTR_ROW_BIND_TYPE,(SQLPOINTER)(sizeo f( rsltInfo ) ),0);
/* SQL_ROWSET_SIZE sets the max number of result rows to fetch each time */
rc = SQLSetStmtAttr( _gBldHData->gCursor->hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)row_set _size,0) ;
rc = SQLSetStmtAttr( _gBldHData->gCursor->hstmt,SQL_ATTR_ROWS_FETCHED_PTR,(SQLPOINTER)&num_ rows_fetched,0);

rc = SQLBindCol( _gBldHData->gCursor->hstmt,1,SQL_C_LONG,( SQLPOINTER ) &sids[0].orguntsid,
0,&sids[0].orguntsidLen) ;
rc = SQLBindCol( _gBldHData->gCursor->hstmt,2,SQL_C_LONG,( SQLPOINTER ) &sids[0].dptsid,
0,&sids[0].dptsidLen) ;
rc = SQLBindCol( _gBldHData->gCursor->hstmt,3,SQL_C_DOUBLE,( SQLPOINTER ) &sids[0].value,
0,&sids[0].valueLen) ;

//wrapper library that calls SQLExecDirect
csdb_SQLExecuteDirect(CURSOR(),DBERR()),DBERR(),"1 Ex: fetchData");

memset(row_status_array,0,200);
memset(sids,0,sizeof(rsltInfo)*200);

while(SQLFetchScroll(_gBldHData->gCursor->hstmt,SQL_FETCH_NEXT,0) != SQL_NO_DATA)
{
i=0;
while(i<num_rows_fetched)
{
i++ ;
}
memset(sids,0,200);
memset(row_status_array,0,200);
}
//////////////////////////////////////////////////////////

num_rows_fetched = 53, which is the correct amount.
row_set_size = 200.

My array (sids) is valid at position 0 (zero). The rest of the data, through position 7, looks like this:
orguntsid = 4
orguntsidLen = 4
dptsid = 4
dptsidLen = 4
value = 8.4879831658374e-314
valueLen = 4

position 8 looks like this:
orguntsid = 8
orguntsidLen = 8
dptsid = 8
dptsidLen = 0
value = 0.0
valueLen = 0

and the rest are all zeroed out.


Can anyone out there tell me what I'm doing wrong?