use while loop in instruction recorder