Thanks very much everyone! I added the line "hFlush stdout" to the code and it works fine now - thanks for your help! Rich.