Flat file batch function