streamclose

purpose : examine all named or unnamed streams, defines and usage, and warn if:
1. A stream is defined but not used
2. A stream is opened but not closed
3. A stream is opened for INPUT/OUTPUT but not closed before it's used for OUTPUT/INPUT

Reasons:
1. Obvious, defining something that's not used is useless
2. This will leave you with output on places you don't want it or with system resources not freed.
3. This will probably give you a runtime-error about conflicting use (99).

Fixes:
1. Delete the define.
2. Close the stream after you are done with it.
3. Close the stream after you are done with it. Perhaps better to not reuse the same stream for input and output use?


define stream s1.
define stream s2.
define stream sUnused. /* Error, stream defined but not used */
output to c:\temp\test1.txt.
output stream s1 to value(value1). /* Error, stream s1 opened for output but not closed */
output close.
input through ls. /* Error, unnamed-input opened for input but not closed */
output stream s2 to "c:/temp/1.txt".
input stream s2 from "c:/temp/1.txt". /* Error, stream s2 opened for input before closed for output */