Consultor Eletrônico



Kbase P49860: How to write output to the same file from multiple programs
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/02/2009
Status: Verified

GOAL:

How to write output to the same file from multiple programs

GOAL:

How do I share a stream between multiple procedures?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

To have a main program and sub-programs that are called from the main program all be able to write output to the same file use code similar to the following:

/* Main Program (Main.p) */

DEFINE NEW SHARED STREAM OutStream.

OUTPUT STREAM OutStream TO "SomeFile".

PUT STREAM OutStream "Hello From Main Program" SKIP.

RUN SubProgram.p.

OUTPUT STREAM OutStream CLOSE.


/* Sub Program (SubProgram.p) */

DEFINE SHARED STREAM OutStream.

PUT STREAM OutStream "Hello From Sub Program" SKIP.

RETURN.