Code:
ubound($retcode,1)



...is the size of the sub-array, and therefore the number of results in the set.