Thanks to everyone for your help on this. I think I have it resolved
and will seriously consider the suggestions regarding future work.
I DO find Unix shell scripting frustrating (I knew it would be)and
would like to move to a more friendly environment.
cdt