Per ISO rules it does not matter if the AFTER phrase is specified first or after the BEFORE phrase - the result is to be the same.
Since quite a while (possibly ever) this is not true in libcob and if specified in that way the "end" is only calculated from "after the AFTER".
Workaround: change INSPECT x TALLYING/REPLACING/CONVERTING y BY/TO z AFTER n BEFORE m to INSPECT x TALLYING/REPLACING/CONVERTING y BY/TO z BEFORE m AFTER n.
The fix is to switch that around internally in parser.y.
The runtime could do that as well in strings.c, but that leads to additional cpu cycles for that statement, which is otherwise unnecessary, so it will be a "needs a recompile" fix.