while { if (start of record) { get order details while (not a new order) { get distribution details into a hash } print order details and distributions to Excel } }