loop counters working for x12n_document