Consultor Eletrônico



Kbase P21236: Error 516 when running progress using in batch mode (-b)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   01/03/2010
Status: Unverified

SYMPTOM(s):

** Attempt to write with no current output destination. (516)

Running progress session with -b parameter

FACT(s) (Environment):

UNIX
Windows
Progress/OpenEdge Product Family

CAUSE:

This is expected behavior. The stdout stream was not redirected for the batch process, and the process is putting data on the stream using DISPLAY, PUT or similar statements. Unlike regular clients which by default direct the stdout stream to the terminal, the batch client does not have a default destination for this stream at all.

FIX:

There are two ways to handle this:

1. Ensure the stdout gets redirected on the OS level.

For example when running from the command line or script the output can be redirected to a file by adding a greater than sign followed by a filename, so the command line looks similar to "_progres -b -p myProc.p >output.log"
Other alternatives rely on the OS capabilities of setting up pipes between processes.

2. Ensure the stdout gets redirected from within the 4GL code.

This is done by providing an output destination using either OUTPUT TO or OUTPUT THROUGH statements, without specifying a named stream.
This must be done before executing the statements hat would cause output to be written to the stream.

Example:

OUTPUT TO report.txt.

FOR EACH customer:
DISPLAY cust-num name address address2 city state country SKIP(2)
WITH 1 COLUMN SIDE-LABELS.
END.

OUTPUT CLOSE.