Doubt on Default Stream

Hi everybody,

The following code has got its self explanation, i have a small doubt in the following code. The default stream gets closed when we give INPUT CLOSE stmt. Then how is the nxt display getting printed...

Is that another default stream will be created???

******************************************************
/* A new unmaned as well as default stream will be created
when this procedure starts its execution */
DISPLAY "This is a sample msg".

/* Now if i am providing the following command,it closes the
default stream that is created */
INPUT CLOSE.

DISPLAY "Hi, Itzzz Meeee again!!".
******************************************************
 
First of all you're closing INPUT but confused about why OUTPUT is still open... but if you change it to OUTPUT it still works :awink:

In any event I think that it's just that Progress considers closing the default stream to be a no-op.
 
Hi,

I am extremely sorry, i have wrongly copied the one. Now i have closed the OUTPUT stream, still it displays... So can u tel me whats happening here???

*****************************************************
/* A new unmaned as well as default stream will be created
when this procedure starts its execution */
DISPLAY "This is a sample msg".

/* Now if i am providing the following command,it closes the
default stream that is created */
OUTPUT CLOSE.

DISPLAY "Hi, Itzzz Meeee again!!".
*****************************************************

Thanks
 
Hi,

I think progress by default supports only 3 types of streams. Input , Output and Error stream. So when ever data is displayed it overwrites the default output stream. I think the same thing happens for Input stream also.

Prasad
 
It's all to do with Frames.

Progress uses a default frame if none is specified and puts everything into that default frame. This is scope-sensitive, so it uses a different default frame inside a for each loop.

So, both display statements are using the same frame.

Also, you can use output close as many times as you like, it won't close the default output destination. So, even though you are using OUTPUT CLOSE, you are still outputting to the default terminal and both frames are using that default output.

If you try the following, you only get one frame as the output is different:

output to test.
DISPLAY "This is a sample msg" with frame f1.
/* Now if i am providing the following command,it closes the
default stream that is created */
OUTPUT CLOSE.
output close.
output close.
DISPLAY "Hi, Itzzz Meeee again!!" with frame f2.

But the following shows two frames:

output to terminal.
DISPLAY "This is a sample msg" with frame f1.
/* Now if i am providing the following command,it closes the
default stream that is created */
OUTPUT CLOSE.
output close.
output close.
DISPLAY "Hi, Itzzz Meeee again!!" with frame f2.


Nice, isn't it?

I'd simply be careful about usiong OUTPUT CLOSE. Make sure you have a matching OUPUT TO or similar statement. Try using Streams if you want more control or multiple outputs.
 
Back
Top