Thank you keszler and Merijin. You have transformed my code to be much better. Can you provide example of one field testing for blanks and empty. For example, if the $unit_status_dt contains data or empty string, put that record into valid file.
But if $unit_status_dt contains blank spaces and no data, put that into invalid file. I very much appreciate one example and then I will develop the remaining from there.