while (end1 - rec1 > 2)
{
if (rec1[0] != rec2[0] || rec1[1] != rec2[1])
{
p = out++;
/* cast this to LONG to take care of OS/2 pointer arithmetic
when rec1 is at the end of a segment, to avoid wrapping around */

Kovalenko Dmitry added a comment - 15/Feb/16 05:35 AM Pavel, I think, in general case, for similar code/problem need create the "unit tests" on C++.
Through isql/api, of course, internal code can not be verified.