Consultor Eletrônico



Kbase P2442: unable to close unnamed stream
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/9/2009
Status: Unverified

SYMPTOM(s):

** <file-name> already has a conflicting use. (99)

Executing OUTPUT TO to an already open unnamed stream from an internal or an external procedure.

FACT(s) (Environment):

The statement: 'OUTPUT TO myfile. ' in the called RealProc procedure causes the error. The error occurs whether RealProc is an internal or an external procedure:
OUTPUT TO myfile.
RUN RealProc.
OUTPUT CLOSE.
PROCEDURE RealProc:
OUTPUT CLOSE.
OUTPUT TO myfile.
END PROCEDURE.
All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

CAUSE:

The OUTPUT CLOSE statement in the procedure RealProc does not close the unnamed OUTPUT stream which was opened in the calling procedure. Although an unnamed stream may be used from internal and external procedures, it can NOT be closed outside the procedure block that created it.

FIX:

When there is a need to close an output stream outside the Procedure that created it, use a named output stream. For example:
1. When the called procedure is an internal procedure:
DEFINE STREAM myStream.
OUTPUT STREAM myStream TO myfile.
RUN RealProc.
OUTPUT STREAM myStream CLOSE.
PROCEDURE RealProc:
OUTPUT STREAM myStream CLOSE.
OUTPUT STREAM myStream TO myfile.
END PROCEDURE.
2. When the called procedure is an external procedure:
/* Caller.p */
DEFINE NEW SHARED STREAM myStream.
OUTPUT STREAM myStream TO myfile.
RUN C:\OpenEdge\WRK101B\Called.p.
OUTPUT STREAM myStream CLOSE.
/* Called.p */
DEFINE SHARED STREAM myStream.
OUTPUT STREAM myStream CLOSE.
OUTPUT STREAM myStream TO myfile.