@ Brad Burleson
Thanks for the reply..
I made the changes to the while loop..Now it is working in the loop as expected..