Output

Posted by tracylee3124 on 11-Jun-2013 08:27

I am looking at some code and at the bottom there is the statement:

OUTPUT STREAM x CLOSE.

There is another reference to this stream way up further in the code and up there, more is done with the stream. Below this statement there is a call to another procedure, but it does not do anything with the stream.

I can understand what is going on when the statement is OUTPUT TO a file or terminal, but this just says output.

Does output act like a function where it calls something elsewhere in the code?

What is this statement doing?

There are a few statements I am having trouble grasping and this is one of them. And when I ask the Documentation, it does not respond  : P

Thanks everyone!

Tracy

All Replies

Posted by Patrick Tingen on 12-Jun-2013 02:19

Sometimes you want to output to more than one destination at once. Using the normal OUTPUT TO.. will only allow you to output to one destination.

By using streams, you can output to more than one.

Example:

DEFINE STREAM strOne.

DEFINE STREAM strTwo.


OUTPUT STREAM strOne TO c:\temp\file1.txt.

OUTPUT STREAM strTwo TO c:\temp\file2.txt.


PUT STREAM strOne UNFORMATTED "This ends up in file 1".

PUT STREAM strTwo UNFORMATTED "This ends up in file 2".


OUTPUT STREAM strOne CLOSE.

OUTPUT STREAM strTwo CLOSE.

You can use streams as an addition to the normal output operations, just define the stream before you use it and then insert "STREAM " in your operations. Streams are not that difficult, actually, you have been using the so-called "unnamed" stream al along.

You might want to look up help on "DEFINE STREAM"

Posted by tracylee3124 on 01-Jul-2013 11:52

Thanks Patrick. I appreciate your response. I ended up asking my boss and he told me. I am learning a lot in a short period of time and my brain gets a little swirly and simple things start to elude me.

I learn things and then they have me do something else for a while and then when I come back to the other stuff it is foggy. I started writing stuff on notecards and keeping it in a little file box. Having it alphabetized is really helpful even if it is just to remind me where I saved the file I need to look at. Just until I get a rhythm going.

Thanks again!

Tracy

This thread is closed