I would really appreciate it if someone would look at my code and tell me what I am doing wrong. I have really exhausted myself in figuring this out for the last few days.
The code is doing what it is supposed to except when it reads multiple files. For example, I may have several .DAT files in a directory path: The code is supposed to read each .DAT file, process the file and then write the output file to a .dat file. Well, it works alright if there is one file in the directory. However, if there are multiple .DAT files to process, it will read all of them but write out the output of the last file to all the files. For example, if there are two files, the output of the second file is written to both files. Thus, two .dat files with the correct filename but same output.
Thank you so much for your help.
FJ