Determine current output destination

Vaalen

Member
Hi,

Is it somehow possible to determine what the current output destination is? I'm working with progress v9.1D, Linux.
 

StuartT

Member
If you mean which directory the a file would be created in should you do something like:

output to "test.txt".
put "test information" skip.
output close.

Then the easiest way would be to run the following command from a procedure editor:
unix pwd

as the default would be your current working directory
 

Vaalen

Member
I wish it was that simple. I would like to know the exact output destination, could be a file (/home/blablabla/file, or printer or mail).
 

StuartT

Member
Not sure i understand what you are looking for. Is it an application that you are running that you wish to get the current output destination for because at any given time progress could be directing output to 5 different files possibly in different folders in addition to the screen output.
 

Vaalen

Member
A user can select output in prog A. prog A uses a prog, in which output is determined (in most cases a temporary file is made) ánd opened. According to what is in the db this program also runs prog B. This is the program I am in. So the output destination is set before running this program.
In prog B I have to make a modification to mail the report that has been made. This means before or after the outputdestination the user requested in prog A (are you still with me?).

It would be easy for me to just know what the output destination is (a temporary file of which the name is not shared), make a copy and mail the file.
 

tamhas

ProgressTalk.com Sponsor
There is a rule in programming that the same place that creates something should also delete it. There are, of course, notable exceptions, but by and large this is also a good principle with respect to things like redirecting output. If the same function that creates the output stream is also responsible for closing it, then you have a natural point for e-mailing it, renaming it, attaching it to something, throwing it away or whatever the appropriate disposition might be.

And, of course, it also tend to keep you from leaving it open and forgetting to close it or closing it somewhere when you aren't really done with it.
 

Vaalen

Member
Thank you Tamhas, I think I know the rule and I like to think I am clever enough to pick the file up where it was created and closed. Unfortunately I do not have that choice.
I can not change the program and include because of their general nature. That again, is not my choice.
 

RealHeavyDude

Well-Known Member
AFAIK there is no way to "get" the information as to where the output is directed to within the program at runtime. There are no functions or properties provided in the language that I am aware of which would support such a functionality. The only way is for the developer to have the knowledge at design time. Therefore It don't think there is a way you could branch your logic on the fact where the output is directed to.

Regards, RealHeavyDude.
 

Casper

ProgressTalk.com Moderator
Staff member
If you had a more recent release then you could define a stream and wite the output destination in the private-data of the stream-handle of that stream.

Code:
DEFINE STREAM sOut.
DEFINE VARIABLE hStream AS HANDLE      NO-UNDO.
OUTPUT STREAM sOut TO c:\temp\test.tst.
ASSIGN hStream = STREAM sOut:HANDLE
       hStream:PRIVATE-DATA = 'c:\temp\test.tst'.

RUN c:\temp\teststreamhlp.p (INPUT hStream).
OUTPUT STREAM sOut CLOSE.

Casper.
 
Top