Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Editing DO files while it is being executed

From   Dave Ewart <>
Subject   st: Editing DO files while it is being executed
Date   Fri, 23 Jun 2006 12:08:01 +0100

Hash: SHA1


Something one of our staff noticed is that 'strange things' can happen
if one edits a running DO file.  For example:

1. Start a Stata job with "do";

2. While the job is still running, edit in an editor, say,
by adding some additional commands to the end of it;

3. See the Stata job *execute those additional commands*, rather than
executing the contents of the DO file as it was when the job started!

This behaviour happens on both Stata versions we have here: Stata 8 for
Windows and Stata 9 for Linux.

I used 'strace' to see what Stata was actually doing.  It appears that
Stata reads the DO file in 512-byte blocks and only reads the next block
when it needs to (and "when it needs to" can be minutes, hours or even
days later).  Each new block read involves reading the file in its
current state, which means that any editing of the DO file while the job
is running can cause problems with the running job.

The workaround is simple of course, one just avoids editing DO files
which relate to running jobs.

This behaviour of Stata seems strange: why doesn't it read the whole DO
file at the start (which will only happen if the whole DO file is <512
bytes in size)?

Any other comments?

- -- 
Dave Ewart
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from
N 51.7518, W 1.2016
Version: GnuPG v1.4.2.2 (GNU/Linux)

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index