If the db2 driver logs that every time you try to fetch from a result which has no(more) rows available, then you can avoid it by fetching only exactly the number of rows returned:
$total_rows = db2_num_rows($stmt);
for ($i = 0; $i < $total_rows; $i++) {
$row = db2_fetch_assoc($stmt);
... do stuff ...
}