writing environment vars

freneksi

New Member
Hi,

in a post below I asked how to read an environment var, now I need to write to one.

I'm building a VBS/VBA app that calls a predefined progress program. I feed it parameters using environment vars like "fromdate" "todate" "outputfile" but now I need progress to signal back to windows that it is done outputting, so I want my last line in progress to be something like this :
os-setenv("busy", 0) /*this command doesn't exist*/
and then wait for it to happen in vbs using :
while shell.environment.item("busy") <> 0
sleep 100
wend

excel.Workbooks.OpenText outputfile ....
Maybe I should look into reading and writing the registry?
Could someone provide me a simple cut and paste example of both?
I'm new to progress, an admin that needs to do some datamining.


thx for any help


Freneksi
 

TomBascom

Curmudgeon
You need to let Salvador Vinals, svi@progress.com, who is the 4GL product manager know that you are yet another person who needs OS-SETENV() to be added to the 4GL. Your posting is a fairly good "business case" to send along and explain to him what you're trying to do and why it is important.
 

sphipp

Member
You could set an Environment Variable that contains the path of a non-existent file.

When the progress program has finished it creates the file and puts a message into the file.

That way, your script only needs to check for the existence of the file to see if the program has finished. It also allows you to tailor the files and keep track of multiple processes.

But, OS-SETENV would be useful, of course.
 

TomBascom

Curmudgeon
Actually... :blush:

On re-reading the original post the use of an environment variable will not work anyway. Changes made in a child process are never available to the parent. Even if you do have something like OS-SETENV. A function like OS-SETENV would allow a parent process to set a value for a child to read but it is a one-way street.

In a case like this what I generally do is to rename the file once I'm finished with it. Often the process is made simpler by creating and working with the file in one directory and then, when you are done, renaming it to another. A RENAME ("mv" in UNIX) is better than COPY because it is an "atomic" operation -- it happens all at once or not at all. So there's no risk of the watching program seeing an incomplete file.
 
Top