Created function ensuring datafile integrity
ensureDatafileIntegrity completely tested